test: verify Related Stories workflows
This commit is contained in:
8 files changed
+702
-110
No files matched your search
@@ -24,23 +24,52 @@ test( 'Playwright seeds deterministic local fixtures once outside browser worker
|
||||
assert.doesNotMatch( spec, /wp-env|execFileSync|beforeAll/ );
|
||||
} );
|
||||
|
||||
test( 'database scenarios run only in a serial Chromium project after all read-only browsers', async () => {
|
||||
test( 'exactly two serial mutation projects run after every read-only browser', 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' );
|
||||
const mutationSpecs = [ 'related-stories-scenarios.spec.mjs', 'visual-scenarios.spec.mjs' ];
|
||||
const mutationSources = await Promise.all(
|
||||
mutationSpecs.map( ( file ) => readFile( `tests/e2e/${ file }`, 'utf8' ) ),
|
||||
);
|
||||
const detectedMutations = [];
|
||||
|
||||
for ( const file of files.filter( ( name ) => name.endsWith( '.spec.mjs' ) && name !== 'visual-scenarios.spec.mjs' ) ) {
|
||||
for ( const file of files.filter( ( name ) => name.endsWith( '.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` );
|
||||
if ( /seed-test-content|wp-env|execFileSync/.test( source ) ) {
|
||||
detectedMutations.push( file );
|
||||
} else {
|
||||
assert.doesNotMatch(
|
||||
source,
|
||||
/seed-test-content|wp-env|execFileSync/,
|
||||
`${ file } must be DB read-only`,
|
||||
);
|
||||
}
|
||||
}
|
||||
assert.deepEqual( detectedMutations.sort(), mutationSpecs );
|
||||
|
||||
assert.equal(
|
||||
config.match(
|
||||
/testIgnore:\s*\[\s*['"]visual-scenarios\.spec\.mjs['"],\s*['"]related-stories-scenarios\.spec\.mjs['"]\s*\]/gs,
|
||||
)?.length,
|
||||
3,
|
||||
);
|
||||
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*\)/ );
|
||||
assert.match( config, /testIgnore:\s*['"]related-stories-scenarios\.spec\.mjs['"]/ );
|
||||
assert.match(
|
||||
config,
|
||||
/dependencies:\s*\[\s*['"]chromium['"],\s*['"]firefox['"],\s*['"]webkit['"]\s*\]/s,
|
||||
);
|
||||
assert.match( config, /name:\s*['"]related-scenarios['"]/ );
|
||||
assert.match( config, /testMatch:\s*['"]related-stories-scenarios\.spec\.mjs['"]/ );
|
||||
assert.match( config, /testIgnore:\s*['"]visual-scenarios\.spec\.mjs['"]/ );
|
||||
assert.match( config, /dependencies:\s*\[\s*['"]scenarios['"]\s*\]/s );
|
||||
assert.equal( config.match( /fullyParallel:\s*false/g )?.length, 2 );
|
||||
assert.equal( config.match( /workers:\s*1/g )?.length, 2 );
|
||||
for ( const source of mutationSources ) {
|
||||
assert.match( source, /test\.describe\.configure\(\s*\{\s*mode:\s*['"]serial['"]/s );
|
||||
assert.match( source, /test\.afterAll[\s\S]*seedScenario\(\s*['"]default['"]\s*\)/ );
|
||||
}
|
||||
} );
|
||||
|
||||
test( 'the npm integration chain finishes isolated PHP before browser workers', async () => {
|
||||
|
||||
Reference in new issue
Block a user