mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Add screenshot test to verify clipping of offscreen areas.
This commit is contained in:
parent
9de48fb51e
commit
af52f13e22
BIN
test/golden/screenshot-offscreen-clip.png
Normal file
BIN
test/golden/screenshot-offscreen-clip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
15
test/test.js
15
test/test.js
@ -215,7 +215,6 @@ describe('Puppeteer', function() {
|
|||||||
var screenshot = await page.screenshot();
|
var screenshot = await page.screenshot();
|
||||||
expect(screenshot).toBeGolden('screenshot-sanity.png');
|
expect(screenshot).toBeGolden('screenshot-sanity.png');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should clip rect', SX(async function() {
|
it('should clip rect', SX(async function() {
|
||||||
await page.setViewportSize({width: 500, height: 500});
|
await page.setViewportSize({width: 500, height: 500});
|
||||||
await page.navigate(STATIC_PREFIX + '/grid.html');
|
await page.navigate(STATIC_PREFIX + '/grid.html');
|
||||||
@ -229,7 +228,19 @@ describe('Puppeteer', function() {
|
|||||||
});
|
});
|
||||||
expect(screenshot).toBeGolden('screenshot-clip-rect.png');
|
expect(screenshot).toBeGolden('screenshot-clip-rect.png');
|
||||||
}));
|
}));
|
||||||
|
it('should work for offscreen clip', SX(async function() {
|
||||||
|
await page.setViewportSize({width: 500, height: 500});
|
||||||
|
await page.navigate(STATIC_PREFIX + '/grid.html');
|
||||||
|
var screenshot = await page.screenshot({
|
||||||
|
clip: {
|
||||||
|
x: 50,
|
||||||
|
y: 600,
|
||||||
|
width: 100,
|
||||||
|
height: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(screenshot).toBeGolden('screenshot-offscreen-clip.png');
|
||||||
|
}));
|
||||||
it('should run in parallel', SX(async function() {
|
it('should run in parallel', SX(async function() {
|
||||||
await page.setViewportSize({width: 500, height: 500});
|
await page.setViewportSize({width: 500, height: 500});
|
||||||
await page.navigate(STATIC_PREFIX + '/grid.html');
|
await page.navigate(STATIC_PREFIX + '/grid.html');
|
||||||
|
Loading…
Reference in New Issue
Block a user