Skip to content

Commit

Permalink
Toggle hidden content visible for visual regression tests (#160)
Browse files Browse the repository at this point in the history
* Toggle hidden content visible for visual regression tests

**Why**: Check for regressions of content which may be collapsed (hidden) by default.

* Apply lint fixes
  • Loading branch information
aduth authored Jan 19, 2021
1 parent 9a9ac3c commit 09c78e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/screenshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ 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 09c78e5

Please sign in to comment.