Skip to content

Commit

Permalink
Adding helper function for UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snake14 committed Dec 3, 2023
1 parent 1474562 commit 5025dcc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/lib/screenshot-testing/support/page-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,22 @@ PageRenderer.prototype.getWholeCurrentUrl = function () {
return this.webpage.evaluate(() => window.location.href);
};

PageRenderer.prototype.screenshotPageWrapWithHiddenNav = async function (selector) {
if (typeof selector !== 'string') {
selector = '.pageWrap';
}

await this.webpage.evaluate(function () {
$('#secondNavBar').css('visibility', 'hidden'); // hide navbar so shadow isn't shown on screenshot
});
const pageWrap = await this.webpage.$(selector);
const screenshot = await pageWrap.screenshot();
await this.webpage.evaluate(function () {
$('#secondNavBar').css('visibility', 'visible'); // show navbar again
});
return screenshot;
};



exports.PageRenderer = PageRenderer;

0 comments on commit 5025dcc

Please sign in to comment.