From db710fa248bdd85256a7a76f65c05d249666af47 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Thu, 13 Aug 2026 10:03:55 -0500 Subject: [PATCH] test: keep CHRNX stage tests portable --- tests/e2e/music-podcast-stages.spec.mjs | 4 +++- tests/smoke/visual-integration.test.mjs | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/e2e/music-podcast-stages.spec.mjs b/tests/e2e/music-podcast-stages.spec.mjs index e2ad7d4..da16a4b 100644 --- a/tests/e2e/music-podcast-stages.spec.mjs +++ b/tests/e2e/music-podcast-stages.spec.mjs @@ -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 ); diff --git a/tests/smoke/visual-integration.test.mjs b/tests/smoke/visual-integration.test.mjs index a238d72..f0c0e4e 100644 --- a/tests/smoke/visual-integration.test.mjs +++ b/tests/smoke/visual-integration.test.mjs @@ -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 \)/ ); +} );