Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
/**
|
|
* External dependencies
|
|
*/
|
|
const path = require( 'path' );
|
|
const { defineConfig, devices } = require( '@playwright/test' );
|
|
|
|
process.env.WP_ARTIFACTS_PATH ??= path.join( process.cwd(), 'artifacts' );
|
|
process.env.STORAGE_STATE_PATH ??= path.join(
|
|
process.env.WP_ARTIFACTS_PATH,
|
|
'storage-states/admin.json'
|
|
);
|
|
|
|
const config = defineConfig( {
|
|
reporter: process.env.CI ? [ [ 'github' ] ] : [ [ 'list' ] ],
|
|
forbidOnly: !! process.env.CI,
|
|
// fullyParallel: false,
|
|
workers: 1,
|
|
retries: process.env.CI ? 2 : 0,
|
|
timeout: parseInt( process.env.TIMEOUT || '', 10 ) || 100_000, // Defaults to 100 seconds.
|
|
// Don't report slow test "files", as we will be running our tests in serial.
|
|
reportSlowTests: null,
|
|
testDir: './specs',
|
|
outputDir: path.join( process.env.WP_ARTIFACTS_PATH, 'test-results' ),
|
|
snapshotPathTemplate:
|
|
'{testDir}/{testFileDir}/__snapshots__/{arg}-{projectName}{ext}',
|
|
globalSetup: require.resolve( './playwright/global-setup.js' ),
|
|
use: {
|
|
baseURL: process.env.WP_BASE_URL || 'http://localhost:8889',
|
|
headless: true,
|
|
viewport: {
|
|
width: 960,
|
|
height: 700,
|
|
},
|
|
ignoreHTTPSErrors: true,
|
|
locale: 'en-US',
|
|
contextOptions: {
|
|
reducedMotion: 'reduce',
|
|
strictSelectors: true,
|
|
},
|
|
storageState: process.env.STORAGE_STATE_PATH,
|
|
actionTimeout: 10_000, // 10 seconds.
|
|
trace: 'retain-on-failure',
|
|
screenshot: 'only-on-failure',
|
|
video: 'on-first-retry',
|
|
},
|
|
webServer: {
|
|
command: 'npm run wp-env start',
|
|
port: 8889,
|
|
timeout: 120_000, // 120 seconds.
|
|
reuseExistingServer: true,
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices[ 'Desktop Chrome' ] },
|
|
},
|
|
],
|
|
} );
|
|
|
|
module.exports = config;
|