@@ -39,9 +39,9 @@ export class BasePage extends BuiltInsPage {
3939 try {
4040 // Set consent cookies
4141 await this . _page . evaluate ( ( ) => {
42- document . cookie = 'consent_analytics=true ; path=/; max-age=31536000'
43- document . cookie = 'consent_marketing=true ; path=/; max-age=31536000'
44- document . cookie = 'consent_functional=true ; path=/; max-age=31536000'
42+ document . cookie = 'consent_analytics=false ; path=/; max-age=31536000'
43+ document . cookie = 'consent_marketing=false ; path=/; max-age=31536000'
44+ document . cookie = 'consent_functional=false ; path=/; max-age=31536000'
4545
4646 // Clear localStorage
4747 if ( typeof localStorage !== 'undefined' ) {
@@ -51,14 +51,14 @@ export class BasePage extends BuiltInsPage {
5151 } )
5252
5353 const cookieDialog = this . _page . getByRole ( 'dialog' , { name : / c o o k i e c o n s e n t / i } )
54- const allowAllButton = this . _page . getByRole ( 'button' , { name : / a l l o w a l l / i } )
5554
5655 // Wait briefly for the dialog to appear on client-side hydrated pages.
5756 await cookieDialog . waitFor ( { state : 'visible' , timeout : wait . tinyUi } ) . catch ( ( ) => undefined )
5857
5958 if ( await cookieDialog . isVisible ( ) . catch ( ( ) => false ) ) {
60- if ( await allowAllButton . isVisible ( ) . catch ( ( ) => false ) ) {
61- await allowAllButton . click ( { timeout : wait . tinyUi } ) . catch ( ( ) => undefined )
59+ const closeButton = this . _page . getByRole ( 'button' , { name : / c l o s e c o o k i e c o n s e n t / i } )
60+ if ( await closeButton . isVisible ( ) . catch ( ( ) => false ) ) {
61+ await closeButton . click ( { timeout : wait . tinyUi } ) . catch ( ( ) => undefined )
6262 }
6363 }
6464
@@ -119,6 +119,21 @@ export class BasePage extends BuiltInsPage {
119119 window . __disableServiceWorkerForE2E = true
120120 }
121121
122+ // Establish a deterministic consent baseline before any app scripts run.
123+ // GDPR form consent uses the `functional` consent store.
124+ try {
125+ document . cookie = 'consent_analytics=false; path=/; max-age=31536000'
126+ document . cookie = 'consent_marketing=false; path=/; max-age=31536000'
127+ document . cookie = 'consent_functional=false; path=/; max-age=31536000'
128+
129+ if ( typeof localStorage !== 'undefined' ) {
130+ localStorage . removeItem ( 'cookieConsent' )
131+ localStorage . removeItem ( 'gdprConsent' )
132+ }
133+ } catch {
134+ // Ignore failures (e.g. blocked storage in some browser modes)
135+ }
136+
122137 if ( typeof window . __astroPageLoadCounter !== 'number' ) {
123138 window . __astroPageLoadCounter = 0
124139 }
@@ -722,22 +737,6 @@ export class BasePage extends BuiltInsPage {
722737 } )
723738 }
724739
725- /**
726- * ================================================================
727- *
728- * CoPilot-Added Methods
729- *
730- * ================================================================
731- */
732-
733- /**
734- * Verify hero section is present and visible
735- */
736- async expectHeroSection ( ) : Promise < void > {
737- const hero = this . _page . locator ( '[data-component="hero"], section' ) . first ( )
738- await expect ( hero ) . toBeVisible ( )
739- }
740-
741740 /**
742741 * Verify text is visible on the page
743742 */
0 commit comments