diff --git a/tests/android/browser.spec.ts b/tests/android/browser.spec.ts index 54d4dc57a0..2590ef791b 100644 --- a/tests/android/browser.spec.ts +++ b/tests/android/browser.spec.ts @@ -86,6 +86,44 @@ test('should check', async function({ androidDevice }) { await context.close(); }); +test('should take page screenshot', async function({ androidDevice }) { + test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/26342' }); + test.fixme(true, 'Sometimes fails with Protocol error (Page.captureScreenshot): Unable to capture screenshot'); + test.fixme(true, 'Regular screenshot has an extra pixel border'); + test.fixme(true, 'Full page screenshot has repeated content'); + + const context = await androidDevice.launchBrowser(); + const [page] = context.pages(); + + await page.setContent(` + +
+ + + + + + + + + + + + + `); + const screenshot = await page.screenshot({ fullPage: false, scale: 'css' }); + const fullPageScreenshot = await page.screenshot({ fullPage: true, scale: 'css' }); + expect(screenshot).toMatchSnapshot('page-screenshot.png'); + expect(fullPageScreenshot).toMatchSnapshot('fullpage-screenshot.png'); + await context.close(); +}); + test('should be able to send CDP messages', async ({ androidDevice }) => { const context = await androidDevice.launchBrowser(); const [page] = context.pages(); diff --git a/tests/android/playwright.config.ts b/tests/android/playwright.config.ts index 827115b188..1422f1511d 100644 --- a/tests/android/playwright.config.ts +++ b/tests/android/playwright.config.ts @@ -55,6 +55,7 @@ config.projects.push({ loopback: '10.0.2.2', browserName: 'chromium', }, + snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}', testDir: path.join(testDir, 'android'), metadata, }); @@ -65,6 +66,7 @@ config.projects.push({ loopback: '10.0.2.2', browserName: 'chromium', }, + snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}', testDir: path.join(testDir, 'page'), metadata, });