@@ -78,13 +78,8 @@ test.describe('Nanostore Persistence Across Navigation', () => {
7878 await disableConsentModal ( page )
7979 } )
8080
81- test . skip ( '@ready theme preference persists across View Transitions' , async ( { page : playwrightPage } ) => {
81+ test ( '@ready theme preference persists across View Transitions' , async ( { page : playwrightPage } ) => {
8282 const page = await BasePage . init ( playwrightPage )
83- // SKIPPED: Theme persists to localStorage but isn't re-applied from localStorage after View Transition
84- // Root cause: Theme initialization on new page doesn't read from $theme store properly
85- // localStorage.getItem('theme') returns 'dark' but <html data-theme> is null after navigation
86- // This is an implementation bug in theme initialization logic
87-
8883 // Go to homepage
8984 await gotoWithoutGrantingConsent ( page )
9085 await page . waitForLoadState ( 'networkidle' )
@@ -140,22 +135,22 @@ test.describe('Nanostore Persistence Across Navigation', () => {
140135 expect ( isOpen ) . toBe ( 'true' )
141136 } )
142137
143- test . skip ( '@ready cookie consent preferences persist across View Transitions' , async ( { page : playwrightPage } ) => {
138+ test ( '@ready cookie consent preferences persist across View Transitions' , async ( { page : playwrightPage } ) => {
144139 const page = await BasePage . init ( playwrightPage )
145- // SKIPPED: This test needs rework for hybrid consent approach
146- // where functional is true by default and analytics is opt-in
147140 // Go to homepage
148141 await gotoWithoutGrantingConsent ( page )
149142 await page . waitForLoadState ( 'networkidle' )
150143
151144 // Accept functional consent
152- await page . evaluate ( ( ) => {
153- const { updateConsent } = window as any
154- if ( updateConsent ) {
155- updateConsent ( 'functional' , true )
156- updateConsent ( 'analytics' , true )
145+ const consentHelpersAvailable = await page . evaluate ( ( ) => {
146+ if ( ! window . updateConsent ) {
147+ return false
157148 }
149+ window . updateConsent ( 'functional' , true )
150+ window . updateConsent ( 'analytics' , true )
151+ return true
158152 } )
153+ expect ( consentHelpersAvailable ) . toBe ( true )
159154 await expect . poll ( async ( ) => {
160155 return await getLocalStorageItem ( page , 'cookieConsent' )
161156 } ) . not . toBeNull ( )
@@ -186,32 +181,35 @@ test.describe('Nanostore Persistence Across Navigation', () => {
186181 }
187182 } )
188183
189- test . skip ( '@ready social embed cache persists across View Transitions' , async ( { page : playwrightPage } ) => {
184+ test ( '@ready social embed cache persists across View Transitions' , async ( { page : playwrightPage } ) => {
190185 const page = await BasePage . init ( playwrightPage )
191- // SKIPPED: Test setup issue - cache functions not available in test environment
192186 // Go to a page with social embeds (if available)
193187 await gotoWithoutGrantingConsent ( page )
194188 await page . waitForLoadState ( 'networkidle' )
195189
196190 // First enable functional consent (required for caching)
197- await page . evaluate ( ( ) => {
198- const { updateConsent } = window as any
199- if ( updateConsent ) {
200- updateConsent ( 'functional' , true )
191+ const functionalConsentApplied = await page . evaluate ( ( ) => {
192+ if ( ! window . updateConsent ) {
193+ return false
201194 }
195+ window . updateConsent ( 'functional' , true )
196+ return true
202197 } )
198+ expect ( functionalConsentApplied ) . toBe ( true )
203199 await expect . poll ( async ( ) => {
204200 return await getLocalStorageItem ( page , 'cookieConsent' )
205201 } ) . not . toBeNull ( )
206202
207203 // Add a mock embed to the cache
208- await page . evaluate ( ( ) => {
209- const { cacheEmbed } = window as any
210- if ( cacheEmbed ) {
211- const testData = { html : '<blockquote>Test cached embed</blockquote>' }
212- cacheEmbed ( 'test_embed_123' , testData , 24 * 60 * 60 * 1000 ) // 24 hours
204+ const cacheHelpersAvailable = await page . evaluate ( ( ) => {
205+ if ( ! window . cacheEmbed ) {
206+ return false
213207 }
208+ const testData = { html : '<blockquote>Test cached embed</blockquote>' }
209+ window . cacheEmbed ( 'test_embed_123' , testData , 24 * 60 * 60 * 1000 ) // 24 hours
210+ return true
214211 } )
212+ expect ( cacheHelpersAvailable ) . toBe ( true )
215213 await expect . poll ( async ( ) => {
216214 return await getLocalStorageItem ( page , 'socialEmbedCache' )
217215 } ) . not . toBeNull ( )
@@ -242,32 +240,35 @@ test.describe('Nanostore Persistence Across Navigation', () => {
242240 }
243241 } )
244242
245- test . skip ( '@ready mastodon instances persist across View Transitions' , async ( { page : playwrightPage } ) => {
243+ test ( '@ready mastodon instances persist across View Transitions' , async ( { page : playwrightPage } ) => {
246244 const page = await BasePage . init ( playwrightPage )
247- // SKIPPED: Test setup issue - mastodon functions not available in test environment
248245 // Go to homepage
249246 await gotoWithoutGrantingConsent ( page )
250247 await page . waitForLoadState ( 'networkidle' )
251248
252249 // First enable functional consent (required for persistence)
253- await page . evaluate ( ( ) => {
254- const { updateConsent } = window as any
255- if ( updateConsent ) {
256- updateConsent ( 'functional' , true )
250+ const functionalConsentEnabled = await page . evaluate ( ( ) => {
251+ if ( ! window . updateConsent ) {
252+ return false
257253 }
254+ window . updateConsent ( 'functional' , true )
255+ return true
258256 } )
257+ expect ( functionalConsentEnabled ) . toBe ( true )
259258 await expect . poll ( async ( ) => {
260259 return await getLocalStorageItem ( page , 'cookieConsent' )
261260 } ) . not . toBeNull ( )
262261
263262 // Add mastodon instances
264- await page . evaluate ( ( ) => {
265- const { saveMastodonInstance } = window as any
266- if ( saveMastodonInstance ) {
267- saveMastodonInstance ( 'mastodon.social' )
268- saveMastodonInstance ( 'fosstodon.org' )
263+ const mastodonHelpersAvailable = await page . evaluate ( ( ) => {
264+ if ( ! window . saveMastodonInstance ) {
265+ return false
269266 }
267+ window . saveMastodonInstance ( 'mastodon.social' )
268+ window . saveMastodonInstance ( 'fosstodon.org' )
269+ return true
270270 } )
271+ expect ( mastodonHelpersAvailable ) . toBe ( true )
271272 await expect . poll ( async ( ) => {
272273 return await getLocalStorageItem ( page , 'mastodonInstances' )
273274 } ) . not . toBeNull ( )
@@ -313,12 +314,14 @@ test.describe('Nanostore Persistence Across Navigation', () => {
313314 await expect ( page . locator ( 'html' ) ) . toHaveAttribute ( 'data-theme' , 'dark' )
314315
315316 // Set consent
316- await page . evaluate ( ( ) => {
317- const { updateConsent } = window as any
318- if ( updateConsent ) {
319- updateConsent ( 'functional' , true )
317+ const consentSet = await page . evaluate ( ( ) => {
318+ if ( ! window . updateConsent ) {
319+ return false
320320 }
321+ window . updateConsent ( 'functional' , true )
322+ return true
321323 } )
324+ expect ( consentSet ) . toBe ( true )
322325 await expect . poll ( async ( ) => {
323326 return await getLocalStorageItem ( page , 'cookieConsent' )
324327 } ) . not . toBeNull ( )
0 commit comments