Skip to content

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

docs: change port to url (#22029)

Debbie O'Brien2c9d65b5edc7
diff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.md
index 8ee8ddba60..58e998cdcb 100644
--- a/docs/src/release-notes-js.md
+++ b/docs/src/release-notes-js.md
@@ -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,
},
diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md
index 24736de921..c9e885a4e2 100644
--- a/docs/src/test-api/class-testconfig.md
+++ b/docs/src/test-api/class-testconfig.md
@@ -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',
},
});
```
diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts
index b7d851cc08..01e4a1a917 100644
--- a/packages/playwright-test/types/test.d.ts
+++ b/packages/playwright-test/types/test.d.ts
@@ -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',
* },
* });
* ```