test: isolate Related Stories partial counts
This commit is contained in:
7 files changed
+33
-283
No files matched your search
@@ -30,10 +30,10 @@ test( 'Playwright caps read-only browser concurrency for the local WordPress sta
|
||||
assert.equal( config.workers, 2 );
|
||||
} );
|
||||
|
||||
test( 'exactly two serial mutation projects run after every read-only browser', async () => {
|
||||
test( 'exactly one serial mutation project runs after every read-only browser', async () => {
|
||||
const config = await readFile( 'playwright.config.mjs', 'utf8' );
|
||||
const files = await readdir( 'tests/e2e' );
|
||||
const mutationSpecs = [ 'related-stories-scenarios.spec.mjs', 'visual-scenarios.spec.mjs' ];
|
||||
const mutationSpecs = [ 'visual-scenarios.spec.mjs' ];
|
||||
const mutationSources = await Promise.all(
|
||||
mutationSpecs.map( ( file ) => readFile( `tests/e2e/${ file }`, 'utf8' ) ),
|
||||
);
|
||||
@@ -53,31 +53,37 @@ test( 'exactly two serial mutation projects run after every read-only browser',
|
||||
}
|
||||
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.equal( config.match( /testIgnore:\s*['"]visual-scenarios\.spec\.mjs['"]/g )?.length, 3 );
|
||||
assert.match( config, /name:\s*['"]scenarios['"]/ );
|
||||
assert.match( config, /testMatch:\s*['"]visual-scenarios\.spec\.mjs['"]/ );
|
||||
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 );
|
||||
assert.doesNotMatch( config, /related-scenarios|related-stories-scenarios/ );
|
||||
assert.equal( config.match( /fullyParallel:\s*false/g )?.length, 1 );
|
||||
assert.equal( config.match( /workers:\s*1/g )?.length, 1 );
|
||||
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( 'Related Stories partial-count verification never mutates unowned browser content', async () => {
|
||||
const seed = await readFile( 'scripts/seed-test-content.php', 'utf8' );
|
||||
const shell = await readFile( 'scripts/seed-test-content.sh', 'utf8' );
|
||||
const phpTest = await readFile( 'tests/php/BlockRenderingTest.php', 'utf8' );
|
||||
const files = await readdir( 'tests/e2e' );
|
||||
|
||||
assert.doesNotMatch( seed, /related-[124]|related_unowned|unowned_status_snapshot/ );
|
||||
assert.doesNotMatch( shell, /related-[124]/ );
|
||||
assert.equal( files.includes( 'related-stories-scenarios.spec.mjs' ), false );
|
||||
assert.match(
|
||||
phpTest,
|
||||
/related_partial_count_provider[\s\S]*array\(\s*1\s*\)[\s\S]*array\(\s*2\s*\)[\s\S]*array\(\s*4\s*\)/,
|
||||
);
|
||||
} );
|
||||
|
||||
test( 'the npm integration chain finishes isolated PHP before browser workers', async () => {
|
||||
const manifest = JSON.parse( await readFile( 'package.json', 'utf8' ) );
|
||||
assert.equal( manifest.scripts[ 'test:integration' ], undefined );
|
||||
|
||||
Reference in new issue
Block a user