Repository: vercel/next.js
Pull request: Upgrade @playwright/test and cleanup internal APIs

Addressing the API incompatibility in the newest Playwright release: https://github.com/microsoft/playwright/issues/27059#issuecomment-2733762056

cc @wyozi

Changed files:
filename: packages/next/package.json
patch: @@ -110,7 +110,7 @@
   },
   "peerDependencies": {
     "@opentelemetry/api": "^1.1.0",
-    "@playwright/test": "^1.41.2",
+    "@playwright/test": "^1.51.1",
     "babel-plugin-react-compiler": "*",
     "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
     "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
@@ -170,7 +170,7 @@
     "@next/react-refresh-utils": "15.3.0-canary.26",
     "@next/swc": "15.3.0-canary.26",
     "@opentelemetry/api": "1.6.0",
-    "@playwright/test": "1.41.2",
+    "@playwright/test": "1.51.1",
     "@storybook/addon-a11y": "8.6.0",
     "@storybook/addon-essentials": "8.6.0",
     "@storybook/addon-interactions": "8.6.0",

filename: packages/next/src/experimental/testmode/playwright/step.ts
patch: @@ -9,33 +9,13 @@ export interface StepProps {
   params?: Record<string, string | number | boolean | null | undefined>
 }
 
-// Access the internal Playwright API until it's exposed publicly.
-// See https://github.com/microsoft/playwright/issues/27059.
-interface TestInfoWithRunAsStep extends TestInfo {
-  _runAsStep: <T>(
-    stepInfo: StepProps,
-    handler: (result: { complete: Complete }) => Promise<T>
-  ) => Promise<T>
-}
-
 type Complete = (result: { error?: any }) => void
 
-function isWithRunAsStep(
-  testInfo: TestInfo
-): testInfo is TestInfoWithRunAsStep {
-  return '_runAsStep' in testInfo
-}
-
 export async function step<T>(
-  testInfo: TestInfo,
+  _testInfo: TestInfo,
   props: StepProps,
   handler: (complete: Complete) => Promise<Awaited<T>>
 ): Promise<Awaited<T>> {
-  if (isWithRunAsStep(testInfo)) {
-    return testInfo._runAsStep(props, ({ complete }) => handler(complete))
-  }
-
-  // Fallback to the `test.step()`.
   let result: Awaited<T>
   let reportedError: any
   try {

filename: pnpm-lock.yaml
patch: @@ -146,7 +146,7 @@ importers:
         version: 1.1.0
       '@testing-library/jest-dom':
         specifier: 6.1.2
-        version: 6.1.2(@jest/globals@29.7.0)(@types/jest@29.5.5)(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0))(vitest@3.0.4(@types/node@20.17.6)(sass@1.54.0)(tsx@4.19.2))
+        version: 6.1.2(@jest/globals@29.7.0)(@types/jest@29.5.5)(jest@29.7.0(@types/node@20.17.6))(vitest@3.0.4(@types/node@20.17.6)(sass@1.54.0)(tsx@4.19.2))
       '@testing-library/react':
         specifier: ^15.0.5
         version: 15.0.7(@types/react@19.0.8)(react-dom@19.1.0-canary-313332d1-20250326(react@19.1.0-canary-313332d1-20250326))(react@19.1.0-canary-313332d1-20250326)
@@ -284,7 +284,7 @@ importers:
         version: 2.31.0(@typescript-eslint/parser@8.0.0(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)
       eslint-plugin-jest:
         specifier: 27.6.3
-        version: 27.6.3(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0))(typescript@5.8.2)
+        version: 27.6.3(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(jest@29.7.0(@types/node@20.17.6))(typescript@5.8.2)
       eslint-plugin-jsdoc:
         specifier: 48.0.4
         version: 48.0.4(eslint@9.12.0)
@@ -374,7 +374,7 @@ importers:
         version: 29.7.0
       jest-extended:
         specifier: 4.0.2
-        version: 4.0.2(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0))
+        version: 4.0.2(jest@29.7.0(@types/node@20.17.6))
       jest-junit:
         specifier: 16.0.0
         version: 16.0.0
@@ -1036,8 +1036,8 @@ importers:
         specifier: 1.6.0
         version: 1.6.0
       '@playwright/test':
-        specifier: 1.41.2
-        version: 1.41.2
+        specifier: 1.51.1
+        version: 1.51.1
       '@storybook/addon-a11y':
         specifier: 8.6.0
         version: 8.6.0(storybook@8.6.0(prettier@3.3.3))
@@ -1211,7 +1211,7 @@ importers:
         version: 3.0.0
       axe-playwright:
         specifier: 2.0.3
-        version: 2.0.3(playwright@1.48.0)
+        version: 2.0.3(playwright@1.51.1)
       babel-plugin-react-compiler:
         specifier: 19.0.0-beta-e552027-20250112
         version: 19.0.0-beta-e552027-20250112
@@ -5067,10 +5067,9 @@ packages:
     resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==}
     engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
 
-  '@playwright/test@1.41.2':
-    resolution: {integrity: sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==}
-    engines: {node: '>=16'}
-    deprecated: Please update to the latest version of Playwright to test up-to-date browsers.
+  '@playwright/test@1.51.1':
+    resolution: {integrity: sha512-nM+kEaTSAoVlXmMPH10017vn3FSiFqr/bh4fKg9vmAdMfd9SDqRZNvPSiAHADc/itWak+qPvMPZQOPwCBW7k7Q==}
+    engines: {node: '>=18'}
     hasBin: true
 
   '@polka/url@1.0.0-next.11':
@@ -13352,26 +13351,26 @@ packages:
     engines: {node: '>=18'}
     hasBin: true
 
-  playwright-core@1.41.2:
-    resolution: {integrity: sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA==}
-    engines: {node: '>=16'}
-    hasBin: true
-
   playwright-core@1.48.0:
     resolution: {integrity: sha512-RBvzjM9rdpP7UUFrQzRwR8L/xR4HyC1QXMzGYTbf1vjw25/ya9NRAVnXi/0fvFopjebvyPzsmoK58xxeEOaVvA==}
     engines: {node: '>=18'}
     hasBin: true
 
-  playwright@1.41.2:
-    resolution: {integrity: sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==}
-    engines: {node: '>=16'}
+  playwright-core@1.51.1:
+    resolution: {integrity: sha512-/crRMj8+j/Nq5s8QcvegseuyeZPxpQCZb6HNk3Sos3BlZyAknRjoyJPFWkpNn8v0+P3WiwqFF8P+zQo4eqiNuw==}
+    engines: {node: '>=18'}
     hasBin: true
 
   playwright@1.48.0:
     resolution: {integrity: sha512-qPqFaMEHuY/ug8o0uteYJSRfMGFikhUysk8ZvAtfKmUK3kc/6oNl/y3EczF8OFGYIi/Ex2HspMfzYArk6+XQSA==}
     engines: {node: '>=18'}
     hasBin: true
 
+  playwright@1.51.1:
+    resolution: {integrity: sha512-kkx+MB2KQRkyxjYPc3a0wLZZoDczmppyGJIvQ43l+aZihkaVvmu/21kiyaHeHjiFxjxNNFnUncKmcGIyOojsaw==}
+    engines: {node: '>=18'}
+    hasBin: true
+
   pluralize@8.0.0:
     resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
     engines: {node: '>=4'}
@@ -21474,9 +21473,9 @@ snapshots:
 
   '@pkgr/core@0.1.1': {}
 
-  '@playwright/test@1.41.2':
+  '@playwright/test@1.51.1':
     dependencies:
-      playwright: 1.41.2
+      playwright: 1.51.1
 
   '@polka/url@1.0.0-next.11': {}
 
@@ -22246,7 +22245,7 @@ snapshots:
       lz-string: 1.5.0
       pretty-format: 27.5.1
 
-  '@testing-library/jest-dom@6.1.2(@jest/globals@29.7.0)(@types/jest@29.5.5)(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0))(vitest@3.0.4(@types/node@20.17.6)(sass@1.54.0)(tsx@4.19.2))':
+  '@testing-library/jest-dom@6.1.2(@jest/globals@29.7.0)(@types/jest@29.5.5)(jest@29.7.0(@types/node@20.17.6))(vitest@3.0.4(@types/node@20.17.6)(sass@1.54.0)(tsx@4.19.2))':
     dependencies:
       '@adobe/css-tools': 4.3.1
       '@babel/runtime': 7.22.5
@@ -23708,14 +23707,14 @@ snapshots:
       axe-core: 4.10.0
       mustache: 4.2.0
 
-  axe-playwright@2.0.3(playwright@1.48.0):
+  axe-playwright@2.0.3(playwright@1.51.1):
     dependencies:
       '@types/junit-report-builder': 3.0.2
       axe-core: 4.10.0
       axe-html-reporter: 2.2.11(axe-core@4.10.0)
       junit-report-builder: 5.1.1
       picocolors: 1.1.1
-      playwright: 1.48.0
+      playwright: 1.51.1
 
   axios@0.26.1:
     dependencies:
@@ -26417,7 +26416,7 @@ snapshots:
       - eslint-import-resolver-webpack
       - supports-color
 
-  eslint-plugin-jest@27.6.3(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0))(typescript@5.8.2):
+  eslint-plugin-jest@27.6.3(@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(typescript@5.8.2))(eslint@9.12.0)(jest@29.7.0(@types/node@20.17.6))(typescript@5.8.2):
     dependencies:
       '@typescript-eslint/utils': 5.62.0(eslint@9.12.0)(typescript@5.8.2)
       eslint: 9.12.0
@@ -29025,7 +29024,7 @@ snapshots:
       jest-mock: 29.7.0
       jest-util: 29.7.0
 
-  jest-extended@4.0.2(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0)):
+  jest-extended@4.0.2(jest@29.7.0(@types/node@20.17.6)):
     dependencies:
       jest-diff: 29.7.0
       jest-get-type: 29.6.3
@@ -32082,19 +32081,19 @@ snapshots:
     dependencies:
       playwright-core: 1.48.0
 
-  playwright-core@1.41.2: {}
-
   playwright-core@1.48.0: {}
 
-  playwright@1.41.2:
+  playwright-core@1.51.1: {}
+
+  playwright@1.48.0:
     dependencies:
-      playwright-core: 1.41.2
+      playwright-core: 1.48.0
     optionalDependencies:
       fsevents: 2.3.2
 
-  playwright@1.48.0:
+  playwright@1.51.1:
     dependencies:
-      playwright-core: 1.48.0
+      playwright-core: 1.51.1
     optionalDependencies:
       fsevents: 2.3.2