test: keep CHRNX stage tests portable

This commit is contained in:
chrnx committed 2026-08-13 10:03:55 -05:00
1 parent f276e6b2ea
commit db710fa248
2 files changed
+12 -1

No files matched your search

+3 -1
View File
@@ -26,7 +26,7 @@ const landings = [
async function openIsolatedThemedPage( browser, testInfo, { height, path, theme, width } ) {
const baseURL = testInfo.project.use.baseURL;
expect( new URL( baseURL ).origin ).toBe( 'http://localhost:8908' );
const expectedOrigin = new URL( baseURL ).origin;
const context = await browser.newContext( {
baseURL,
colorScheme: theme,
@@ -34,6 +34,8 @@ async function openIsolatedThemedPage( browser, testInfo, { height, path, theme,
} );
const page = await context.newPage();
await page.goto( path );
const resolvedOrigin = new URL( page.url() ).origin;
expect( resolvedOrigin ).toBe( expectedOrigin );
const resolvedTheme = await page.evaluate( ( value ) => {
window.localStorage.clear();
window.localStorage.setItem( 'chrnx-theme', value );
+9
View File
@@ -620,3 +620,12 @@ test( 'Music and Podcast stage specialization cannot leak into immutable surface
assert.doesNotMatch( block, new RegExp( forbidden.replaceAll( '.', '\\.' ) ) );
}
} );
test( 'Music and Podcast browser tests derive their origin from Playwright configuration', () => {
const stages = read( 'tests/e2e/music-podcast-stages.spec.mjs' );
assert.doesNotMatch( stages, /localhost:8908/ );
assert.match( stages, /new URL\( baseURL \)\.origin/ );
assert.match( stages, /new URL\( page\.url\(\) \)\.origin/ );
assert.match( stages, /expect\( resolvedOrigin \)\.toBe\( expectedOrigin \)/ );
} );