From a15568cdc80b7027ffd553df4af9637265aca1e5 Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Wed, 11 Dec 2024 20:02:40 +0100 Subject: [PATCH 1/6] chore: upgrade playwright packages to latest Upgrade @playwright/experimental-ct-react from 1.44.1 to 1.49.1 Upgrade @playwright/test from 1.49.1 to 1.49.1 --- package.json | 2 +- packages/sanity/package.json | 4 +- perf/tests/package.json | 2 +- pnpm-lock.yaml | 100 +++++++++++++++++------------------ 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/package.json b/package.json index f7951b05d58..37dedfcba34 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "prettier": "@sanity/prettier-config", "devDependencies": { "@google-cloud/storage": "^7.11.0", - "@playwright/test": "1.44.1", + "@playwright/test": "1.49.1", "@repo/dev-aliases": "workspace:*", "@repo/package.config": "workspace:*", "@repo/test-config": "workspace:*", diff --git a/packages/sanity/package.json b/packages/sanity/package.json index 5c95e9b5f62..ecdbff494f4 100644 --- a/packages/sanity/package.json +++ b/packages/sanity/package.json @@ -266,8 +266,8 @@ "yargs": "^17.3.0" }, "devDependencies": { - "@playwright/experimental-ct-react": "1.44.1", - "@playwright/test": "1.44.1", + "@playwright/experimental-ct-react": "1.49.1", + "@playwright/test": "1.49.1", "@repo/dev-aliases": "workspace:*", "@repo/package.config": "workspace:*", "@repo/test-config": "workspace:*", diff --git a/perf/tests/package.json b/perf/tests/package.json index 19b7509ec11..84f331ff5d9 100644 --- a/perf/tests/package.json +++ b/perf/tests/package.json @@ -15,7 +15,7 @@ "studio:dev": "cd perf/studio && SANITY_STUDIO_DATASET=dev pnpm dev" }, "dependencies": { - "@playwright/test": "1.44.1", + "@playwright/test": "1.49.1", "@sanity/client": "^6.24.1", "@sanity/uuid": "^3.0.1", "dotenv": "^16.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7019b6bc21b..1ea63fa34fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,8 +22,8 @@ importers: specifier: ^7.11.0 version: 7.14.0(encoding@0.1.13) '@playwright/test': - specifier: 1.44.1 - version: 1.44.1 + specifier: 1.49.1 + version: 1.49.1 '@repo/dev-aliases': specifier: workspace:* version: link:packages/@repo/dev-aliases @@ -317,7 +317,7 @@ importers: dependencies: next: specifier: ^14.0.0 - version: 14.2.20(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 14.2.20(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: specifier: ^18.3.1 version: 18.3.1 @@ -443,7 +443,7 @@ importers: version: 19.0.0-beta-37ed2a7-20241206 next: specifier: 15.0.4 - version: 15.0.4(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) + version: 15.0.4(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) react: specifier: rc version: 19.0.0-rc.1 @@ -548,7 +548,7 @@ importers: version: link:../../packages/@sanity/vision '@sanity/visual-editing': specifier: 2.10.6 - version: 2.10.6(@sanity/client@6.24.1)(next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 2.10.6(@sanity/client@6.24.1)(next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@turf/helpers': specifier: ^6.0.1 version: 6.5.0 @@ -1786,11 +1786,11 @@ importers: version: 17.3.0 devDependencies: '@playwright/experimental-ct-react': - specifier: 1.44.1 - version: 1.44.1(@types/node@22.10.1)(terser@5.37.0)(vite@5.4.11(@types/node@22.10.1)(terser@5.37.0)) + specifier: 1.49.1 + version: 1.49.1(@types/node@22.10.1)(terser@5.37.0)(vite@5.4.11(@types/node@22.10.1)(terser@5.37.0)) '@playwright/test': - specifier: 1.44.1 - version: 1.44.1 + specifier: 1.49.1 + version: 1.49.1 '@repo/dev-aliases': specifier: workspace:* version: link:../@repo/dev-aliases @@ -2035,8 +2035,8 @@ importers: perf/tests: dependencies: '@playwright/test': - specifier: 1.44.1 - version: 1.44.1 + specifier: 1.49.1 + version: 1.49.1 '@sanity/client': specifier: ^6.24.1 version: 6.24.1(debug@4.4.0) @@ -4104,18 +4104,18 @@ packages: resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - '@playwright/experimental-ct-core@1.44.1': - resolution: {integrity: sha512-IqeXzfmpHH8yHA0fGQ//l/tDJHzUmg2dQj3t28E1tCshvnYc9fVr53Na9+/B8ME//vw0UFpv+CSKcOTHwWrhQg==} - engines: {node: '>=16'} + '@playwright/experimental-ct-core@1.49.1': + resolution: {integrity: sha512-MZ0by8hLo/2qGHoo3SSbdxTNwKXrw06rqqA64TEiwOBjzpbYAaCuA3+BemXpMFfa0nU6ivO4h/sFdA8Zv9ns+g==} + engines: {node: '>=18'} - '@playwright/experimental-ct-react@1.44.1': - resolution: {integrity: sha512-qRhv2zmZVwtzAYWwQO4j+It0S5zLUuZg/7Ke61ymCC5jGqlwf2kYqogFxBiDdhAO1sz/dN0UtdU+6df0HK5yzw==} - engines: {node: '>=16'} + '@playwright/experimental-ct-react@1.49.1': + resolution: {integrity: sha512-kQTSzVkFd05x1kY8Q/XaF3xg3dd3AH31976N0zCVVQ3pw/qpa3jtdjoj7/30eblU5eVlg0ELMV7pjL5lUjJzzw==} + engines: {node: '>=18'} hasBin: true - '@playwright/test@1.44.1': - resolution: {integrity: sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q==} - engines: {node: '>=16'} + '@playwright/test@1.49.1': + resolution: {integrity: sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==} + engines: {node: '>=18'} hasBin: true '@pnpm/config.env-replace@1.1.0': @@ -9511,19 +9511,14 @@ packages: resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} engines: {node: '>=8'} - playwright-core@1.44.1: - resolution: {integrity: sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA==} - engines: {node: '>=16'} - hasBin: true - playwright-core@1.49.0: resolution: {integrity: sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==} engines: {node: '>=18'} hasBin: true - playwright@1.44.1: - resolution: {integrity: sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg==} - engines: {node: '>=16'} + playwright-core@1.49.1: + resolution: {integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==} + engines: {node: '>=18'} hasBin: true playwright@1.49.0: @@ -9531,6 +9526,11 @@ packages: engines: {node: '>=18'} hasBin: true + playwright@1.49.1: + resolution: {integrity: sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==} + engines: {node: '>=18'} + hasBin: true + please-upgrade-node@3.2.0: resolution: {integrity: sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==} @@ -13961,10 +13961,10 @@ snapshots: '@pkgr/core@0.1.1': {} - '@playwright/experimental-ct-core@1.44.1(@types/node@22.10.1)(terser@5.37.0)': + '@playwright/experimental-ct-core@1.49.1(@types/node@22.10.1)(terser@5.37.0)': dependencies: - playwright: 1.44.1 - playwright-core: 1.44.1 + playwright: 1.49.1 + playwright-core: 1.49.1 vite: 5.4.11(@types/node@22.10.1)(terser@5.37.0) transitivePeerDependencies: - '@types/node' @@ -13976,9 +13976,9 @@ snapshots: - sugarss - terser - '@playwright/experimental-ct-react@1.44.1(@types/node@22.10.1)(terser@5.37.0)(vite@5.4.11(@types/node@22.10.1)(terser@5.37.0))': + '@playwright/experimental-ct-react@1.49.1(@types/node@22.10.1)(terser@5.37.0)(vite@5.4.11(@types/node@22.10.1)(terser@5.37.0))': dependencies: - '@playwright/experimental-ct-core': 1.44.1(@types/node@22.10.1)(terser@5.37.0) + '@playwright/experimental-ct-core': 1.49.1(@types/node@22.10.1)(terser@5.37.0) '@vitejs/plugin-react': 4.3.4(vite@5.4.11(@types/node@22.10.1)(terser@5.37.0)) transitivePeerDependencies: - '@types/node' @@ -13992,9 +13992,9 @@ snapshots: - terser - vite - '@playwright/test@1.44.1': + '@playwright/test@1.49.1': dependencies: - playwright: 1.44.1 + playwright: 1.49.1 '@pnpm/config.env-replace@1.1.0': {} @@ -14775,7 +14775,7 @@ snapshots: '@sanity/test@0.0.1-alpha.1': dependencies: - '@playwright/test': 1.44.1 + '@playwright/test': 1.49.1 '@sanity/client': 6.24.1(debug@4.4.0) '@sanity/uuid': 3.0.2 cac: 6.7.14 @@ -15108,7 +15108,7 @@ snapshots: '@types/uuid': 8.3.4 uuid: 8.3.2 - '@sanity/visual-editing@2.10.6(@sanity/client@6.24.1)(next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@sanity/visual-editing@2.10.6(@sanity/client@6.24.1)(next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@sanity/comlink': 2.0.1 '@sanity/mutate': 0.11.0-canary.3(xstate@5.19.0) @@ -15125,7 +15125,7 @@ snapshots: xstate: 5.19.0 optionalDependencies: '@sanity/client': 6.24.1(debug@4.4.0) - next: 15.0.4(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + next: 15.0.4(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) transitivePeerDependencies: - debug @@ -20089,7 +20089,7 @@ snapshots: neo-async@2.6.2: {} - next@14.2.20(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@14.2.20(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@next/env': 14.2.20 '@swc/helpers': 0.5.5 @@ -20110,12 +20110,12 @@ snapshots: '@next/swc-win32-arm64-msvc': 14.2.20 '@next/swc-win32-ia32-msvc': 14.2.20 '@next/swc-win32-x64-msvc': 14.2.20 - '@playwright/test': 1.44.1 + '@playwright/test': 1.49.1 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros - next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@next/env': 15.0.4 '@swc/counter': 0.1.3 @@ -20135,7 +20135,7 @@ snapshots: '@next/swc-linux-x64-musl': 15.0.4 '@next/swc-win32-arm64-msvc': 15.0.4 '@next/swc-win32-x64-msvc': 15.0.4 - '@playwright/test': 1.44.1 + '@playwright/test': 1.49.1 babel-plugin-react-compiler: 19.0.0-beta-37ed2a7-20241206 sharp: 0.33.5 transitivePeerDependencies: @@ -20143,7 +20143,7 @@ snapshots: - babel-plugin-macros optional: true - next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.44.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1): + next@15.0.4(@babel/core@7.26.0)(@playwright/test@1.49.1)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.0.0-beta-37ed2a7-20241206)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1): dependencies: '@next/env': 15.0.4 '@swc/counter': 0.1.3 @@ -20163,7 +20163,7 @@ snapshots: '@next/swc-linux-x64-musl': 15.0.4 '@next/swc-win32-arm64-msvc': 15.0.4 '@next/swc-win32-x64-msvc': 15.0.4 - '@playwright/test': 1.44.1 + '@playwright/test': 1.49.1 babel-plugin-react-compiler: 19.0.0-beta-37ed2a7-20241206 sharp: 0.33.5 transitivePeerDependencies: @@ -20826,19 +20826,19 @@ snapshots: dependencies: find-up: 3.0.0 - playwright-core@1.44.1: {} - playwright-core@1.49.0: {} - playwright@1.44.1: + playwright-core@1.49.1: {} + + playwright@1.49.0: dependencies: - playwright-core: 1.44.1 + playwright-core: 1.49.0 optionalDependencies: fsevents: 2.3.2 - playwright@1.49.0: + playwright@1.49.1: dependencies: - playwright-core: 1.49.0 + playwright-core: 1.49.1 optionalDependencies: fsevents: 2.3.2 From b67482fdf50c852919ac2f50e37db7e7a8349a5e Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Wed, 11 Dec 2024 20:07:52 +0100 Subject: [PATCH 2/6] test(playwright-ct): workaround for issue regarding incorrect Meta-key being used for chromium/darwin --- packages/sanity/playwright-ct/tests/utils/testHelpers.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx index 45bff1a1e25..c16d55bd95e 100644 --- a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx +++ b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx @@ -105,8 +105,12 @@ export function testHelpers({page}: {page: PlaywrightTestArgs['page']}) { * Gets the appropriate modifier key for the current platform. * @returns The modifier key name ('Meta' for macOS, 'Control' for other platforms). */ - getModifierKey: () => { + getModifierKey: (options?: {browserName?: string}) => { if (process.platform === 'darwin') { + // There's a bug in Chromium on macOS where it use 'Control' instead of 'Meta' inside Playwright for some reason + if (options?.browserName && ['chromium', 'firefox'].includes(options.browserName)) { + return 'Control' + } return 'Meta' } return 'Control' From be333d0fd5575c68d7e2200419e053dd94ecab4f Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Wed, 11 Dec 2024 20:14:13 +0100 Subject: [PATCH 3/6] test(playwright-ct): enable test for chromium after Meta-key-bug-fix This test is now likely to work as expected. Remove exception to skip Chromium --- .../formBuilder/inputs/PortableText/Decorators.spec.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Decorators.spec.tsx b/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Decorators.spec.tsx index 3d735029c75..504582cc6b5 100644 --- a/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Decorators.spec.tsx +++ b/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Decorators.spec.tsx @@ -44,12 +44,6 @@ test.describe('Portable Text Input', () => { page, browserName, }) => { - // avoid flakiness to make sure the test has the best chance despite being slow - test.slow() - - // For now, only test in Chromium due to flakiness in Firefox and WebKit - test.skip(browserName !== 'chromium') - const { getModifierKey, getFocusedPortableTextEditor, @@ -62,7 +56,7 @@ test.describe('Portable Text Input', () => { await mount() const $portableTextInput = await getFocusedPortableTextInput('field-defaultDecorators') const $pte = await getFocusedPortableTextEditor('field-defaultDecorators') - const modifierKey = getModifierKey() + const modifierKey = getModifierKey({browserName}) for (const decorator of DEFAULT_DECORATORS) { if (decorator.hotkey) { From 8a73d4f0c877815cbafebaaaabf9deee61ba2d59 Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Wed, 11 Dec 2024 20:15:29 +0100 Subject: [PATCH 4/6] test(playwright-ct): enable test again after Meta-bug-fix --- .../tests/formBuilder/inputs/PortableText/Toolbar.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Toolbar.spec.tsx b/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Toolbar.spec.tsx index f8862ec0e03..73c347948ae 100644 --- a/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Toolbar.spec.tsx +++ b/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/Toolbar.spec.tsx @@ -106,7 +106,7 @@ test.describe('Portable Text Input', () => { }) // TODO - needs rewrite to avoid flakiness - test.skip('Opening block style', () => { + test.describe('Opening block style', () => { test('on a simple editor', async ({mount, page}) => { const {getFocusedPortableTextInput} = testHelpers({page}) await mount() From 3e572a884fd3e42fd7d3650223c675fddb873959 Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Wed, 11 Dec 2024 22:38:17 +0100 Subject: [PATCH 5/6] test(playwright-ct): tweak timouts and meta key --- packages/sanity/playwright-ct.config.ts | 4 ++-- .../playwright-ct/tests/utils/testHelpers.tsx | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/sanity/playwright-ct.config.ts b/packages/sanity/playwright-ct.config.ts index 158091b1e66..ed5132af298 100644 --- a/packages/sanity/playwright-ct.config.ts +++ b/packages/sanity/playwright-ct.config.ts @@ -39,10 +39,10 @@ export default defineConfig({ ], /* Maximum time one test can run for. */ - timeout: 30 * 1000, + timeout: 60 * 1000, expect: { // Maximum time expect() should wait for the condition to be met. - timeout: 10 * 1000, + timeout: 40 * 1000, }, /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ diff --git a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx index c16d55bd95e..525b9a742e2 100644 --- a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx +++ b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx @@ -106,14 +106,19 @@ export function testHelpers({page}: {page: PlaywrightTestArgs['page']}) { * @returns The modifier key name ('Meta' for macOS, 'Control' for other platforms). */ getModifierKey: (options?: {browserName?: string}) => { - if (process.platform === 'darwin') { - // There's a bug in Chromium on macOS where it use 'Control' instead of 'Meta' inside Playwright for some reason - if (options?.browserName && ['chromium', 'firefox'].includes(options.browserName)) { - return 'Control' - } + // There's a bug with Firefox and Chromium on macOS where it use 'Control' instead of 'Meta' inside Playwright for some reason + if ( + process.platform === 'darwin' && + options?.browserName && + ['chromium', 'firefox'].includes(options.browserName) + ) { + return 'Control' + } + // Webkit on Linux uses 'Meta' instead of 'Control' as the modifier key for some reason + if (process.platform === 'linux' && options?.browserName === 'webkit') { return 'Meta' } - return 'Control' + return 'ControlOrMeta' }, /** * Types text with a delay using `page.keyboard.type`. Default delay emulates a human typing. From f9f6e84ae59bcb54b3894d55d7f432398622f2c9 Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Wed, 11 Dec 2024 23:14:04 +0100 Subject: [PATCH 6/6] test(playwright-ct): remove timeout --- packages/sanity/playwright-ct/tests/utils/testHelpers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx index 525b9a742e2..d85b8cc65e5 100644 --- a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx +++ b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx @@ -13,7 +13,7 @@ export function testHelpers({page}: {page: PlaywrightTestArgs['page']}) { await $overlay.press('Space') } - await expect($overlay).not.toBeVisible({timeout: 1500}) + await expect($overlay).not.toBeVisible() } return { /**