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 Oct 15, 2020
1 parent b196ccf commit 99ef1d4
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 @@ -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 });
}

Expand Down

0 comments on commit 99ef1d4

Please sign in to comment.