Skip to content

Commit

Permalink
Scripts: fix default Playwright config (#55453)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Oct 19, 2023
1 parent b1038c0 commit 9d3e76b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions packages/scripts/config/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/scripts/config/playwright/global-setup.js
Original file line number Diff line number Diff line change
@@ -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' );

/**
*
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/scripts/test-playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9d3e76b

Please sign in to comment.