Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Max Schmitt24cfcf867ec1
diff --git a/docs/src/intro-js.md b/docs/src/intro-js.md
index d819210978..726c0bcc9f 100644
--- a/docs/src/intro-js.md
+++ b/docs/src/intro-js.md
@@ -81,7 +81,8 @@ const { devices } = require('@playwright/test');
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
- retries: 2,
+ forbidOnly: !!process.env.CI,
+ retries: process.env.CI ? 2 : 0,
use: {
trace: 'on-first-retry',
},
@@ -109,7 +110,8 @@ module.exports = config;
import { PlaywrightTestConfig, devices } from '@playwright/test';
const config: PlaywrightTestConfig = {
- retries: 2,
+ forbidOnly: !!process.env.CI,
+ retries: process.env.CI ? 2 : 0,
use: {
trace: 'on-first-retry',
},
diff --git a/packages/create-playwright/assets/playwright.config.js b/packages/create-playwright/assets/playwright.config.js
index 3ba2ebcac0..0f1cbbb5d5 100644
--- a/packages/create-playwright/assets/playwright.config.js
+++ b/packages/create-playwright/assets/playwright.config.js
@@ -8,8 +8,9 @@ const path = require('path');
*/
const config = {
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 */
- // 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. */
// webServer: { /* Run your local dev server before starting the tests: */
@@ -19,9 +20,9 @@ const config = {
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. */
- contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */
- ignoreHTTPSErrors: true,
- },
+ // contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */
+ // ignoreHTTPSErrors: true,
+ // },
},
projects: [
diff --git a/packages/create-playwright/assets/playwright.config.ts b/packages/create-playwright/assets/playwright.config.ts
index 46bd949152..8f13537f27 100644
--- a/packages/create-playwright/assets/playwright.config.ts
+++ b/packages/create-playwright/assets/playwright.config.ts
@@ -4,8 +4,9 @@ import path from 'path';
// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
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 */
- // 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. */
// webServer: { /* Run your local dev server before starting the tests: */
@@ -15,9 +16,9 @@ const config: PlaywrightTestConfig = {
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 */
- contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */
- ignoreHTTPSErrors: true,
- },
+ // contextOptions: { /* All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context */
+ // ignoreHTTPSErrors: true,
+ // },
},
projects: [