From af91aae868d86f149952ed8736d13193753deaa7 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Thu, 8 Dec 2022 11:21:45 +0000 Subject: [PATCH] Add delay for accessibility node list to be populated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Looks like there are some internal (to Chromium) changes when `aria-expanded` state changes, but adding a 100ms delay from Accordion button `.click()` to calling `page.accessibility.snapshot()` fixes the child node loop ✅ Lots of commits landing so may not need this workaround in future: * https://github.com/chromium/chromium/commit/08fed9683b8590eafb4272fd5b49d7e7bb52c146 * https://github.com/chromium/chromium/commit/c7fae74a87c5d4d019614258b9ee845f99403079 * https://github.com/chromium/chromium/commit/06f376bfdbb1fccbb8a4e4c9c5e34f62beab894e * https://github.com/chromium/chromium/commit/86543a2742f2de6bc6c989c48d8723ded3759273 Another one ongoing to stablise accessibility objects: https://chromium-review.googlesource.com/c/chromium/src/+/4027071 --- src/govuk/components/accordion/accordion.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/govuk/components/accordion/accordion.test.js b/src/govuk/components/accordion/accordion.test.js index 66a45be946..025c5e5548 100644 --- a/src/govuk/components/accordion/accordion.test.js +++ b/src/govuk/components/accordion/accordion.test.js @@ -256,6 +256,7 @@ describe('/components/accordion', () => { ) await $element.click() + await page.waitForTimeout(100) await expect(getAccessibleName(page, $element)).resolves.toBe( 'Section A , Hide this section' @@ -274,6 +275,7 @@ describe('/components/accordion', () => { ) await $element.click() + await page.waitForTimeout(100) await expect(getAccessibleName(page, $element)).resolves.toBe( 'Test , Additional description , Hide this section'