Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
LeviPesin committed Jun 16, 2022
1 parent 8fa9940 commit 57b4333
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions test/src/mocha-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ export const itHeadlessOnly = (
}
};

export const itHeadfulOnly = (
description: string,
body: Mocha.Func
): Mocha.Test => {
if (isChrome && isHeadless === false) {
return it(description, body);
} else {
return xit(description, body);
}
};

export const itFirefoxOnly = (
description: string,
body: Mocha.Func
Expand Down
10 changes: 10 additions & 0 deletions test/src/screenshot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ describe('Screenshots', function () {
'screenshot-sanity.png'
);
});
itHeadfulOnly('should work in \'fromSurface: false\' mode', async () => {
const { page, server } = getTestState();

await page.setViewport({ width: 500, height: 500 });
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot({
fromSurface: false
});
expect(screenshot).toBeGolden('screenshot-fromsurface-false.png');
});
});

describe('ElementHandle.screenshot', function () {
Expand Down

0 comments on commit 57b4333

Please sign in to comment.