docs: change port to url (#22029)

This commit is contained in:
Debbie O'Brien 2023-03-30 15:18:59 +02:00 committed by GitHub
parent 896a03e776
commit 2c9d65b5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 17 deletions

View File

@ -509,13 +509,13 @@ export default defineConfig({
webServer: [ webServer: [
{ {
command: 'npm run start', command: 'npm run start',
port: 3000, url: 'http://127.0.0.1:3000',
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },
{ {
command: 'npm run backend', command: 'npm run backend',
port: 3333, url: 'http://127.0.0.1:3333',
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
} }
@ -729,7 +729,7 @@ Read more about [component testing with Playwright](./test-components).
### ⚠️ Breaking Changes ⚠️ ### ⚠️ Breaking Changes ⚠️
WebServer is now considered "ready" if request to the specified port has any of the following HTTP status codes: WebServer is now considered "ready" if request to the specified url has any of the following HTTP status codes:
* `200-299` * `200-299`
* `300-399` (new) * `300-399` (new)
@ -1524,7 +1524,7 @@ Step information is exposed in reporters API.
#### 🌎 Launch web server before running tests #### 🌎 Launch web server before running tests
To launch a server during the tests, use the [`webServer`](./test-advanced#launching-a-development-web-server-during-the-tests) option in the configuration file. The server will wait for a given port to be available before running the tests, and the port will be passed over to Playwright as a [`baseURL`](./api/class-fixtures#fixtures-base-url) when creating a context. To launch a server during the tests, use the [`webServer`](./test-advanced#launching-a-development-web-server-during-the-tests) option in the configuration file. The server will wait for a given url to be available before running the tests, and the url will be passed over to Playwright as a [`baseURL`](./api/class-fixtures#fixtures-base-url) when creating a context.
```ts ```ts
// playwright.config.ts // playwright.config.ts
@ -1532,7 +1532,7 @@ import { defineConfig } from '@playwright/test';
export default defineConfig({ export default defineConfig({
webServer: { webServer: {
command: 'npm run start', // command to launch command: 'npm run start', // command to launch
port: 3000, // port to await for url: 'http://127.0.0.1:3000', // url to await for
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },

View File

@ -624,7 +624,7 @@ import { defineConfig } from '@playwright/test';
export default defineConfig({ export default defineConfig({
webServer: { webServer: {
command: 'npm run start', command: 'npm run start',
port: 3000, url: 'http://127.0.0.1:3000',
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },
@ -655,19 +655,19 @@ export default defineConfig({
webServer: [ webServer: [
{ {
command: 'npm run start', command: 'npm run start',
port: 3000, url: 'http://127.0.0.1:3000',
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },
{ {
command: 'npm run backend', command: 'npm run backend',
port: 3333, url: 'http://127.0.0.1:3333',
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
} }
], ],
use: { use: {
baseURL: 'http://localhost:3000/', baseURL: 'http://127.0.0.1:3000',
}, },
}); });
``` ```

View File

@ -470,7 +470,7 @@ interface TestConfig {
* export default defineConfig({ * export default defineConfig({
* webServer: { * webServer: {
* command: 'npm run start', * command: 'npm run start',
* port: 3000, * url: 'http://127.0.0.1:3000',
* timeout: 120 * 1000, * timeout: 120 * 1000,
* reuseExistingServer: !process.env.CI, * reuseExistingServer: !process.env.CI,
* }, * },
@ -501,19 +501,19 @@ interface TestConfig {
* webServer: [ * webServer: [
* { * {
* command: 'npm run start', * command: 'npm run start',
* port: 3000, * url: 'http://127.0.0.1:3000',
* timeout: 120 * 1000, * timeout: 120 * 1000,
* reuseExistingServer: !process.env.CI, * reuseExistingServer: !process.env.CI,
* }, * },
* { * {
* command: 'npm run backend', * command: 'npm run backend',
* port: 3333, * url: 'http://127.0.0.1:3333',
* timeout: 120 * 1000, * timeout: 120 * 1000,
* reuseExistingServer: !process.env.CI, * reuseExistingServer: !process.env.CI,
* } * }
* ], * ],
* use: { * use: {
* baseURL: 'http://localhost:3000/', * baseURL: 'http://127.0.0.1:3000',
* }, * },
* }); * });
* ``` * ```
@ -1728,7 +1728,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
* export default defineConfig({ * export default defineConfig({
* webServer: { * webServer: {
* command: 'npm run start', * command: 'npm run start',
* port: 3000, * url: 'http://127.0.0.1:3000',
* timeout: 120 * 1000, * timeout: 120 * 1000,
* reuseExistingServer: !process.env.CI, * reuseExistingServer: !process.env.CI,
* }, * },
@ -1759,19 +1759,19 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
* webServer: [ * webServer: [
* { * {
* command: 'npm run start', * command: 'npm run start',
* port: 3000, * url: 'http://127.0.0.1:3000',
* timeout: 120 * 1000, * timeout: 120 * 1000,
* reuseExistingServer: !process.env.CI, * reuseExistingServer: !process.env.CI,
* }, * },
* { * {
* command: 'npm run backend', * command: 'npm run backend',
* port: 3333, * url: 'http://127.0.0.1:3333',
* timeout: 120 * 1000, * timeout: 120 * 1000,
* reuseExistingServer: !process.env.CI, * reuseExistingServer: !process.env.CI,
* } * }
* ], * ],
* use: { * use: {
* baseURL: 'http://localhost:3000/', * baseURL: 'http://127.0.0.1:3000',
* }, * },
* }); * });
* ``` * ```