Skip to content

Commit af29991

Browse files
feat(roll): roll to ToT Playwright (09-07-25) (#1796)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
1 parent 5a36b84 commit af29991

File tree

10 files changed

+36
-49
lines changed

10 files changed

+36
-49
lines changed

dotnet/docs/api/class-consolemessage.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ ConsoleMessage.Type
115115
```
116116

117117
**Returns**
118-
- `enum ConsoleMessageType { Log, Debug, Info, Error, Warning, Dir, Dirxml, Table, Trace, Clear, StartGroup, StartGroupCollapsed, EndGroup, Assert, Profile, ProfileEnd, Count, TimeEnd }`<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>
118+
- [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>
119119

120120

121121
[Accessibility]: /api/class-accessibility.mdx "Accessibility"

java/docs/api/class-consolemessage.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ ConsoleMessage.type();
116116
```
117117

118118
**Returns**
119-
- `enum ConsoleMessageType { LOG, DEBUG, INFO, ERROR, WARNING, DIR, DIRXML, TABLE, TRACE, CLEAR, STARTGROUP, STARTGROUPCOLLAPSED, ENDGROUP, ASSERT, PROFILE, PROFILEEND, COUNT, TIMEEND }`<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>
119+
- [String]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>
120120

121121

122122
[APIRequest]: /api/class-apirequest.mdx "APIRequest"

nodejs/docs/api/class-browsercontext.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,9 +899,6 @@ await browserContext.storageState(options);
899899
- `sameSite` "Strict" | "Lax" | "None"
900900

901901

902-
- `partitionKey` [string] *(optional)*
903-
904-
905902

906903
- `origins` [Array]&lt;[Object]&gt;
907904
- `origin` [string]

nodejs/docs/api/class-consolemessage.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ consoleMessage.text();
115115

116116
<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>consoleMessage.type</x-search>
117117

118-
One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.
119-
120118
**Usage**
121119

122120
```js

nodejs/docs/chrome-extensions.mdx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import HTMLCard from '@site/src/components/HTMLCard';
1313
Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality.
1414
:::
1515

16-
The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`.
16+
The snippet below retrieves the [service worker](https://developer.chrome.com/docs/extensions/develop/concepts/service-workers) of a [Manifest v3](https://developer.chrome.com/docs/extensions/develop/migrate) extension whose source is located in `./my-extension`.
1717

1818
Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode.
1919

@@ -30,11 +30,11 @@ const { chromium } = require('playwright');
3030
`--load-extension=${pathToExtension}`
3131
]
3232
});
33-
let [backgroundPage] = browserContext.backgroundPages();
34-
if (!backgroundPage)
35-
backgroundPage = await browserContext.waitForEvent('backgroundpage');
33+
let [serviceWorker] = browserContext.serviceWorkers();
34+
if (!serviceWorker)
35+
serviceWorker = await browserContext.waitForEvent('serviceworker');
3636

