cool tests!!!

This commit is contained in:
counterweight 2025-02-26 23:56:14 +01:00
parent 3ac7425824
commit c1161e3a66
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 82 additions and 10 deletions

View file

@ -5,9 +5,7 @@ const SessionRelatedToPublickey = require('../src/models/SessionRelatedToPublick
const NymSet = require('../src/models/NymSet');
const ContactDetailsSet = require('../src/models/ContactDetailsSet');
const sessionService = require('../src/services/sessionService');
test('Mock records are present', async ({ page }) => {
test('Mock records are present', async () => {
for (const someModel of [
SessionCreated,
SessionRelatedToPublickey,
@ -28,12 +26,60 @@ test('Hardcoded session cookie is there', async ({ context }) => {
test('Offers is reachable', async ({ context }) => {
const page = await context.newPage();
const cookiez = await page.context().cookies();
await page.pause();
await page.goto('http://localhost/offers');
const createOfferButton = page.locator('#button-start-create-offer');
await expect(createOfferButton).toBeVisible();
await expect(createOfferButton).toContainText('Crear nueva oferta');
});
test('Create an offer with a few options creates in DB', async ({
context,
}) => {
const page = await context.newPage();
await page.goto('http://localhost/offers');
await page.getByRole('button', { name: 'Crear nueva oferta' }).click();
await page.getByRole('button', { name: 'Quiero vender Bitcoin' }).click();
await page.getByRole('button', { name: 'Quiero comprar Bitcoin' }).click();
await page.getByRole('button', { name: '+' }).click();
await page.getByRole('button', { name: '+' }).click();
await page.getByRole('button', { name: '+' }).click();
await page.getByRole('button', { name: '-' }).click();
await expect(page.locator('#premium-value')).toContainText('2%');
await page.locator('#input-eur-amount').click();
await page.locator('#input-eur-amount').press('ControlOrMeta+a');
await page.locator('#input-eur-amount').fill('50');
await expect(page.locator('#input-eur-amount')).toHaveValue('50');
await page
.getByText(
'Añade los detalles de tu oferta Quiero comprar Bitcoin Quiero vender Bitcoin'
)
.click();
await page
.getByRole('textbox', { name: '¿Dónde? Ej."Eixample", "La' })
.click();
await page
.getByRole('textbox', { name: '¿Dónde? Ej."Eixample", "La' })
.fill('En algún lugar');
await page
.getByRole('textbox', { name: '¿Cuándo? Ej."Cualquier hora' })
.click();
await page
.getByRole('textbox', { name: '¿Cuándo? Ej."Cualquier hora' })
.fill('En algún momento');
await page.locator('#onchain-checkbox').uncheck();
await expect(page.locator('#onchain-checkbox')).not.toBeChecked();
await expect(page.locator('#lightning-checkbox')).toBeChecked();
await page.locator('#input-eur-amount').click();
await page.locator('#my-trusted-trusted-checkbox').uncheck();
await page.locator('#all-members-checkbox').check();
await page.locator('#my-trusted-trusted-checkbox').check();
await page.locator('#all-members-checkbox').uncheck();
await page.locator('#large-bills-checkbox').check();
await page.getByRole('button', { name: 'Publicar oferta' }).click();
await page.locator('#close-offer-controls-x').click();
await expect(page.locator('#offers-root')).toMatchAriaSnapshot(
`- button "Crear nueva oferta"`
);
});