fix: isolate CHRNX local integration state
This commit is contained in:
16 files changed
+536
-65
No files matched your search
@@ -1,18 +1,5 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { injectAxe } from 'axe-playwright';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const projectRoot = fileURLToPath( new URL( '../..', import.meta.url ) );
|
||||
const seedScenario = ( scenario ) =>
|
||||
execFileSync( './scripts/seed-test-content.sh', [ scenario ], {
|
||||
cwd: projectRoot,
|
||||
env: {
|
||||
...process.env,
|
||||
PATH: `/opt/homebrew/opt/docker/bin:${ process.env.PATH ?? '' }`,
|
||||
},
|
||||
stdio: 'pipe',
|
||||
} );
|
||||
|
||||
const viewports = [
|
||||
{ width: 375, height: 812 },
|
||||
@@ -151,35 +138,6 @@ test( 'cards without featured media use CSS-only topic treatments', async ( { pa
|
||||
}
|
||||
} );
|
||||
|
||||
test( 'local featured and subscribe scenarios restore the default dataset', async ( {
|
||||
page,
|
||||
}, testInfo ) => {
|
||||
test.skip( testInfo.project.name !== 'chromium', 'Database scenarios run once in Chromium.' );
|
||||
try {
|
||||
for ( const count of [ 1, 2 ] ) {
|
||||
seedScenario( `featured-${ count }` );
|
||||
await page.goto( `/?fixtureScenario=featured-${ count }` );
|
||||
await expect( page.locator( '.chrnx-featured-stories article' ) ).toHaveCount( count );
|
||||
const hrefs = await page
|
||||
.locator( '.chrnx-featured-stories article a' )
|
||||
.evaluateAll( ( links ) => links.map( ( link ) => link.href ) );
|
||||
expect( new Set( hrefs ).size ).toBe( hrefs.length );
|
||||
}
|
||||
for ( const scenario of [ 'subscribe-unpublished', 'subscribe-unavailable' ] ) {
|
||||
seedScenario( scenario );
|
||||
await page.goto( `/?fixtureScenario=${ scenario }` );
|
||||
await expect( page.locator( '.chrnx-subscribe-cta' ) ).toHaveCount( 0 );
|
||||
}
|
||||
} finally {
|
||||
seedScenario( 'default' );
|
||||
}
|
||||
await page.goto( '/' );
|
||||
await expect( page.locator( '.chrnx-featured-stories article' ) ).toHaveCount( 3 );
|
||||
await expect(
|
||||
page.getByRole( 'link', { name: 'Subscribe', exact: true } ).first(),
|
||||
).toBeVisible();
|
||||
} );
|
||||
|
||||
test( 'podcast canonical metadata is safe and missing metadata never invents a player or link', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
|
||||
Reference in new issue
Block a user