diff --git a/packages/scripts/config/playwright.config.js b/packages/scripts/config/playwright.config.js index 6f380017ccdc4..03ccbb848554b 100644 --- a/packages/scripts/config/playwright.config.js +++ b/packages/scripts/config/playwright.config.js @@ -2,7 +2,6 @@ * External dependencies */ const path = require( 'path' ); -const { fileURLToPath } = require( 'url' ); const { defineConfig, devices } = require( '@playwright/test' ); process.env.WP_ARTIFACTS_PATH ??= path.join( process.cwd(), 'artifacts' ); @@ -24,9 +23,7 @@ const config = defineConfig( { outputDir: path.join( process.env.WP_ARTIFACTS_PATH, 'test-results' ), snapshotPathTemplate: '{testDir}/{testFileDir}/__snapshots__/{arg}-{projectName}{ext}', - globalSetup: fileURLToPath( - new URL( './playwright/global-setup.js', 'file:' + __filename ).href - ), + globalSetup: require.resolve( './playwright/global-setup.js' ), use: { baseURL: process.env.WP_BASE_URL || 'http://localhost:8889', headless: true, diff --git a/packages/scripts/config/playwright/global-setup.js b/packages/scripts/config/playwright/global-setup.js index 9a4cbde9b7d24..0a45d7335590a 100644 --- a/packages/scripts/config/playwright/global-setup.js +++ b/packages/scripts/config/playwright/global-setup.js @@ -1,12 +1,12 @@ /** * External dependencies */ -import { request } from '@playwright/test'; +const { request } = require( '@playwright/test' ); /** * WordPress dependencies */ -import { RequestUtils } from '@wordpress/e2e-test-utils-playwright'; +const { RequestUtils } = require( '@wordpress/e2e-test-utils-playwright' ); /** * diff --git a/packages/scripts/scripts/test-playwright.js b/packages/scripts/scripts/test-playwright.js index 4c10fb6f62114..2e05d992f9df9 100644 --- a/packages/scripts/scripts/test-playwright.js +++ b/packages/scripts/scripts/test-playwright.js @@ -41,7 +41,7 @@ const config = ! hasArgInCLI( '--config' ) && ! hasProjectFile( 'playwright.config.ts' ) && ! hasProjectFile( 'playwright.config.js' ) - ? [ '--config', fromConfigRoot( 'playwright.config.ts' ) ] + ? [ '--config', fromConfigRoot( 'playwright.config.js' ) ] : []; // Set the default artifacts path.