|
18 | 18 | /** |
19 | 19 | * @type {PageTestSuite} |
20 | 20 | */ |
21 | | -module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM, WEBKIT}) { |
| 21 | +module.exports.describe = function({testRunner, expect, product, playwright, FFOX, CHROMIUM, WEBKIT, LINUX }) { |
22 | 22 | const {describe, xdescribe, fdescribe} = testRunner; |
23 | 23 | const {it, fit, xit, dit} = testRunner; |
24 | 24 | const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; |
@@ -217,6 +217,14 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM, |
217 | 217 | expect(screenshot).toBeInstanceOf(Buffer); |
218 | 218 | } |
219 | 219 | }); |
| 220 | + it.fail(WEBKIT)('should work with device scale factor', async({browser, server}) => { |
| 221 | + const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 }); |
| 222 | + const page = await context.newPage(); |
| 223 | + await page.goto(server.PREFIX + '/grid.html'); |
| 224 | + const screenshot = await page.screenshot(); |
| 225 | + expect(screenshot).toBeGolden('screenshot-device-scale-factor.png'); |
| 226 | + await context.close(); |
| 227 | + }); |
220 | 228 | }); |
221 | 229 |
|
222 | 230 | describe('ElementHandle.screenshot', function() { |
@@ -386,6 +394,16 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM, |
386 | 394 | expect(screenshot).toBeGolden('screenshot-element-mobile.png'); |
387 | 395 | await context.close(); |
388 | 396 | }); |
| 397 | + it.fail(WEBKIT && LINUX).skip(FFOX)('should work with device scale factor', async({browser, server}) => { |
| 398 | + const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 }); |
| 399 | + const page = await context.newPage(); |
| 400 | + await page.goto(server.PREFIX + '/grid.html'); |
| 401 | + await page.evaluate(() => window.scrollBy(50, 100)); |
| 402 | + const elementHandle = await page.$('.box:nth-of-type(3)'); |
| 403 | + const screenshot = await elementHandle.screenshot(); |
| 404 | + expect(screenshot).toBeGolden('screenshot-element-mobile-dsf.png'); |
| 405 | + await context.close(); |
| 406 | + }); |
389 | 407 | it('should work for an element with an offset', async({page}) => { |
390 | 408 | await page.setContent('<div style="position:absolute; top: 10.3px; left: 20.4px;width:50.3px;height:20.2px;border:1px solid black;"></div>'); |
391 | 409 | const elementHandle = await page.$('div'); |
|
0 commit comments