17 lines
903 B
JavaScript
17 lines
903 B
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import test from 'node:test';
|
|
|
|
test( 'Playwright seeds deterministic local fixtures once outside browser workers', async () => {
|
|
const config = await readFile( 'playwright.config.mjs', 'utf8' );
|
|
const setup = await readFile( 'tests/e2e/global-setup.mjs', 'utf8' );
|
|
const seed = await readFile( 'scripts/seed-test-content.php', 'utf8' );
|
|
const spec = await readFile( 'tests/e2e/editorial-editor.spec.mjs', 'utf8' );
|
|
|
|
assert.match( config, /globalSetup:\s*['"]\.\/tests\/e2e\/global-setup\.mjs['"]/ );
|
|
assert.match( setup, /execFileSync\(\s*['"]\.\/scripts\/seed-test-content\.sh['"]/s );
|
|
assert.equal( setup.match( /seed-test-content\.sh/g )?.length, 1 );
|
|
assert.equal( seed.match( /chrnx_seed_editorial_terms\(\);/g )?.length, 1 );
|
|
assert.doesNotMatch( spec, /wp-env|execFileSync|beforeAll/ );
|
|
} );
|