@@ -23,14 +23,6 @@ const IOS_MODE = 'ionic:mode=ios';
2323 */
2424test . describe ( 'ionPage outlet swipe-to-go-back' , ( ) => {
2525 test ( 'section-a content should be visible during swipe-back from section-b' , async ( { page } ) => {
26- page . on ( 'console' , ( msg ) => {
27- const text = msg . text ( ) ;
28- if ( text . startsWith ( '[SwipeBack' ) || text . startsWith ( '[HideIonPageElement]' ) ) {
29- // eslint-disable-next-line no-console
30- console . log ( 'PAGE:' , text ) ;
31- }
32- } ) ;
33-
3426 // Navigate to modal-aria-hidden test page (has sibling ionPage outlets)
3527 await page . goto ( `/modal-aria-hidden?${ IOS_MODE } ` ) ;
3628 await ionPageVisible ( page , 'modal-page-a' ) ;
@@ -41,41 +33,26 @@ test.describe('ionPage outlet swipe-to-go-back', () => {
4133 await page . locator ( '#navigateToB' ) . click ( ) ;
4234 await ionPageVisible ( page , 'modal-page-b' ) ;
4335
44- // Pre-swipe: dump section-a state
45- const preSwipe = await page . locator ( '#section-a' ) . evaluate ( ( el : HTMLElement ) => ( {
46- inlineDisplay : el . style . display ,
47- hasHiddenClass : el . classList . contains ( 'ion-page-hidden' ) ,
48- ariaHidden : el . getAttribute ( 'aria-hidden' ) ,
49- classList : Array . from ( el . classList ) ,
50- computedDisplay : getComputedStyle ( el ) . display ,
51- } ) ) ;
52- // eslint-disable-next-line no-console
53- console . log ( 'PRE_SWIPE section-a:' , JSON . stringify ( preSwipe ) ) ;
36+ // Wait for the forward-transition to fully commit before starting the swipe.
37+ // ionPageVisible resolves as soon as the entering page-b clears its hidden
38+ // state, which can fire before the parent outlet's animation completes. On
39+ // slower runners (CI), the parent animation was still in flight when the
40+ // swipe mouse events were dispatched, so the swipe-back gesture never
41+ // started and section-a was then hidden by the tail of the forward commit.
42+ // Waiting for section-a to actually carry `ion-page-hidden` guarantees the
43+ // forward transition is done and the gesture can take over cleanly.
44+ await page . locator ( '#section-a.ion-page-hidden' ) . waitFor ( { state : 'attached' } ) ;
5445
5546 // Start a swipe-back gesture and hold mid-way
5647 const outlet = page . locator ( 'ion-router-outlet#modal-aria-hidden-root' ) ;
5748 const box = await outlet . boundingBox ( ) ;
5849 if ( ! box ) throw new Error ( 'Root outlet not found' ) ;
59- // eslint-disable-next-line no-console
60- console . log ( 'OUTLET_BOX:' , JSON . stringify ( box ) ) ;
6150
6251 await page . mouse . move ( box . x , box . y + box . height / 2 ) ;
6352 await page . mouse . down ( ) ;
6453 await page . mouse . move ( box . x + box . width / 2 , box . y + box . height / 2 , { steps : 10 } ) ;
6554 await page . waitForTimeout ( 300 ) ;
6655
67- // Post-swipe: dump section-a state before the assertion
68- const postSwipe = await page . locator ( '#section-a' ) . evaluate ( ( el : HTMLElement ) => ( {
69- inlineDisplay : el . style . display ,
70- hasHiddenClass : el . classList . contains ( 'ion-page-hidden' ) ,
71- ariaHidden : el . getAttribute ( 'aria-hidden' ) ,
72- classList : Array . from ( el . classList ) ,
73- computedDisplay : getComputedStyle ( el ) . display ,
74- outerBounds : el . getBoundingClientRect ( ) . toJSON ( ) ,
75- } ) ) ;
76- // eslint-disable-next-line no-console
77- console . log ( 'POST_SWIPE section-a:' , JSON . stringify ( postSwipe ) ) ;
78-
7956 // Mid-swipe: section-a should be visible (not display:none) with its child content
8057 const sectionA = page . locator ( '#section-a' ) ;
8158 const computedDisplay = await sectionA . evaluate ( ( el : HTMLElement ) => getComputedStyle ( el ) . display ) ;
0 commit comments