finally some bloody test works

This commit is contained in:
counterweight 2025-02-26 17:22:37 +01:00
parent a1e07724ce
commit 1b5f227318
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 47 additions and 20 deletions

View file

@ -1,11 +1,15 @@
const { test, expect } = require('./test-setup');
const { test, expect, hardcodedSessionUuid } = require('./test-setup');
const SessionCreated = require('../src/models/SessionCreated');
const SessionRelatedToPublickey = require('../src/models/SessionRelatedToPublickey');
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 }) => {
for (const someModel of [
SessionCreated,
SessionRelatedToPublickey,
NymSet,
ContactDetailsSet,
@ -14,19 +18,22 @@ test('Mock records are present', async ({ page }) => {
}
});
test('Session cookie is there', async ({ page }) => {
await page.goto('http://localhost');
test('Hardcoded session cookie is there', async ({ context }) => {
const page = await context.newPage();
const cookiesInPage = await page.context().cookies();
expect(cookiesInPage).toHaveLength(1);
expect(cookiesInPage[0].name).toBe('sessionUuid');
expect(cookiesInPage[0].value).toBe(hardcodedSessionUuid);
});
test('Offers is reachable', async ({ page }) => {
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');
console.log(await page.innerHTML('html'));
const createOfferButton = page.locator('#button-start-create-offer');
await expect(createOfferButton).toBeVisible();
await expect(createOfferButton).toContainText('Crear nueva oferta');
});
// Check that UI controls are manageable with a few test cases.
// Check that the offer is created after submitting