mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
parent
732ee1502c
commit
71bcfac28a
@ -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(`
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; }
|
||||
div {
|
||||
width: 200px;
|
||||
height: 250px;
|
||||
}
|
||||
</style>
|
||||
<div style="background: red"></div>
|
||||
<div style="background: green"></div>
|
||||
<div style="background: red"></div>
|
||||
<div style="background: green"></div>
|
||||
<div style="background: red"></div>
|
||||
<div style="background: green"></div>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
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();
|
||||
|
@ -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,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user