From 99ef1d4cf4b9df555616e3091511554c35e2f84e Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 15 Oct 2020 12:55:35 -0400 Subject: [PATCH] Toggle hidden content visible for visual regression tests **Why**: Check for regressions of content which may be collapsed (hidden) by default. --- test/screenshot.test.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/screenshot.test.js b/test/screenshot.test.js index 275e2f43..3b382661 100644 --- a/test/screenshot.test.js +++ b/test/screenshot.test.js @@ -34,9 +34,18 @@ async function stubAnimations() { }); } +async function toggleHiddenContent() { + await page.$$eval('.usa-accordion__container', containers => ( + containers.forEach(container => container.removeAttribute('hidden')) + )); +} + async function getScreenshot(url) { await page.goto(url); - await stubAnimations(); + await Promise.all([ + stubAnimations(), + toggleHiddenContent(), + ]); return page.screenshot({ fullPage: true }); }