test: roll test runner 0.9.22 (#4072)
This commit is contained in:
Родитель
ce7aa7a608
Коммит
1fe3c783b4
|
@ -1096,9 +1096,9 @@
|
|||
}
|
||||
},
|
||||
"@jest/types": {
|
||||
"version": "26.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@jest/types/-/types-26.5.0.tgz",
|
||||
"integrity": "sha512-nH9DFLqaIhB+RVgjivemvMiFSWw/BKwbZGxBAMv8CCTvUyFoK8RwHhAlmlXIvMBrf5Z3YQ4p9cq3Qh9EDctGvA==",
|
||||
"version": "26.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@jest/types/-/types-26.5.2.tgz",
|
||||
"integrity": "sha512-QDs5d0gYiyetI8q+2xWdkixVQMklReZr4ltw7GFDtb4fuJIBCE6mzj2LnitGqCuAlLap6wPyb8fpoHgwZz5fdg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/istanbul-lib-coverage": "^2.0.0",
|
||||
|
@ -1160,9 +1160,9 @@
|
|||
}
|
||||
},
|
||||
"@playwright/test": {
|
||||
"version": "0.9.9",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-0.9.9.tgz",
|
||||
"integrity": "sha512-JcpesJZG1EEdqlWllRHlprQ7v7IxL9IujwuIK/YcGpeeihEgZCyacL55Zg9i45n+0BWzXnOPQURCdWL4VnXySw==",
|
||||
"version": "0.9.10",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-0.9.10.tgz",
|
||||
"integrity": "sha512-jH/cqTnhiufgOUMuoTaK7bRnzKy7/FmJwmIHmFc/V9Cc4m//ETJJwavHog+GCVW7rOmsGtsBzhu/XoiZ3t3aWg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"playwright": "1.4.0-next.1601161680085",
|
||||
|
@ -1170,9 +1170,9 @@
|
|||
}
|
||||
},
|
||||
"@playwright/test-runner": {
|
||||
"version": "0.9.20",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test-runner/-/test-runner-0.9.20.tgz",
|
||||
"integrity": "sha512-3en4cjeWn2JgrHTJEmPVrYmEBkYegSu3uML49mcmQLpNyozyGy4EKysoeUuyXRoZQz4ptWY6AzFtFPyt34KLCw==",
|
||||
"version": "0.9.22",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test-runner/-/test-runner-0.9.22.tgz",
|
||||
"integrity": "sha512-U1RcwMUcL2dBKc4pa7zb0s43jPNRySeXV7QxTT4F7uiyVQp6VLxH/1CU36MM9iiBR43X6rGSdsjmD3FDzc3piw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.10.4",
|
||||
|
@ -2225,9 +2225,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001143",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001143.tgz",
|
||||
"integrity": "sha512-p/PO5YbwmCpBJPxjOiKBvAlUPgF8dExhfEpnsH+ys4N/791WHrYrGg0cyHiAURl5hSbx5vIcjKmQAP6sHDYH3w==",
|
||||
"version": "1.0.30001144",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001144.tgz",
|
||||
"integrity": "sha512-4GQTEWNMnVZVOFG3BK0xvGeaDAtiPAbG2N8yuMXuXzx/c2Vd4XoMPO8+E918zeXn5IF0FRVtGShBfkfQea2wHQ==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
|
@ -2858,9 +2858,9 @@
|
|||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.576",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.576.tgz",
|
||||
"integrity": "sha512-uSEI0XZ//5ic+0NdOqlxp0liCD44ck20OAGyLMSymIWTEAtHKVJi6JM18acOnRgUgX7Q65QqnI+sNncNvIy8ew==",
|
||||
"version": "1.3.577",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.577.tgz",
|
||||
"integrity": "sha512-dSb64JQSFif/pD8mpVAgSFkbVi6YHbK6JeEziwNNmXlr/Ne2rZtseFK5SM7JoWSLf6gP0gVvRGi4/2ZRhSX/rA==",
|
||||
"dev": true
|
||||
},
|
||||
"elliptic": {
|
||||
|
@ -3296,16 +3296,16 @@
|
|||
}
|
||||
},
|
||||
"expect": {
|
||||
"version": "26.5.0",
|
||||
"resolved": "https://registry.npmjs.org/expect/-/expect-26.5.0.tgz",
|
||||
"integrity": "sha512-oIOy3mHWjnF5ZICuaui5kdtJZQ+D7XHWyUQDxk1WhIRCkcIYc24X23bOfikgCNU6i9wcSqLQhwPOqeRp09naxg==",
|
||||
"version": "26.5.2",
|
||||
"resolved": "https://registry.npmjs.org/expect/-/expect-26.5.2.tgz",
|
||||
"integrity": "sha512-ccTGrXZd8DZCcvCz4htGXTkd/LOoy6OEtiDS38x3/VVf6E4AQL0QoeksBiw7BtGR5xDNiRYPB8GN6pfbuTOi7w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jest/types": "^26.5.0",
|
||||
"@jest/types": "^26.5.2",
|
||||
"ansi-styles": "^4.0.0",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"jest-matcher-utils": "^26.5.0",
|
||||
"jest-message-util": "^26.5.0",
|
||||
"jest-matcher-utils": "^26.5.2",
|
||||
"jest-message-util": "^26.5.2",
|
||||
"jest-regex-util": "^26.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -4368,15 +4368,15 @@
|
|||
"dev": true
|
||||
},
|
||||
"jest-diff": {
|
||||
"version": "26.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.5.0.tgz",
|
||||
"integrity": "sha512-CmDMMPkVMxrrh0Dv/4M9kh1tsYsZnYTQMMTvIFpePBSk9wMVfcyfg30TCq+oR9AzGbw8vsI50Gk1HmlMMlhoJg==",
|
||||
"version": "26.5.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.5.2.tgz",
|
||||
"integrity": "sha512-HCSWDUGwsov5oTlGzrRM+UPJI/Dpqi9jzeV0fdRNi3Ch5bnoXhnyJMmVg2juv9081zLIy3HGPI5mcuGgXM2xRA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^4.0.0",
|
||||
"diff-sequences": "^26.5.0",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"pretty-format": "^26.5.0"
|
||||
"pretty-format": "^26.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": {
|
||||
|
@ -4437,15 +4437,15 @@
|
|||
"dev": true
|
||||
},
|
||||
"jest-matcher-utils": {
|
||||
"version": "26.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.5.0.tgz",
|
||||
"integrity": "sha512-QgbbxqFT8wiTi4o/7MWj2vHlcmMjACG8vnJ9pJ7svVDmkzEnTUGdHXWLKB1aZhbnyXetMNRF+TSMcDS9aGfuzA==",
|
||||
"version": "26.5.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.5.2.tgz",
|
||||
"integrity": "sha512-W9GO9KBIC4gIArsNqDUKsLnhivaqf8MSs6ujO/JDcPIQrmY+aasewweXVET8KdrJ6ADQaUne5UzysvF/RR7JYA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^4.0.0",
|
||||
"jest-diff": "^26.5.0",
|
||||
"jest-diff": "^26.5.2",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"pretty-format": "^26.5.0"
|
||||
"pretty-format": "^26.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": {
|
||||
|
@ -4500,13 +4500,13 @@
|
|||
}
|
||||
},
|
||||
"jest-message-util": {
|
||||
"version": "26.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.5.0.tgz",
|
||||
"integrity": "sha512-UEOqdoTfX0AFyReL4q5N3CfDBWt+AtQzeszZuuGapU39vwEk90rTSBghCA/3FFEZzvGfH2LE4+0NaBI81Cu2Ow==",
|
||||
"version": "26.5.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.5.2.tgz",
|
||||
"integrity": "sha512-Ocp9UYZ5Jl15C5PNsoDiGEk14A4NG0zZKknpWdZGoMzJuGAkVt10e97tnEVMYpk7LnQHZOfuK2j/izLBMcuCZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"@jest/types": "^26.5.0",
|
||||
"@jest/types": "^26.5.2",
|
||||
"@types/stack-utils": "^2.0.0",
|
||||
"chalk": "^4.0.0",
|
||||
"graceful-fs": "^4.2.4",
|
||||
|
@ -5447,12 +5447,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"pretty-format": {
|
||||
"version": "26.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.5.0.tgz",
|
||||
"integrity": "sha512-NcgRuuTutUJ9+Br4P19DFThpJYnYBiugfRmZEA6pXrUeG+IcMSmppb88rU+iPA+XAJcjTYlCb5Ed6miHg/Qqqw==",
|
||||
"version": "26.5.2",
|
||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.5.2.tgz",
|
||||
"integrity": "sha512-VizyV669eqESlkOikKJI8Ryxl/kPpbdLwNdPs2GrbQs18MpySB5S0Yo0N7zkg2xTRiFq4CFw8ct5Vg4a0xP0og==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jest/types": "^26.5.0",
|
||||
"@jest/types": "^26.5.2",
|
||||
"ansi-regex": "^5.0.0",
|
||||
"ansi-styles": "^4.0.0",
|
||||
"react-is": "^16.12.0"
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
"ws": "^7.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "0.9.9",
|
||||
"@playwright/test-runner": "0.9.20",
|
||||
"@playwright/test": "0.9.10",
|
||||
"@playwright/test-runner": "0.9.22",
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/extract-zip": "^1.6.2",
|
||||
"@types/mime": "^2.0.3",
|
||||
|
|
|
@ -164,7 +164,7 @@ describe('oopif', (suite, { browserName }) => {
|
|||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
expect(await page.screenshot()).toMatchImage('screenshot-oopif.png', { threshold: 0.3 });
|
||||
expect(await page.screenshot()).toMatchSnapshot('screenshot-oopif.png', { threshold: 0.3 });
|
||||
});
|
||||
|
||||
it('should load oopif iframes with subresources and route', async function({browser, page, server, context}) {
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
await page.evaluate(() => window.scrollBy(50, 100));
|
||||
const elementHandle = await page.$('.box:nth-of-type(3)');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-bounding-box.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-bounding-box.png');
|
||||
});
|
||||
|
||||
it('should take into account padding and border', async ({page}) => {
|
||||
|
@ -49,7 +49,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
`);
|
||||
const elementHandle = await page.$('div#d');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-padding-border.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-padding-border.png');
|
||||
});
|
||||
|
||||
it('should capture full element when larger than viewport in parallel', async ({page}) => {
|
||||
|
@ -75,7 +75,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
const elementHandles = await page.$$('div.to-screenshot');
|
||||
const promises = elementHandles.map(handle => handle.screenshot());
|
||||
const screenshots = await Promise.all(promises);
|
||||
expect(screenshots[2]).toMatchImage('screenshot-element-larger-than-viewport.png');
|
||||
expect(screenshots[2]).toMatchSnapshot('screenshot-element-larger-than-viewport.png');
|
||||
|
||||
await verifyViewport(page, 500, 500);
|
||||
});
|
||||
|
@ -102,7 +102,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
`);
|
||||
const elementHandle = await page.$('div.to-screenshot');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-larger-than-viewport.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-larger-than-viewport.png');
|
||||
|
||||
await verifyViewport(page, 500, 500);
|
||||
});
|
||||
|
@ -128,7 +128,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
`);
|
||||
const elementHandle = await page.$('div.to-screenshot');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-scrolled-into-view.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-scrolled-into-view.png');
|
||||
});
|
||||
|
||||
it('should scroll 15000px into view', async ({page}) => {
|
||||
|
@ -152,7 +152,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
`);
|
||||
const elementHandle = await page.$('div.to-screenshot');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-scrolled-into-view.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-scrolled-into-view.png');
|
||||
});
|
||||
|
||||
it('should work with a rotated element', async ({page}) => {
|
||||
|
@ -166,7 +166,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
transform: rotateZ(200deg);"> </div>`);
|
||||
const elementHandle = await page.$('div');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-rotate.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-rotate.png');
|
||||
});
|
||||
|
||||
it('should fail to screenshot a detached element', async ({page, server}) => {
|
||||
|
@ -201,14 +201,14 @@ describe('element screenshot', (suite, parameters) => {
|
|||
expect(done).toBe(false);
|
||||
await elementHandle.evaluate(e => e.style.visibility = 'visible');
|
||||
const screenshot = await promise;
|
||||
expect(screenshot).toMatchImage('screenshot-element-bounding-box.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-bounding-box.png');
|
||||
});
|
||||
|
||||
it('should work for an element with fractional dimensions', async ({page}) => {
|
||||
await page.setContent('<div style="width:48.51px;height:19.8px;border:1px solid black;"></div>');
|
||||
const elementHandle = await page.$('div');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-fractional.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-fractional.png');
|
||||
});
|
||||
|
||||
it('should work with a mobile viewport', (test, { browserName }) => {
|
||||
|
@ -220,7 +220,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
await page.evaluate(() => window.scrollBy(50, 100));
|
||||
const elementHandle = await page.$('.box:nth-of-type(3)');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-mobile.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-mobile.png');
|
||||
await context.close();
|
||||
});
|
||||
|
||||
|
@ -233,7 +233,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
await page.evaluate(() => window.scrollBy(50, 100));
|
||||
const elementHandle = await page.$('.box:nth-of-type(3)');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-mobile-dsf.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-mobile-dsf.png');
|
||||
await context.close();
|
||||
});
|
||||
|
||||
|
@ -241,7 +241,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
await page.setContent('<div style="position:absolute; top: 10.3px; left: 20.4px;width:50.3px;height:20.2px;border:1px solid black;"></div>');
|
||||
const elementHandle = await page.$('div');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-fractional-offset.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-fractional-offset.png');
|
||||
});
|
||||
|
||||
it('should take screenshots when default viewport is null', async ({server, browser}) => {
|
||||
|
@ -373,7 +373,7 @@ describe('element screenshot', (suite, parameters) => {
|
|||
return new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f)));
|
||||
});
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-element-bounding-box.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-element-bounding-box.png');
|
||||
});
|
||||
|
||||
it('should take screenshot of disabled button', async ({page}) => {
|
||||
|
@ -391,6 +391,6 @@ describe('element screenshot', (suite, parameters) => {
|
|||
const elementHandle = await page.$('.box:nth-of-type(3)');
|
||||
const outputPath = testInfo.outputPath(path.join('these', 'are', 'directories', 'screenshot.png'));
|
||||
await elementHandle.screenshot({path: outputPath});
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchImage('screenshot-element-bounding-box.png');
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchSnapshot('screenshot-element-bounding-box.png');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -120,8 +120,8 @@ it('should not affect screenshots', (test, { browserName, headful }) => {
|
|||
page.screenshot(),
|
||||
page2.screenshot(),
|
||||
]);
|
||||
expect(screenshots[0]).toMatchImage('screenshot-sanity.png');
|
||||
expect(screenshots[1]).toMatchImage('grid-cell-0.png');
|
||||
expect(screenshots[0]).toMatchSnapshot('screenshot-sanity.png');
|
||||
expect(screenshots[1]).toMatchSnapshot('grid-cell-0.png');
|
||||
});
|
||||
|
||||
it('should change focused iframe', async ({page, server}) => {
|
||||
|
|
|
@ -29,7 +29,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
await page.setViewportSize({width: 500, height: 500});
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const screenshot = await page.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-sanity.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-sanity.png');
|
||||
});
|
||||
|
||||
it('should clip rect', async ({page, server}) => {
|
||||
|
@ -43,7 +43,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
height: 100
|
||||
}
|
||||
});
|
||||
expect(screenshot).toMatchImage('screenshot-clip-rect.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-clip-rect.png');
|
||||
});
|
||||
|
||||
it('should clip rect with fullPage', async ({page, server}) => {
|
||||
|
@ -59,7 +59,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
height: 100,
|
||||
},
|
||||
});
|
||||
expect(screenshot).toMatchImage('screenshot-clip-rect.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-clip-rect.png');
|
||||
});
|
||||
|
||||
it('should clip elements to the viewport', async ({page, server}) => {
|
||||
|
@ -73,7 +73,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
height: 100
|
||||
}
|
||||
});
|
||||
expect(screenshot).toMatchImage('screenshot-offscreen-clip.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-offscreen-clip.png');
|
||||
});
|
||||
|
||||
it('should throw on clip outside the viewport', async ({page, server}) => {
|
||||
|
@ -105,7 +105,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
}));
|
||||
}
|
||||
const screenshots = await Promise.all(promises);
|
||||
expect(screenshots[1]).toMatchImage('grid-cell-1.png');
|
||||
expect(screenshots[1]).toMatchSnapshot('grid-cell-1.png');
|
||||
});
|
||||
|
||||
it('should take fullPage screenshots', async ({page, server}) => {
|
||||
|
@ -114,7 +114,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
const screenshot = await page.screenshot({
|
||||
fullPage: true
|
||||
});
|
||||
expect(screenshot).toMatchImage('screenshot-grid-fullpage.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-grid-fullpage.png');
|
||||
});
|
||||
|
||||
it('should restore viewport after fullPage screenshot', async ({page, server}) => {
|
||||
|
@ -137,7 +137,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
promises.push(pages[i].screenshot({ clip: { x: 50 * (i % 2), y: 0, width: 50, height: 50 } }));
|
||||
const screenshots = await Promise.all(promises);
|
||||
for (let i = 0; i < N; ++i)
|
||||
expect(screenshots[i]).toMatchImage(`grid-cell-${i % 2}.png`);
|
||||
expect(screenshots[i]).toMatchSnapshot(`grid-cell-${i % 2}.png`);
|
||||
await Promise.all(pages.map(page => page.close()));
|
||||
});
|
||||
|
||||
|
@ -155,14 +155,14 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
<div style="background:transparent"></div>
|
||||
`);
|
||||
const screenshot = await page.screenshot({omitBackground: true});
|
||||
expect(screenshot).toMatchImage('transparent.png');
|
||||
expect(screenshot).toMatchSnapshot('transparent.png');
|
||||
});
|
||||
|
||||
it('should render white background on jpeg file', async ({page, server}) => {
|
||||
await page.setViewportSize({ width: 100, height: 100 });
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const screenshot = await page.screenshot({omitBackground: true, type: 'jpeg'});
|
||||
expect(screenshot).toMatchImage('white.jpg');
|
||||
expect(screenshot).toMatchSnapshot('white.jpg');
|
||||
});
|
||||
|
||||
it('should work with odd clip size on Retina displays', async ({page}) => {
|
||||
|
@ -174,7 +174,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
height: 11,
|
||||
}
|
||||
});
|
||||
expect(screenshot).toMatchImage('screenshot-clip-odd-size.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-clip-odd-size.png');
|
||||
});
|
||||
|
||||
it('should work with a mobile viewport', (test, { browserName }) => {
|
||||
|
@ -184,7 +184,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/overflow.html');
|
||||
const screenshot = await page.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-mobile.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-mobile.png');
|
||||
await context.close();
|
||||
});
|
||||
|
||||
|
@ -195,7 +195,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/overflow.html');
|
||||
const screenshot = await page.screenshot({ clip: { x: 10, y: 10, width: 100, height: 150 } });
|
||||
expect(screenshot).toMatchImage('screenshot-mobile-clip.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-mobile-clip.png');
|
||||
await context.close();
|
||||
});
|
||||
|
||||
|
@ -206,7 +206,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/overflow-large.html');
|
||||
const screenshot = await page.screenshot({ fullPage: true });
|
||||
expect(screenshot).toMatchImage('screenshot-mobile-fullpage.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-mobile-fullpage.png');
|
||||
await context.close();
|
||||
});
|
||||
|
||||
|
@ -214,7 +214,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
await page.setViewportSize({width: 500, height: 500});
|
||||
await page.goto(server.PREFIX + '/screenshots/canvas.html');
|
||||
const screenshot = await page.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-canvas.png', { threshold: 0.3 });
|
||||
expect(screenshot).toMatchSnapshot('screenshot-canvas.png', { threshold: 0.3 });
|
||||
});
|
||||
|
||||
it('should work for webgl', (test, { browserName }) => {
|
||||
|
@ -223,14 +223,14 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
await page.setViewportSize({width: 640, height: 480});
|
||||
await page.goto(server.PREFIX + '/screenshots/webgl.html');
|
||||
const screenshot = await page.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-webgl.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-webgl.png');
|
||||
});
|
||||
|
||||
it('should work for translateZ', async ({page, server}) => {
|
||||
await page.setViewportSize({width: 500, height: 500});
|
||||
await page.goto(server.PREFIX + '/screenshots/translateZ.html');
|
||||
const screenshot = await page.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-translateZ.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-translateZ.png');
|
||||
});
|
||||
|
||||
it('should work while navigating', async ({page, server}) => {
|
||||
|
@ -251,14 +251,14 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const screenshot = await page.screenshot();
|
||||
expect(screenshot).toMatchImage('screenshot-device-scale-factor.png');
|
||||
expect(screenshot).toMatchSnapshot('screenshot-device-scale-factor.png');
|
||||
await context.close();
|
||||
});
|
||||
|
||||
it('should work with iframe in shadow', async ({page, server}) => {
|
||||
await page.setViewportSize({width: 500, height: 500});
|
||||
await page.goto(server.PREFIX + '/grid-iframe-in-shadow.html');
|
||||
expect(await page.screenshot()).toMatchImage('screenshot-iframe.png');
|
||||
expect(await page.screenshot()).toMatchSnapshot('screenshot-iframe.png');
|
||||
});
|
||||
|
||||
it('path option should work', async ({page, server, testInfo}) => {
|
||||
|
@ -266,7 +266,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const outputPath = testInfo.outputPath('screenshot.png');
|
||||
await page.screenshot({path: outputPath});
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchImage('screenshot-sanity.png');
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchSnapshot('screenshot-sanity.png');
|
||||
});
|
||||
|
||||
it('path option should create subdirectories', async ({page, server, testInfo}) => {
|
||||
|
@ -274,7 +274,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const outputPath = testInfo.outputPath(path.join('these', 'are', 'directories', 'screenshot.png'));
|
||||
await page.screenshot({path: outputPath});
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchImage('screenshot-sanity.png');
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchSnapshot('screenshot-sanity.png');
|
||||
});
|
||||
|
||||
it('path option should detect jpeg', async ({page, server, testInfo}) => {
|
||||
|
@ -282,8 +282,8 @@ describe('page screenshot', (suite, { browserName, headful }) => {
|
|||
await page.goto(server.EMPTY_PAGE);
|
||||
const outputPath = testInfo.outputPath('screenshot.jpg');
|
||||
const screenshot = await page.screenshot({omitBackground: true, path: outputPath});
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchImage('white.jpg');
|
||||
expect(screenshot).toMatchImage('white.jpg');
|
||||
expect(await fs.promises.readFile(outputPath)).toMatchSnapshot('white.jpg');
|
||||
expect(screenshot).toMatchSnapshot('white.jpg');
|
||||
});
|
||||
|
||||
it('path option should throw for unsupported mime type', async ({page}) => {
|
||||
|
|
|
@ -67,7 +67,7 @@ it('should allow mocking binary responses', (test, { browserName, headful }) =>
|
|||
return new Promise(fulfill => img.onload = fulfill);
|
||||
}, server.PREFIX);
|
||||
const img = await page.$('img');
|
||||
expect(await img.screenshot()).toMatchImage('mock-binary-response.png');
|
||||
expect(await img.screenshot()).toMatchSnapshot('mock-binary-response.png');
|
||||
});
|
||||
|
||||
it('should allow mocking svg with charset', (test, { browserName, headful }) => {
|
||||
|
@ -87,7 +87,7 @@ it('should allow mocking svg with charset', (test, { browserName, headful }) =>
|
|||
return new Promise((f, r) => { img.onload = f; img.onerror = r; });
|
||||
}, server.PREFIX);
|
||||
const img = await page.$('img');
|
||||
expect(await img.screenshot()).toMatchImage('mock-svg.png');
|
||||
expect(await img.screenshot()).toMatchSnapshot('mock-svg.png');
|
||||
});
|
||||
|
||||
it('should work with file path', async ({page, server}) => {
|
||||
|
@ -99,7 +99,7 @@ it('should work with file path', async ({page, server}) => {
|
|||
return new Promise(fulfill => img.onload = fulfill);
|
||||
}, server.PREFIX);
|
||||
const img = await page.$('img');
|
||||
expect(await img.screenshot()).toMatchImage('mock-binary-response.png');
|
||||
expect(await img.screenshot()).toMatchSnapshot('mock-binary-response.png');
|
||||
});
|
||||
|
||||
it('should stringify intercepted request response headers', async ({page, server}) => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче