docs: use desktop devices in sample configs (#10197)

This commit is contained in:
Dmitry Gozman 2021-11-09 13:19:21 -08:00 committed by GitHub
parent 031ceb3553
commit 7bb38d2ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 14 deletions

View file

@ -77,6 +77,7 @@ Here is an example configuration that runs every test in Chromium, Firefox and W
```js js-flavor=js
// playwright.config.js
// @ts-check
const { devices } = require('@playwright/test');
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
@ -87,15 +88,15 @@ const config = {
projects: [
{
name: 'chromium',
use: { browserName: 'chromium' },
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { browserName: 'firefox' },
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { browserName: 'webkit' },
use: { ...devices['Desktop Safari'] },
},
],
};
@ -105,7 +106,7 @@ module.exports = config;
```js js-flavor=ts
// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';
import { PlaywrightTestConfig, devices } from '@playwright/test';
const config: PlaywrightTestConfig = {
retries: 2,
@ -115,15 +116,15 @@ const config: PlaywrightTestConfig = {
projects: [
{
name: 'chromium',
use: { browserName: 'chromium' },
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { browserName: 'firefox' },
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { browserName: 'webkit' },
use: { ...devices['Desktop Safari'] },
},
],
};

View file

@ -163,21 +163,22 @@ Playwright Test supports multiple "projects" that can run your tests in multiple
```js js-flavor=js
// playwright.config.js
// @ts-check
const { devices } = require('@playwright/test');
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
projects: [
{
name: 'chromium',
use: { browserName: 'chromium' },
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { browserName: 'firefox' }
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { browserName: 'webkit' }
use: { ...devices['Desktop Safari'] },
},
],
};
@ -187,21 +188,21 @@ module.exports = config;
```js js-flavor=ts
// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';
import { PlaywrightTestConfig, devices } from '@playwright/test';
const config: PlaywrightTestConfig = {
projects: [
{
name: 'chromium',
use: { browserName: 'chromium' },
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { browserName: 'firefox' },
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { browserName: 'webkit' },
use: { ...devices['Desktop Safari'] },
},
],
};