fix: isolate CHRNX local integration state
This commit is contained in:
16 files changed
+536
-65
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { readFile, readdir } from 'node:fs/promises';
|
||||
import test from 'node:test';
|
||||
|
||||
test( 'Playwright seeds deterministic local fixtures once outside browser workers', async () => {
|
||||
@@ -14,3 +14,31 @@ test( 'Playwright seeds deterministic local fixtures once outside browser worker
|
||||
assert.equal( seed.match( /chrnx_seed_editorial_terms\(\);/g )?.length, 1 );
|
||||
assert.doesNotMatch( spec, /wp-env|execFileSync|beforeAll/ );
|
||||
} );
|
||||
|
||||
test( 'database scenarios run only in a serial Chromium project after all read-only browsers', async () => {
|
||||
const config = await readFile( 'playwright.config.mjs', 'utf8' );
|
||||
const files = await readdir( 'tests/e2e' );
|
||||
const scenario = await readFile( 'tests/e2e/visual-scenarios.spec.mjs', 'utf8' );
|
||||
|
||||
for ( const file of files.filter( ( name ) => name.endsWith( '.spec.mjs' ) && name !== 'visual-scenarios.spec.mjs' ) ) {
|
||||
const source = await readFile( `tests/e2e/${ file }`, 'utf8' );
|
||||
assert.doesNotMatch( source, /seed-test-content|wp-env|execFileSync/, `${ file } must be DB read-only` );
|
||||
}
|
||||
|
||||
assert.match( config, /name:\s*['"]scenarios['"]/ );
|
||||
assert.match( config, /testMatch:\s*['"]visual-scenarios\.spec\.mjs['"]/ );
|
||||
assert.match( config, /dependencies:\s*\[\s*['"]chromium['"],\s*['"]firefox['"],\s*['"]webkit['"]\s*\]/s );
|
||||
assert.match( config, /fullyParallel:\s*false/ );
|
||||
assert.match( config, /workers:\s*1/ );
|
||||
assert.match( scenario, /test\.describe\.configure\(\s*\{\s*mode:\s*['"]serial['"]/s );
|
||||
assert.match( scenario, /test\.afterAll[\s\S]*seedScenario\(\s*['"]default['"]\s*\)/ );
|
||||
} );
|
||||
|
||||
test( 'the npm integration chain finishes PHP and seed-state checks before browser workers', async () => {
|
||||
const manifest = JSON.parse( await readFile( 'package.json', 'utf8' ) );
|
||||
assert.match( manifest.scripts[ 'test:integration' ], /tests\/integration\/seed-state\.sh/ );
|
||||
assert.match(
|
||||
manifest.scripts.test,
|
||||
/npm run test:php && npm run test:integration && npm run test:e2e/,
|
||||
);
|
||||
} );
|
||||
Reference in new issue
Block a user