Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Scripts: fix default Playwright config
  • Loading branch information
swissspidy committed Oct 18, 2023
commit d1e469f32f8c7698d47bcf8a64440c49a831e14c
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