Skip to content

Commit

Permalink
Toggle hidden content visible for visual regression tests
Browse files Browse the repository at this point in the history
**Why**: Check for regressions of content which may be collapsed (hidden) by default.
  • Loading branch information
aduth committed Jan 19, 2021
1 parent 9a9ac3c commit 3a8957c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/screenshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,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 });
}

Expand Down

0 comments on commit 3a8957c

Please sign in to comment.