mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
af042beb13
This patch introduces the following commands: - `npx playwright docker build` that builds a VRT docker image locally that is based off the `mcr.microsoft.com/playwright:jammy` - `npx playwright docker start` that launches a docker container with browsers. - `npx playwright docker stop` that stops given docker container. - `npx playwright docker test` that runs all the tests inside a launched docker container.
20 lines
725 B
JavaScript
20 lines
725 B
JavaScript
const { test, expect } = require('@playwright/test');
|
|
|
|
test('platform', async ({ page }) => {
|
|
console.log('@' + page.context().browser().browserType().name(), await page.evaluate(() => navigator.platform));
|
|
});
|
|
|
|
test('userAgent', async ({ page }) => {
|
|
console.log('@' + page.context().browser().browserType().name(), await page.evaluate(() => navigator.userAgent));
|
|
});
|
|
|
|
test('screenshot', async ({ page }) => {
|
|
await expect(page).toHaveScreenshot('img.png');
|
|
});
|
|
|
|
test('localhost', async ({ page }) => {
|
|
expect(process.env.TEST_PORT).toBeTruthy();
|
|
await page.goto('http://localhost:' + process.env.TEST_PORT);
|
|
console.log('@' + page.context().browser().browserType().name(), await page.textContent('body'));
|
|
});
|