diff --git a/apps/web/e2e/smoke/homepage.spec.ts b/apps/web/e2e/smoke/homepage.spec.ts index 93367e15048b..8da952eab761 100644 --- a/apps/web/e2e/smoke/homepage.spec.ts +++ b/apps/web/e2e/smoke/homepage.spec.ts @@ -77,9 +77,6 @@ test.describe('Front page', () => { }) test(`should navigate to featured link @lang:is`, async () => { - if (!context) { - throw new Error('Context is not initialized') - } test.slow() const page = await createPageAndNavigate(context, '/') const featuredLinks = page.locator('[data-testid="featured-link"]') @@ -104,9 +101,6 @@ test.describe('Front page', () => { }) test(`should navigate to featured link @lang:en`, async () => { - if (!context) { - throw new Error('Context is not initialized') - } test.slow() const page = await createPageAndNavigate(context, '/en') const featuredLinks = page.locator('[data-testid="featured-link"]') @@ -131,9 +125,6 @@ test.describe('Front page', () => { }) test(`should have link on life events pages to navigate back to the main page @lang:is`, async () => { - if (!context) { - throw new Error('Context is not initialized') - } test.slow() const page = await createPageAndNavigate(context, '/') const lifeEventsCards = page.locator('[data-testid="lifeevent-card"]') @@ -147,7 +138,6 @@ test.describe('Front page', () => { await lifeEventPage.goto(url) await lifeEventPage.locator('[data-testid="link-back-home"]').click() } - await lifeEventPage.locator('[data-testid="link-back-home"]').click() await expect( lifeEventPage.locator('data-testid=home-heading'), ).toBeVisible() @@ -157,9 +147,6 @@ test.describe('Front page', () => { }) test(`should have link on life events pages to navigate back to the main page @lang:en`, async () => { - if (!context) { - throw new Error('Context is not initialized') - } test.slow() const page = await createPageAndNavigate(context, '/en') const lifeEventsCards = page.locator('[data-testid="lifeevent-card"]') diff --git a/apps/web/e2e/smoke/search.spec.ts b/apps/web/e2e/smoke/search.spec.ts index d1a38872936a..ef4369bb3ae5 100644 --- a/apps/web/e2e/smoke/search.spec.ts +++ b/apps/web/e2e/smoke/search.spec.ts @@ -26,7 +26,7 @@ test.describe('Search feature', () => { test('has expected sections', async () => { const testPhrase = 'umsókn' const page = await context.newPage() - await page.goto('/') + await page.goto('/', { waitUntil: 'networkidle' }) await page .getByRole('textbox', { name: 'Leitaðu á Ísland.is' }) .fill(testPhrase) @@ -41,7 +41,7 @@ test.describe('Search feature', () => { test('should have no search results for long bogus search words', async () => { const page = await context.newPage() - await page.goto('/') + await page.goto('/', { waitUntil: 'networkidle' }) await page .getByRole('textbox', { name: 'Leitaðu á Ísland.is' }) .fill('abcdefhijklmnopqrstuvwxyz1234567890') diff --git a/apps/web/e2e/smoke/sites-of-institutions.spec.ts b/apps/web/e2e/smoke/sites-of-institutions.spec.ts index 71aa1a2e411a..7d9d5881a9a1 100644 --- a/apps/web/e2e/smoke/sites-of-institutions.spec.ts +++ b/apps/web/e2e/smoke/sites-of-institutions.spec.ts @@ -14,7 +14,7 @@ type GetByRoleParameters = Parameters type Orgs = { organisationName: string organisationHome?: string - enabled?: boolean + skip?: boolean target?: { role: GetByRoleParameters[0]; options?: GetByRoleParameters[1] } } const orgs: Orgs[] = [ @@ -27,7 +27,7 @@ const orgs: Orgs[] = [ { organisationName: 'Sjúkratryggingar', target: { role: 'link' } }, { organisationName: 'Ríkislögmaður' }, { organisationName: 'Landskjörstjórn', target: { role: 'link' } }, - { organisationName: 'Opinber nýsköpun', enabled: true }, + { organisationName: 'Opinber nýsköpun', skip: true }, { organisationName: 'Sýslumenn' }, { organisationName: 'Fjársýslan' }, { @@ -43,7 +43,6 @@ const orgs: Orgs[] = [ test.describe('Sites of institutions', () => { let context: BrowserContext - test.beforeAll(async ({ browser }) => { context = await session({ browser, @@ -51,37 +50,38 @@ test.describe('Sites of institutions', () => { homeUrl: '/s', }) }) - test.afterAll(async () => { await context.close() }) + orgs.forEach( + ({ + organisationName, + organisationHome = `/${slugify(organisationName, { lower: true })}`, + target, + skip, + }) => { + test(organisationName, async () => { + if (skip) return + const page = await context.newPage() + const url = `/s${organisationHome}` + + const response = await page.goto(url, { timeout: 30000 }) + expect(response?.ok()).toBe(true) - for (const { - organisationName, - organisationHome = `/${slugify(organisationName, { lower: true })}`, - target, - enabled, - } of orgs) { - test(organisationName, async ({ browser }) => { - if (enabled) return - const pageContext = await session({ - browser, - idsLoginOn: false, - homeUrl: '/s', + // Verify we landed on the correct URL + expect(page.url()).toContain(url) + + await expect( + page + .getByRole(target?.role ?? 'heading', { + ...{ name: organisationName }, + ...target?.options, + }) + .first(), + ).toBeVisible() + + await page.close() }) - const page = await pageContext.newPage() - const url = `/s${organisationHome}` - await page.goto(url) - await expect( - page - .getByRole(target?.role ?? 'heading', { - name: organisationName, - ...target?.options, - }) - .first(), - ).toBeVisible() - await page.close() - await pageContext.close() - }) - } + }, + ) })