37-
// Test the background page as you would any other page.
37+
// Test the service worker as you would any other worker.
3838
await browserContext.close();
3939
})();
4040
```
@@ -68,19 +68,12 @@ export const test = base.extend<{
6868
await context.close();
6969
},
7070
extensionId: async ({ context }, use) => {
71-
/*
72-
// for manifest v2:
73-
let [background] = context.backgroundPages()
74-
if (!background)
75-
background = await context.waitForEvent('backgroundpage')
76-
*/
77-
7871
// for manifest v3:
79-
let [background] = context.serviceWorkers();
80-
if (!background)
81-
background = await context.waitForEvent('serviceworker');
72+
let [serviceWorker] = context.serviceWorkers();
73+
if (!serviceWorker)
74+
serviceWorker = await context.waitForEvent('serviceworker');
8275

83-
const extensionId = background.url().split('/')[2];
76+
const extensionId = serviceWorker.url().split('/')[2];
8477
await use(extensionId);
8578
},
8679
});

nodejs/docs/intro.mdx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ Playwright Test was created specifically to accommodate the needs of end-to-end
1818

1919
## Installing Playwright
2020

21-
Get started by installing Playwright using npm, yarn or pnpm. Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.mdx).
21+
Get started by installing Playwright using one of the following methods.
22+
23+
### Using npm, yarn or pnpm
24+
25+
The command below either initializes a new project with Playwright, or adds Playwright setup to your current project.
2226

2327
<Tabs groupId="js-package-manager" defaultValue="npm" values={[ {label: 'npm', value: 'npm'}, {label: 'yarn', value: 'yarn'}, {label: 'pnpm', value: 'pnpm'} ] }>
2428

@@ -50,10 +54,14 @@ pnpm create playwright
5054

5155
Run the install command and select the following to get started:
5256
- Choose between TypeScript or JavaScript (default is TypeScript)
53-
- Name of your Tests folder (default is tests or e2e if you already have a tests folder in your project)
57+
- Name of your Tests folder (default is `tests`, or `e2e` if you already have a `tests` folder in your project)
5458
- Add a GitHub Actions workflow to easily run tests on CI
5559
- Install Playwright browsers (default is true)
5660

61+
### Using the VS Code Extension
62+
63+
Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.mdx).
64+
5765
## What's Installed
5866

5967
Playwright will download the browsers needed as well as create the following files.
@@ -245,7 +253,7 @@ pnpm exec playwright --version
245253
</Tabs>
246254

247255
## System requirements
248-
- Latest version of Node.js 18, 20 or 22.
256+
- Latest version of Node.js 20, 22 or 24.
249257
- Windows 10+, Windows Server 2016+ or Windows Subsystem for Linux (WSL).
250258
- macOS 14 Ventura, or later.
251259
- Debian 12, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.

nodejs/docs/test-reporters.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ HTML report supports the following configuration options and environment variabl
252252
| `PLAYWRIGHT_HTML_HOST` | `host` | When report opens in the browser, it will be served bound to this hostname. | `localhost`
253253
| `PLAYWRIGHT_HTML_PORT` | `port` | When report opens in the browser, it will be served on this port. | `9323` or any available port when `9323` is not available.
254254
| `PLAYWRIGHT_HTML_ATTACHMENTS_BASE_URL` | `attachmentsBaseURL` | A separate location where attachments from the `data` subdirectory are uploaded. Only needed when you upload report and `data` separately to different locations. | `data/`
255+
| `PLAYWRIGHT_HTML_NO_SNIPPETS` | `noSnippets` | If true, disable rendering code snippets in the action log. If there is a top level error, that report section with code snippet will still render. Supports `true`, `1`, `false`, and `0`. | `false`
255256

256257
### Blob reporter
257258

python/docs/api/class-browsercontext.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,9 +1227,6 @@ browser_context.storage_state(**kwargs)
12271227
- `sameSite` "Strict" | "Lax" | "None"
12281228

12291229

1230-
- `partitionKey` [str] *(optional)*
1231-
1232-
12331230

12341231
- `origins` [List]\[[Dict]\]
12351232
- `origin` [str]

python/docs/api/class-consolemessage.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ console_message.text
145145

146146
<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>consoleMessage.type</x-search>
147147

148-
One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.
149-
150148
**Usage**
151149

152150
```python

python/docs/chrome-extensions.mdx

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import HTMLCard from '@site/src/components/HTMLCard';
1313
Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality.
1414
:::
1515

16-
The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`.
16+
The snippet below retrieves the [service worker](https://developer.chrome.com/docs/extensions/develop/concepts/service-workers) of a [Manifest v3](https://developer.chrome.com/docs/extensions/develop/migrate) extension whose source is located in `./my-extension`.
1717

1818
Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode.
1919

@@ -43,12 +43,12 @@ def run(playwright: Playwright):
4343
f"--load-extension={path_to_extension}",
4444
],
4545
)
46-
if len(context.background_pages) == 0:
47-
background_page = context.wait_for_event('backgroundpage')
46+
if len(context.service_workers) == 0:
47+
service_worker = context.wait_for_event('serviceworker')
4848
else:
49-
background_page = context.background_pages[0]
49+
service_worker = context.service_workers[0]
5050

51-
# Test the background page as you would any other page.
51+
# Test the service worker as you would any other worker.
5252
context.close()
5353

5454

@@ -77,12 +77,12 @@ async def run(playwright: Playwright):
7777
],
7878
)
7979

80-
if len(context.background_pages) == 0:
81-
background_page = await context.wait_for_event('backgroundpage')
80+
if len(context.service_workers) == 0:
81+
service_worker = await context.wait_for_event('serviceworker')
8282
else:
83-
background_page = context.background_pages[0]
83+
service_worker = context.service_workers[0]
8484

85-
# Test the background page as you would any other page.
85+
# Test the service worker as you would any other worker.
8686
await context.close()
8787

8888

@@ -129,17 +129,12 @@ def context(playwright: Playwright) -> Generator[BrowserContext, None, None]:
129129

130130
@pytest.fixture()
131131
def extension_id(context) -> Generator[str, None, None]:
132-
# for manifest v2:
133-
# background = context.background_pages[0]
134-
# if not background:
135-
# background = context.wait_for_event("backgroundpage")
136-
137132
# for manifest v3:
138-
background = context.service_workers[0]
139-
if not background:
140-
background = context.wait_for_event("serviceworker")
133+
service_worker = context.service_workers[0]
134+
if not service_worker:
135+
service_worker = context.wait_for_event("serviceworker")
141136

142-
extension_id = background.url.split("/")[2]
137+
extension_id = service_worker.url.split("/")[2]
143138
yield extension_id
144139

145140
```

0 commit comments

Comments
 (0)