From 112a18e0836ef2901bf54314af054472cae84179 Mon Sep 17 00:00:00 2001 From: Ross Wollman Date: Wed, 15 Jun 2022 09:00:29 -0700 Subject: [PATCH] docs: document new webServer "ready" status codes (#14885) Sync docs with implementation introduced via https://github.com/microsoft/playwright/commit/30f3d526ebd87bfdb328d71b82bd83876f855b78 --- docs/src/test-advanced-js.md | 2 +- docs/src/test-api/class-testconfig.md | 2 +- packages/playwright-test/types/test.d.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/test-advanced-js.md b/docs/src/test-advanced-js.md index b34110a70e..0768460900 100644 --- a/docs/src/test-advanced-js.md +++ b/docs/src/test-advanced-js.md @@ -140,7 +140,7 @@ export const test = base.extend<{ saveLogs: void }>({ To launch a server during the tests, use the `webServer` option in the [configuration file](#configuration-object). If `port` is specified in the config, test runner will wait for `127.0.0.1:port` or `::1:port` to be available before running the tests. -If `url` is specified in the config, test runner will wait for that `url` to return 2xx response before running the tests. +If `url` is specified in the config, test runner will wait for that `url` to return a 2xx, 3xx, 400, 401, 402, or 403 response before running the tests. For continuous integration, you may want to use the `reuseExistingServer: !process.env.CI` option which does not use an existing server on the CI. To see the stdout, you can set the `DEBUG=pw:webserver` environment variable. diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index c4f633018b..6edf3a9a22 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -619,7 +619,7 @@ export default config; - type: ?<[Object]> - `command` <[string]> Shell command to start. For example `npm run start`.. - `port` ?<[int]> The port that your http server is expected to appear on. It does wait until it accepts connections. Exactly one of `port` or `url` is required. - - `url` ?<[string]> The url on your http server that is expected to return a 2xx status code when the server is ready to accept connections. Exactly one of `port` or `url` is required. + - `url` ?<[string]> 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. Exactly one of `port` or `url` is required. - `ignoreHTTPSErrors` ?<[boolean]> Whether to ignore HTTPS errors when fetching the `url`. Defaults to `false`. - `timeout` ?<[int]> How long to wait for the process to start up and be available in milliseconds. Defaults to 60000. - `reuseExistingServer` ?<[boolean]> 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. diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts index 8546b3b7a3..69f57e71a9 100644 --- a/packages/playwright-test/types/test.d.ts +++ b/packages/playwright-test/types/test.d.ts @@ -4332,8 +4332,8 @@ interface TestConfigWebServer { port?: number; /** - * The url on your http server that is expected to return a 2xx status code when the server is ready to accept connections. - * Exactly one of `port` or `url` is required. + * 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. Exactly one of `port` or `url` is required. */ url?: string;