chore: create-playwright config nits & test-runner intro docs (#10253)

This commit is contained in:
Max Schmitt 2021-11-11 22:45:07 +01:00 committed by GitHub
parent ff0da94d6a
commit 24cfcf867e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View file

@ -81,7 +81,8 @@ const { devices } = require('@playwright/test');
/** @type {import('@playwright/test').PlaywrightTestConfig} */ /** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = { const config = {
retries: 2, forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
use: { use: {
trace: 'on-first-retry', trace: 'on-first-retry',
}, },
@ -109,7 +110,8 @@ module.exports = config;
import { PlaywrightTestConfig, devices } from '@playwright/test'; import { PlaywrightTestConfig, devices } from '@playwright/test';
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
retries: 2, forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
use: { use: {
trace: 'on-first-retry', trace: 'on-first-retry',
}, },

View file

@ -8,8 +8,9 @@ const path = require('path');
*/ */
const config = { const config = {
testDir: path.join(__dirname, '{{testDir}}'), /* Test directory */ testDir: path.join(__dirname, '{{testDir}}'), /* Test directory */
forbidOnly: !!process.env.CI, /* Whether to exit with an error if any tests or groups are marked as test.only() or test.describe.only(). Useful on CI. */
retries: process.env.CI ? 2 : 0, /* If a test fails on CI, retry it additional 2 times */
// timeout: 30 * 1000, /* Timeout per test */ // timeout: 30 * 1000, /* Timeout per test */
// retries: process.env.CI ? 2 : 0, /* If a test fails on CI, retry it additional 2 times */
// outputDir: 'test-results/', /* Artifacts folder where screenshots, videos, and traces are stored. */ // outputDir: 'test-results/', /* Artifacts folder where screenshots, videos, and traces are stored. */
// webServer: { /* Run your local dev server before starting the tests: */ // webServer: { /* Run your local dev server before starting the tests: */
@ -19,9 +20,9 @@ const config = {
use: { use: {
trace: 'on-first-retry', /* Retry a test if its failing with enabled tracing. This allows you to analyse the DOM, console logs, network traffic etc. */ trace: 'on-first-retry', /* Retry a test if its failing with enabled tracing. This allows you to analyse the DOM, console logs, network traffic etc. */
contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */ // contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */
ignoreHTTPSErrors: true, // ignoreHTTPSErrors: true,
}, // },
}, },
projects: [ projects: [

View file

@ -4,8 +4,9 @@ import path from 'path';
// Reference: https://playwright.dev/docs/test-configuration // Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
testDir: path.join(__dirname, '{{testDir}}'), /* Test directory */ testDir: path.join(__dirname, '{{testDir}}'), /* Test directory */
forbidOnly: !!process.env.CI, /* Whether to exit with an error if any tests or groups are marked as test.only() or test.describe.only(). Useful on CI. */
retries: process.env.CI ? 2 : 0, /* If a test fails on CI, retry it additional 2 times */
// timeout: 30 * 1000, /* Timeout per test */ // timeout: 30 * 1000, /* Timeout per test */
// retries: process.env.CI ? 2 : 0, /* If a test fails on CI, retry it additional 2 times */
// outputDir: 'test-results/', /* Artifacts folder where screenshots, videos, and traces are stored. */ // outputDir: 'test-results/', /* Artifacts folder where screenshots, videos, and traces are stored. */
// webServer: { /* Run your local dev server before starting the tests: */ // webServer: { /* Run your local dev server before starting the tests: */
@ -15,9 +16,9 @@ const config: PlaywrightTestConfig = {
use: { use: {
trace: 'on-first-retry', /* Retry a test if its failing with enabled tracing (analyse the DOM, console logs, network traffic): https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', /* Retry a test if its failing with enabled tracing (analyse the DOM, console logs, network traffic): https://playwright.dev/docs/trace-viewer */
contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */ // contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */
ignoreHTTPSErrors: true, // ignoreHTTPSErrors: true,
}, // },
}, },
projects: [ projects: [