From f2bd6bbcc14a4f2dccbb9d323c69916e771d0b3d Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 2 Oct 2023 22:32:11 +0200 Subject: [PATCH 1/3] Fix path to `globalSetup` in default Playwright config Oversight from #54856 --- packages/scripts/config/playwright.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/scripts/config/playwright.config.js b/packages/scripts/config/playwright.config.js index 16ee210bdfb86e..aa484d5462e9fa 100644 --- a/packages/scripts/config/playwright.config.js +++ b/packages/scripts/config/playwright.config.js @@ -25,7 +25,7 @@ const config = defineConfig( { snapshotPathTemplate: '{testDir}/{testFileDir}/__snapshots__/{arg}-{projectName}{ext}', globalSetup: fileURLToPath( - new URL( './playwright/global-setup.ts', 'file:' + __filename ).href + new URL( './playwright/global-setup.js', 'file:' + __filename ).href ), use: { baseURL: process.env.WP_BASE_URL || 'http://localhost:8889', From 4c7665fcc6e6fa50f550148f1f2b5940adea2fec Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 2 Oct 2023 22:37:17 +0200 Subject: [PATCH 2/3] `module.exports` --- packages/scripts/config/playwright.config.js | 2 +- packages/scripts/config/playwright/global-setup.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scripts/config/playwright.config.js b/packages/scripts/config/playwright.config.js index aa484d5462e9fa..6f380017ccdc4f 100644 --- a/packages/scripts/config/playwright.config.js +++ b/packages/scripts/config/playwright.config.js @@ -60,4 +60,4 @@ const config = defineConfig( { ], } ); -export default config; +module.exports = config; diff --git a/packages/scripts/config/playwright/global-setup.js b/packages/scripts/config/playwright/global-setup.js index eace349c6309dd..9a4cbde9b7d241 100644 --- a/packages/scripts/config/playwright/global-setup.js +++ b/packages/scripts/config/playwright/global-setup.js @@ -32,4 +32,4 @@ async function globalSetup( config ) { await requestContext.dispose(); } -export default globalSetup; +module.exports = globalSetup; From 1c916768d1067e29d1bf4d7a5f4f16acfd420fd6 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 2 Oct 2023 22:39:01 +0200 Subject: [PATCH 3/3] Fix default export usage --- test/e2e/playwright.config.ts | 2 +- test/performance/playwright.config.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/playwright.config.ts b/test/e2e/playwright.config.ts index 742ca54f4f2ace..cbbfbac3be4159 100644 --- a/test/e2e/playwright.config.ts +++ b/test/e2e/playwright.config.ts @@ -11,7 +11,7 @@ import { defineConfig, devices } from '@playwright/test'; const baseConfig = require( '@wordpress/scripts/config/playwright.config' ); const config = defineConfig( { - ...baseConfig.default, + ...baseConfig, reporter: process.env.CI ? [ [ 'github' ], [ './config/flaky-tests-reporter.ts' ] ] : 'list', diff --git a/test/performance/playwright.config.ts b/test/performance/playwright.config.ts index 0918b79d3144d2..a8208342ac2d81 100644 --- a/test/performance/playwright.config.ts +++ b/test/performance/playwright.config.ts @@ -13,7 +13,7 @@ const baseConfig = require( '@wordpress/scripts/config/playwright.config' ); process.env.ASSETS_PATH = path.join( __dirname, 'assets' ); const config = defineConfig( { - ...baseConfig.default, + ...baseConfig, reporter: process.env.CI ? './config/performance-reporter.ts' : [ [ 'list' ], [ './config/performance-reporter.ts' ] ], @@ -26,7 +26,7 @@ const config = defineConfig( { new URL( './config/global-setup.ts', 'file:' + __filename ).href ), use: { - ...baseConfig.default.use, + ...baseConfig.use, video: 'off', }, } );