From b9c923f87c23b4c9a1671868fc87dc6c75efc7ad Mon Sep 17 00:00:00 2001 From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com> Date: Tue, 26 Nov 2024 05:26:35 -0800 Subject: [PATCH 1/8] feat(chromium-tip-of-tree): roll to r1281 (#33769) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- packages/playwright-core/browsers.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index b1cf873f05..123bf8c249 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -15,9 +15,9 @@ }, { "name": "chromium-tip-of-tree", - "revision": "1280", + "revision": "1281", "installByDefault": false, - "browserVersion": "133.0.6850.0" + "browserVersion": "133.0.6860.0" }, { "name": "firefox", From 84df6e3297f3473a2b9862f1a0328a7639f1ee63 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 26 Nov 2024 16:23:19 +0100 Subject: [PATCH 2/8] docs(python): add note about async fixtures (#33760) --- docs/src/test-runners-python.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/src/test-runners-python.md b/docs/src/test-runners-python.md index 0dd4bbeca3..3f93dd6504 100644 --- a/docs/src/test-runners-python.md +++ b/docs/src/test-runners-python.md @@ -259,3 +259,18 @@ def test_bing_is_working(page): ## Deploy to CI See the [guides for CI providers](./ci.md) to deploy your tests to CI/CD. + +## Async Fixtures + +If you want to use async fixtures, you can use the [`pytest-playwright-asyncio`](https://pypi.org/project/pytest-playwright-asyncio/) plugin. +Make sure to use `pytest-asyncio>=0.24.0` and make your tests use of [`loop_scope=sesion`](https://pytest-asyncio.readthedocs.io/en/latest/how-to-guides/run_session_tests_in_same_loop.html). + +```python +import pytest +from playwright.async_api import Page + +@pytest.mark.asyncio(loop_scope="session") +async def test_foo(page: Page): + await page.goto("https://github.com") + # ... +``` From f3ae940684dd26de1d4674d66dd98b8722b08d50 Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Tue, 26 Nov 2024 18:42:36 +0200 Subject: [PATCH 3/8] fix(ct-vue): Upgrade plugin-vue to be compatible with Vite 5 (#33758) --- package-lock.json | 13 +++++++------ packages/playwright-ct-vue/package.json | 2 +- tests/components/ct-vue-vite/package.json | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index c216b1281c..6a8526b8c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2171,14 +2171,15 @@ } }, "node_modules/@vitejs/plugin-vue": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-4.6.2.tgz", - "integrity": "sha512-kqf7SGFoG+80aZG6Pf+gsZIVvGSCKE98JbiWqcCV9cThtg91Jav0yvYFC9Zb+jKetNGF6ZKeoaxgZfND21fWKw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.0.tgz", + "integrity": "sha512-7n7KdUEtx/7Yl7I/WVAMZ1bEb0eVvXF3ummWTeLcs/9gvo9pJhuLdouSXGjdZ/MKD1acf1I272+X0RMua4/R3g==", + "license": "MIT", "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": "^18.0.0 || >=20.0.0" }, "peerDependencies": { - "vite": "^4.0.0 || ^5.0.0", + "vite": "^5.0.0", "vue": "^3.2.25" } }, @@ -7876,7 +7877,7 @@ "license": "Apache-2.0", "dependencies": { "@playwright/experimental-ct-core": "1.50.0-next", - "@vitejs/plugin-vue": "^4.2.1" + "@vitejs/plugin-vue": "^5.2.0" }, "bin": { "playwright": "cli.js" diff --git a/packages/playwright-ct-vue/package.json b/packages/playwright-ct-vue/package.json index 4849ca1ccb..fe48461394 100644 --- a/packages/playwright-ct-vue/package.json +++ b/packages/playwright-ct-vue/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@playwright/experimental-ct-core": "1.50.0-next", - "@vitejs/plugin-vue": "^4.2.1" + "@vitejs/plugin-vue": "^5.2.0" }, "bin": { "playwright": "cli.js" diff --git a/tests/components/ct-vue-vite/package.json b/tests/components/ct-vue-vite/package.json index 6fac022cb5..127be784a3 100644 --- a/tests/components/ct-vue-vite/package.json +++ b/tests/components/ct-vue-vite/package.json @@ -12,7 +12,7 @@ "vue-router": "^4.1.5" }, "devDependencies": { - "@vitejs/plugin-vue": "^4.1.0", + "@vitejs/plugin-vue": "^5.2.0", "@vue/tsconfig": "^0.5.1", "typescript": "5.6.2", "vite": "^5.2.8", From ff6c283af5d96079011acf98c8263820e6f27d74 Mon Sep 17 00:00:00 2001 From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com> Date: Wed, 27 Nov 2024 07:53:22 -0800 Subject: [PATCH 4/8] feat(webkit): roll to r2112 (#33778) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- packages/playwright-core/browsers.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index 123bf8c249..f37e718223 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -33,7 +33,7 @@ }, { "name": "webkit", - "revision": "2111", + "revision": "2112", "installByDefault": true, "revisionOverrides": { "debian11-x64": "2105", From a84488edaaa32702f23eb6d5374598e6d2ed7712 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 28 Nov 2024 11:21:52 +0000 Subject: [PATCH 5/8] fix(aria): escape even more yaml (#33793) --- .../src/server/injected/yaml.ts | 24 +++------ tests/page/page-aria-snapshot.spec.ts | 54 +++++++++++++++++++ 2 files changed, 62 insertions(+), 16 deletions(-) diff --git a/packages/playwright-core/src/server/injected/yaml.ts b/packages/playwright-core/src/server/injected/yaml.ts index e87c6706de..7daebc574a 100644 --- a/packages/playwright-core/src/server/injected/yaml.ts +++ b/packages/playwright-core/src/server/injected/yaml.ts @@ -62,12 +62,8 @@ function yamlStringNeedsQuotes(str: string): boolean { if (/^-\s/.test(str)) return true; - // Strings that start with a special indicator character need quotes - if (/^[&*\],].*/.test(str)) - return true; - - // Strings containing ':' followed by a space or at the end need quotes - if (/:(\s|$)/.test(str)) + // Strings containing ':' or '\n' followed by a space or at the end need quotes + if (/[\n:](\s|$)/.test(str)) return true; // Strings containing '#' preceded by a space need quotes (comment indicator) @@ -78,21 +74,17 @@ function yamlStringNeedsQuotes(str: string): boolean { if (/[\n\r]/.test(str)) return true; - // Strings starting with '?' or '!' (directives) need quotes - if (/^[?!]/.test(str)) - return true; - - // Strings starting with '>' or '|' (block scalar indicators) need quotes - if (/^[>|]/.test(str)) - return true; - - // Strings starting with quotes need quotes - if (/^["']/.test(str)) + // Strings starting with indicator characters or quotes need quotes + if (/^[&*\],?!>|@"'#%]/.test(str)) return true; // Strings containing special characters that could cause ambiguity if (/[{}`]/.test(str)) return true; + // Non-string types recognized by YAML + if (!isNaN(Number(str)) || ['y', 'n', 'yes', 'no', 'true', 'false', 'on', 'off', 'null'].includes(str.toLowerCase())) + return true; + return false; } diff --git a/tests/page/page-aria-snapshot.spec.ts b/tests/page/page-aria-snapshot.spec.ts index 3acf1dbb1a..81e1beadfa 100644 --- a/tests/page/page-aria-snapshot.spec.ts +++ b/tests/page/page-aria-snapshot.spec.ts @@ -508,3 +508,57 @@ it('should handle long strings', async ({ page }) => { - region: ${s} `); }); + +it('should escape special yaml characters', async ({ page }) => { + await page.setContent(` + @hello@hello + ]hello]hello + hello\n + hello\n\n hello\n hello + #hello#hello + `); + + await checkAndMatchSnapshot(page.locator('body'), ` + - link "@hello" + - text: "@hello" + - link "]hello" + - text: "]hello" + - link "hello" + - text: hello + - link "hello" + - text: hello + - link "#hello" + - text: "#hello" + `); +}); + +it('should escape special yaml values', async ({ page }) => { + await page.setContent(` + trueFalse + NOyes + yN + onOff + nullNULL + 123123 + -1.2-1.2 + + `); + + await checkAndMatchSnapshot(page.locator('body'), ` + - link "true" + - text: "False" + - link "NO" + - text: "yes" + - link "y" + - text: "N" + - link "on" + - text: "Off" + - link "null" + - text: "NULL" + - link "123" + - text: "123" + - link "-1.2" + - text: "-1.2" + - textbox: "555" + `); +}); From 4fb6c4ed4ccd30cb211d76981e582de9ebfa11bf Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 28 Nov 2024 14:04:34 +0100 Subject: [PATCH 6/8] fix(trace): in `indexTree` check `isVisible` before adding to result (#33797) --- packages/web/src/components/treeView.tsx | 8 ++++--- tests/playwright-test/ui-mode-trace.spec.ts | 24 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/packages/web/src/components/treeView.tsx b/packages/web/src/components/treeView.tsx index e6cf557e99..242e834ede 100644 --- a/packages/web/src/components/treeView.tsx +++ b/packages/web/src/components/treeView.tsx @@ -319,7 +319,9 @@ function indexTree( selectedItem: T | undefined, expandedItems: Map, autoExpandDepth: number, - isVisible?: (item: T) => boolean): Map { + isVisible: (item: T) => boolean = () => true): Map { + if (!isVisible(rootItem)) + return new Map(); const result = new Map(); const temporaryExpanded = new Set(); @@ -328,9 +330,9 @@ function indexTree( let lastItem: T | null = null; const appendChildren = (parent: T, depth: number) => { - if (isVisible && !isVisible(parent)) - return; for (const item of parent.children as T[]) { + if (!isVisible(item)) + continue; const expandState = temporaryExpanded.has(item.id) || expandedItems.get(item.id); const autoExpandMatches = autoExpandDepth > depth && result.size < 25 && expandState !== false; const expanded = item.children.length ? expandState ?? autoExpandMatches : undefined; diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.ts index eb56204813..16ebeaf499 100644 --- a/tests/playwright-test/ui-mode-trace.spec.ts +++ b/tests/playwright-test/ui-mode-trace.spec.ts @@ -339,3 +339,27 @@ test('should show request source context id', async ({ runUITest, server }) => { await expect(page.getByText('page#2')).toBeVisible(); await expect(page.getByText('api#1')).toBeVisible(); }); + +test('should filter actions tab on double-click', async ({ runUITest, server }) => { + const { page } = await runUITest({ + 'a.spec.ts': ` + import { test, expect } from '@playwright/test'; + test('pass', async ({ page }) => { + await page.goto('${server.EMPTY_PAGE}'); + }); + `, + }); + + await page.getByText('pass').dblclick(); + + const actionsTree = page.getByTestId('actions-tree'); + await expect(actionsTree.getByRole('treeitem')).toHaveText([ + /Before Hooks/, + /page.goto/, + /After Hooks/, + ]); + await actionsTree.getByRole('treeitem', { name: 'page.goto' }).dblclick(); + await expect(actionsTree.getByRole('treeitem')).toHaveText([ + /page.goto/, + ]); +}); From fd25f3ab8540a644da56cc011c7e7202e21fd045 Mon Sep 17 00:00:00 2001 From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com> Date: Thu, 28 Nov 2024 05:43:45 -0800 Subject: [PATCH 7/8] feat(chromium-tip-of-tree): roll to r1282 (#33798) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- packages/playwright-core/browsers.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index f37e718223..3dba3152a7 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -15,9 +15,9 @@ }, { "name": "chromium-tip-of-tree", - "revision": "1281", + "revision": "1282", "installByDefault": false, - "browserVersion": "133.0.6860.0" + "browserVersion": "133.0.6864.0" }, { "name": "firefox", From b5bd543cc6935f62732da3b6183bd319eb2bdc2a Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 28 Nov 2024 14:36:49 +0000 Subject: [PATCH 8/8] test: skip 'should not auto play audio' with frozen time (#33799) --- tests/library/capabilities.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/library/capabilities.spec.ts b/tests/library/capabilities.spec.ts index 7526359c20..03ff1d7feb 100644 --- a/tests/library/capabilities.spec.ts +++ b/tests/library/capabilities.spec.ts @@ -436,6 +436,7 @@ it('should not auto play audio', { } }, async ({ page, browserName, isWindows }) => { it.fixme(browserName === 'webkit' && isWindows); + it.skip(process.env.PW_CLOCK === 'frozen', 'no way to inject real setTimeout'); await page.route('**/*', async route => { await route.fulfill({ status: 200,