diff --git a/nodejs/docs/api/class-fullconfig.mdx b/nodejs/docs/api/class-fullconfig.mdx index 39899fdd35f..d3a8978d5b5 100644 --- a/nodejs/docs/api/class-fullconfig.mdx +++ b/nodejs/docs/api/class-fullconfig.mdx @@ -31,6 +31,23 @@ fullConfig.configFile --- +### failOnFlakyTests {#full-config-fail-on-flaky-tests} + +Added in: v1.52fullConfig.failOnFlakyTests + +See [testConfig.failOnFlakyTests](/api/class-testconfig.mdx#test-config-fail-on-flaky-tests). + +**Usage** + +```js +fullConfig.failOnFlakyTests +``` + +**Type** +- [boolean] + +--- + ### forbidOnly {#full-config-forbid-only} Added in: v1.10fullConfig.forbidOnly diff --git a/nodejs/docs/api/class-testconfig.mdx b/nodejs/docs/api/class-testconfig.mdx index d073b7d1438..0a2f60f6469 100644 --- a/nodejs/docs/api/class-testconfig.mdx +++ b/nodejs/docs/api/class-testconfig.mdx @@ -176,6 +176,29 @@ export default defineConfig({ --- +### failOnFlakyTests {#test-config-fail-on-flaky-tests} + +Added in: v1.52testConfig.failOnFlakyTests + +Whether to exit with an error if any tests are marked as flaky. Useful on CI. + +Also available in the [command line](../test-cli.mdx) with the `--fail-on-flaky-tests` option. + +**Usage** + +```js title="playwright.config.ts" +import { defineConfig } from '@playwright/test'; + +export default defineConfig({ + failOnFlakyTests: !!process.env.CI, +}); +``` + +**Type** +- [boolean] + +--- + ### forbidOnly {#test-config-forbid-only} Added in: v1.10testConfig.forbidOnly @@ -1035,38 +1058,38 @@ export default defineConfig({ - `env` [Object]<[string], [string]> *(optional)* Environment variables to set for the command, `process.env` by default. + - `gracefulShutdown` [Object] *(optional)* + - `signal` "SIGINT" | "SIGTERM" + + + - `timeout` [number] + + + How to shut down the process. If unspecified, the process group is forcefully `SIGKILL`ed. If set to `{ signal: 'SIGTERM', timeout: 500 }`, the process group is sent a `SIGTERM` signal, followed by `SIGKILL` if it doesn't exit within 500ms. You can also use `SIGINT` as the signal instead. A `0` timeout means no `SIGKILL` will be sent. Windows doesn't support `SIGTERM` and `SIGINT` signals, so this option is ignored on Windows. Note that shutting down a Docker container requires `SIGTERM`. - `ignoreHTTPSErrors` [boolean] *(optional)* Whether to ignore HTTPS errors when fetching the `url`. Defaults to `false`. + - `name` [string] *(optional)* + + Specifies a custom name for the web server. This name will be prefixed to log messages. Defaults to `[WebServer]`. - `port` [number] *(optional)* The port that your http server is expected to appear on. It does wait until it accepts connections. Either `port` or `url` should be specified. - `reuseExistingServer` [boolean] *(optional)* If true, it will re-use an existing server on the `port` or `url` when available. If no server is running on that `port` or `url`, it will run the command to start a new server. If `false`, it will throw if an existing process is listening on the `port` or `url`. This should be commonly set to `!process.env.CI` to allow the local dev server when running tests locally. - - `stdout` "pipe" | "ignore" *(optional)* - - If `"pipe"`, it will pipe the stdout of the command to the process stdout. If `"ignore"`, it will ignore the stdout of the command. Default to `"ignore"`. - `stderr` "pipe" | "ignore" *(optional)* Whether to pipe the stderr of the command to the process stderr or ignore it. Defaults to `"pipe"`. + - `stdout` "pipe" | "ignore" *(optional)* + + If `"pipe"`, it will pipe the stdout of the command to the process stdout. If `"ignore"`, it will ignore the stdout of the command. Default to `"ignore"`. - `timeout` [number] *(optional)* How long to wait for the process to start up and be available in milliseconds. Defaults to 60000. - - `gracefulShutdown` [Object] *(optional)* - - `signal` "SIGINT" | "SIGTERM" - - - - `timeout` [number] - - - How to shut down the process. If unspecified, the process group is forcefully `SIGKILL`ed. If set to `{ signal: 'SIGTERM', timeout: 500 }`, the process group is sent a `SIGTERM` signal, followed by `SIGKILL` if it doesn't exit within 500ms. You can also use `SIGINT` as the signal instead. A `0` timeout means no `SIGKILL` will be sent. Windows doesn't support `SIGTERM` and `SIGINT` signals, so this option is ignored on Windows. Note that shutting down a Docker container requires `SIGTERM`. - `url` [string] *(optional)* The url on your http server that is expected to return a 2xx, 3xx, 400, 401, 402, or 403 status code when the server is ready to accept connections. Redirects (3xx status codes) are being followed and the new location is checked. Either `port` or `url` should be specified. - - `name` [string] *(optional)* - - Specifies a custom name for the web server. This name will be prefixed to log messages. Defaults to `[WebServer]`. **Details** diff --git a/nodejs/docs/test-webserver.mdx b/nodejs/docs/test-webserver.mdx index 7c6e98b18e1..db68d7d3c82 100644 --- a/nodejs/docs/test-webserver.mdx +++ b/nodejs/docs/test-webserver.mdx @@ -33,15 +33,16 @@ export default defineConfig({ | :- | :- | | [testConfig.webServer](/api/class-testconfig.mdx#test-config-web-server) | Launch a development web server (or multiple) during the tests. | | `command`| Shell command to start the local dev server of your app. | -| `url`| URL of your http server that is expected to return a 2xx, 3xx, 400, 401, 402, or 403 status code when the server is ready to accept connections. | -| `reuseExistingServer`| If `true`, it will re-use an existing server on the url when available. If no server is running on that url, it will run the command to start a new server. If `false`, it will throw if an existing process is listening on the url. To see the stdout, you can set the `DEBUG=pw:webserver` environment variable. | -| `ignoreHTTPSErrors` | Whether to ignore HTTPS errors when fetching the `url`. Defaults to `false`. | | `cwd` | Current working directory of the spawned process, defaults to the directory of the configuration file. | -| `stdout` | If `"pipe"`, it will pipe the stdout of the command to the process stdout. If `"ignore"`, it will ignore the stdout of the command. Default to `"ignore"`. | -| `stderr` | Whether to pipe the stderr of the command to the process stderr or ignore it. Defaults to `"pipe"`. | -| `timeout` | How long to wait for the process to start up and be available in milliseconds. Defaults to 60000. | +| `env` | Environment variables to set for the command, `process.env` by default. | | `gracefulShutdown` | How to shut down the process. If unspecified, the process group is forcefully `SIGKILL`ed. If set to `{ signal: 'SIGTERM', timeout: 500 }`, the process group is sent a `SIGTERM` signal, followed by `SIGKILL` if it doesn't exit within 500ms. You can also use `SIGINT` as the signal instead. A `0` timeout means no `SIGKILL` will be sent. Windows doesn't support `SIGTERM` and `SIGINT` signals, so this option is ignored on Windows. Note that shutting down a Docker container requires `SIGTERM`. | +| `ignoreHTTPSErrors` | Whether to ignore HTTPS errors when fetching the `url`. Defaults to `false`. | | `name` | Specifies a custom name for the web server. This name will be prefixed to log messages. Defaults to `[WebServer]`. | +| `reuseExistingServer`| If `true`, it will re-use an existing server on the url when available. If no server is running on that url, it will run the command to start a new server. If `false`, it will throw if an existing process is listening on the url. To see the stdout, you can set the `DEBUG=pw:webserver` environment variable. | +| `stderr` | Whether to pipe the stderr of the command to the process stderr or ignore it. Defaults to `"pipe"`. | +| `stdout` | If `"pipe"`, it will pipe the stdout of the command to the process stdout. If `"ignore"`, it will ignore the stdout of the command. Default to `"ignore"`. | +| `timeout` | How long to wait for the process to start up and be available in milliseconds. Defaults to 60000. | +| `url`| URL of your http server that is expected to return a 2xx, 3xx, 400, 401, 402, or 403 status code when the server is ready to accept connections. | ## Adding a server timeout