From a1e119342f003afcda192d48b7172bf62d0e8fe1 Mon Sep 17 00:00:00 2001 From: TimothyFothergill <67912934+TimothyFothergill@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:37:08 +0000 Subject: [PATCH] PLATUI-3359 roll in timeout changes and bump version --- CHANGELOG.md | 6 +++++ lib/browser-tests/jest-setup.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- .../timeout-dialog.browser.test.js | 22 +++++++++---------- .../timeout-multiple-tabs.browser.test.js | 6 ++--- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a19764b..e66904ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [6.43.0] - 2024-12-12 + +### Changed + +- Changes to `timeout-dialog` tests to reduce discrepancies between hardware when timing out actions + ## [6.42.0] - 2024-11-28 ### Changed diff --git a/lib/browser-tests/jest-setup.js b/lib/browser-tests/jest-setup.js index 5b56f760..78e86a71 100644 --- a/lib/browser-tests/jest-setup.js +++ b/lib/browser-tests/jest-setup.js @@ -5,7 +5,7 @@ beforeEach(async () => { expect.extend({ async toShowTimeoutDialog(page) { try { - await page.waitForSelector('#hmrc-timeout-dialog', { timeout: 500 }); + await page.waitForSelector('#hmrc-timeout-dialog', { timeout: 1000 }); return { message: () => 'expected page not to show timeout dialog', pass: true, diff --git a/package-lock.json b/package-lock.json index 2f818981..60ea81ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hmrc-frontend", - "version": "6.42.0", + "version": "6.43.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hmrc-frontend", - "version": "6.42.0", + "version": "6.43.0", "license": "Apache-2.0", "dependencies": { "accessible-autocomplete": "^3.0.1", diff --git a/package.json b/package.json index 744d35db..fafcf028 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hmrc-frontend", - "version": "6.42.0", + "version": "6.43.0", "description": "Design patterns for HMRC frontends", "scripts": { "start": "gulp dev", diff --git a/src/components/timeout-dialog/timeout-dialog.browser.test.js b/src/components/timeout-dialog/timeout-dialog.browser.test.js index c894806d..ff2be596 100644 --- a/src/components/timeout-dialog/timeout-dialog.browser.test.js +++ b/src/components/timeout-dialog/timeout-dialog.browser.test.js @@ -62,7 +62,7 @@ describe('/components/timeout-dialog', () => { req.url().endsWith('?keepalive') && req.method() === 'GET' && req.resourceType() === 'xhr' - ), { timeout: 500 }); + ), { timeout: 1000 }); await expect(page).toClick('button', { text: 'Stay signed in' }); await expect(keepAliveRequest).resolves.toBeDefined(); await expect(page).not.toShowTimeoutDialog(); @@ -76,7 +76,7 @@ describe('/components/timeout-dialog', () => { data-sign-out-url="/timeout-reached" `); await clockTickSeconds(page, 900); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/timeout-reached'); }); @@ -121,7 +121,7 @@ describe('/components/timeout-dialog', () => { await clockTickSeconds(page, 800); await expect(page).toClick('button', { text: 'Stay signed in' }); await clockTickSeconds(page, 900); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/timeout-reached'); }); @@ -140,7 +140,7 @@ describe('/components/timeout-dialog', () => { await delay(500); await expect(page.url()).not.toMatch('/timeout-reached'); await clockTickSeconds(page, 900); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/timeout-reached'); }); @@ -153,7 +153,7 @@ describe('/components/timeout-dialog', () => { `); await clockTickSeconds(page, 800); await expect(page).toClick('a', { text: 'Sign out' }); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/timeout-reached'); }); @@ -166,7 +166,7 @@ describe('/components/timeout-dialog', () => { data-sign-out-url="/signed-out-early" `); await clockTickSeconds(page, 900); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/timeout-reached'); await renderTimeoutDialog(page, ` data-timeout="900" @@ -177,7 +177,7 @@ describe('/components/timeout-dialog', () => { `); await clockTickSeconds(page, 800); await expect(page).toClick('a', { text: 'Sign out' }); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/signed-out-early'); }); @@ -204,7 +204,7 @@ describe('/components/timeout-dialog', () => { document.getElementById('hmrc-timeout-sign-out-link').click(); window.clock.tick(1000); // to reach timeout while sign out page is still loading }); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/signed-out-early'); }); @@ -254,7 +254,7 @@ describe('/components/timeout-dialog', () => { ]); await clockTickSeconds(page, 1); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/timeout-reached'); }); @@ -291,7 +291,7 @@ describe('/components/timeout-dialog', () => { ); await clockTickSeconds(page, 1); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page.url()).toMatch('/timeout-reached'); }); }); @@ -326,7 +326,7 @@ describe('/components/timeout-dialog', () => { expect(visibleMessage).toBe('For your security, we will sign you out in 0 seconds.'); expect(audibleMessage).toBe('For your security, we will sign you out in 20 seconds.'); completeSlowTimeoutRequest(); - await page.waitForNavigation({ timeout: 500 }); + await page.waitForNavigation({ timeout: 1000 }); await expect(page).toMatchTextContent('timeout page reached'); }); diff --git a/src/components/timeout-dialog/timeout-multiple-tabs.browser.test.js b/src/components/timeout-dialog/timeout-multiple-tabs.browser.test.js index 8779f877..9fac6377 100644 --- a/src/components/timeout-dialog/timeout-multiple-tabs.browser.test.js +++ b/src/components/timeout-dialog/timeout-multiple-tabs.browser.test.js @@ -17,7 +17,7 @@ describe('multiple tabs open with synchronise tabs feature switch enabled', () = await expect(foregroundPage).toClick('button', { text: 'Stay signed in' }); - await expect(backgroundPage).not.toMatchTextContent('about to be signed out'); + await expect(backgroundPage).not.toMatchTextContent('about to be signed out', { timeout: 5000 }); await session.close(); }); @@ -32,7 +32,7 @@ describe('multiple tabs open with synchronise tabs feature switch enabled', () = const foregroundPage = await session.newPage(); await foregroundPage.goto(examplePreview('page-heading/default')); - await expect(backgroundPage).not.toMatchTextContent('about to be signed out'); + await expect(backgroundPage).not.toMatchTextContent('about to be signed out', { timeout: 5000 }); await session.close(); }); @@ -47,7 +47,7 @@ describe('multiple tabs open with synchronise tabs feature switch enabled', () = const foregroundPage = await session.newPage(); await foregroundPage.goto(examplePreview('timeout-dialog/synchronise-tabs')); - await expect(backgroundPageWithUnsyncedWarnings).toMatchTextContent('about to be signed out'); + await expect(backgroundPageWithUnsyncedWarnings).toMatchTextContent('about to be signed out', { timeout: 5000 }); await session.close(); });