mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs: change port to url (#22029)
This commit is contained in:
parent
896a03e776
commit
2c9d65b5ed
@ -509,13 +509,13 @@ export default defineConfig({
|
||||
webServer: [
|
||||
{
|
||||
command: 'npm run start',
|
||||
port: 3000,
|
||||
url: 'http://127.0.0.1:3000',
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
{
|
||||
command: 'npm run backend',
|
||||
port: 3333,
|
||||
url: 'http://127.0.0.1:3333',
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
}
|
||||
@ -729,7 +729,7 @@ Read more about [component testing with Playwright](./test-components).
|
||||
|
||||
### ⚠️ 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`
|
||||
* `300-399` (new)
|
||||
@ -1524,7 +1524,7 @@ Step information is exposed in reporters API.
|
||||
|
||||
#### 🌎 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
|
||||
// playwright.config.ts
|
||||
@ -1532,7 +1532,7 @@ import { defineConfig } from '@playwright/test';
|
||||
export default defineConfig({
|
||||
webServer: {
|
||||
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,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
|
@ -624,7 +624,7 @@ import { defineConfig } from '@playwright/test';
|
||||
export default defineConfig({
|
||||
webServer: {
|
||||
command: 'npm run start',
|
||||
port: 3000,
|
||||
url: 'http://127.0.0.1:3000',
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
@ -655,19 +655,19 @@ export default defineConfig({
|
||||
webServer: [
|
||||
{
|
||||
command: 'npm run start',
|
||||
port: 3000,
|
||||
url: 'http://127.0.0.1:3000',
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
{
|
||||
command: 'npm run backend',
|
||||
port: 3333,
|
||||
url: 'http://127.0.0.1:3333',
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
}
|
||||
],
|
||||
use: {
|
||||
baseURL: 'http://localhost:3000/',
|
||||
baseURL: 'http://127.0.0.1:3000',
|
||||
},
|
||||
});
|
||||
```
|
||||
|
16
packages/playwright-test/types/test.d.ts
vendored
16
packages/playwright-test/types/test.d.ts
vendored
@ -470,7 +470,7 @@ interface TestConfig {
|
||||
* export default defineConfig({
|
||||
* webServer: {
|
||||
* command: 'npm run start',
|
||||
* port: 3000,
|
||||
* url: 'http://127.0.0.1:3000',
|
||||
* timeout: 120 * 1000,
|
||||
* reuseExistingServer: !process.env.CI,
|
||||
* },
|
||||
@ -501,19 +501,19 @@ interface TestConfig {
|
||||
* webServer: [
|
||||
* {
|
||||
* command: 'npm run start',
|
||||
* port: 3000,
|
||||
* url: 'http://127.0.0.1:3000',
|
||||
* timeout: 120 * 1000,
|
||||
* reuseExistingServer: !process.env.CI,
|
||||
* },
|
||||
* {
|
||||
* command: 'npm run backend',
|
||||
* port: 3333,
|
||||
* url: 'http://127.0.0.1:3333',
|
||||
* timeout: 120 * 1000,
|
||||
* reuseExistingServer: !process.env.CI,
|
||||
* }
|
||||
* ],
|
||||
* use: {
|
||||
* baseURL: 'http://localhost:3000/',
|
||||
* baseURL: 'http://127.0.0.1:3000',
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
@ -1728,7 +1728,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
|
||||
* export default defineConfig({
|
||||
* webServer: {
|
||||
* command: 'npm run start',
|
||||
* port: 3000,
|
||||
* url: 'http://127.0.0.1:3000',
|
||||
* timeout: 120 * 1000,
|
||||
* reuseExistingServer: !process.env.CI,
|
||||
* },
|
||||
@ -1759,19 +1759,19 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
|
||||
* webServer: [
|
||||
* {
|
||||
* command: 'npm run start',
|
||||
* port: 3000,
|
||||
* url: 'http://127.0.0.1:3000',
|
||||
* timeout: 120 * 1000,
|
||||
* reuseExistingServer: !process.env.CI,
|
||||
* },
|
||||
* {
|
||||
* command: 'npm run backend',
|
||||
* port: 3333,
|
||||
* url: 'http://127.0.0.1:3333',
|
||||
* timeout: 120 * 1000,
|
||||
* reuseExistingServer: !process.env.CI,
|
||||
* }
|
||||
* ],
|
||||
* use: {
|
||||
* baseURL: 'http://localhost:3000/',
|
||||
* baseURL: 'http://127.0.0.1:3000',
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
|
Loading…
x
Reference in New Issue
Block a user