@@ -11,45 +11,40 @@ const pressBack = async () => {
1111} ;
1212
1313const awaitClassicalEventBehavior = async ( ) => {
14- if ( device . getPlatform ( ) === 'ios' ) {
15- // The order of events in this test differs from Paper.
16- // Please see https://github.com/software-mansion/react-native-screens/pull/2785 for details.
17- await expect (
18- element ( by . text ( '9. Chats | transitionStart | closing' ) ) ,
19- ) . toExist ( ) ;
20- await expect (
21- element ( by . text ( '10. Privacy | transitionStart | closing' ) ) ,
22- ) . toExist ( ) ;
23- await expect (
24- element ( by . text ( '11. Main | transitionStart | opening' ) ) ,
25- ) . toExist ( ) ;
26- await expect ( element ( by . text ( '12. Privacy | beforeRemove' ) ) ) . toExist ( ) ;
27- await expect ( element ( by . text ( '13. Chats | beforeRemove' ) ) ) . toExist ( ) ;
28- await expect (
29- element ( by . text ( '14. Chats | transitionEnd | closing' ) ) ,
30- ) . toExist ( ) ;
31- await expect (
32- element ( by . text ( '15. Privacy | transitionEnd | closing' ) ) ,
33- ) . toExist ( ) ;
34- await expect (
35- element ( by . text ( '16. Main | transitionEnd | opening' ) ) ,
36- ) . toExist ( ) ;
37- } else {
38- await expect ( element ( by . text ( '9. Privacy | beforeRemove' ) ) ) . toExist ( ) ;
39- await expect ( element ( by . text ( '10. Chats | beforeRemove' ) ) ) . toExist ( ) ;
40- await expect (
41- element ( by . text ( '11. Main | transitionStart | opening' ) ) ,
42- ) . toExist ( ) ;
43- await expect (
44- element ( by . text ( '12. Main | transitionEnd | opening' ) ) ,
45- ) . toExist ( ) ;
14+ // The order of events in this test differs from Paper.
15+ // Please see https://github.com/software-mansion/react-native-screens/pull/2785 for details.
16+ const expectedEvents =
17+ device . getPlatform ( ) === 'ios'
18+ ? [
19+ '9. Chats | transitionStart | closing' ,
20+ '10. Privacy | transitionStart | closing' ,
21+ '11. Main | transitionStart | opening' ,
22+ '12. Privacy | beforeRemove' ,
23+ '13. Chats | beforeRemove' ,
24+ '14. Chats | transitionEnd | closing' ,
25+ '15. Privacy | transitionEnd | closing' ,
26+ '16. Main | transitionEnd | opening' ,
27+ ]
28+ : [
29+ '9. Privacy | beforeRemove' ,
30+ '10. Chats | beforeRemove' ,
31+ '11. Main | transitionStart | opening' ,
32+ '12. Main | transitionEnd | opening' ,
33+ ] ;
34+
35+ // Wait for the last event to appear before asserting event order
36+ await waitFor ( element ( by . text ( expectedEvents . at ( - 1 ) ! ) ) )
37+ . toExist ( )
38+ . withTimeout ( 5000 ) ;
39+
40+ for ( const expectedEventNotification of expectedEvents ) {
41+ await expect ( element ( by . text ( expectedEventNotification ) ) ) . toExist ( ) ;
4642 }
4743} ;
4844
4945describe ( 'Events' , ( ) => {
5046 beforeEach ( async ( ) => {
5147 await device . reloadReactNative ( ) ;
52- // await device.launchApp({ newInstance: true });
5348
5449 await waitFor ( element ( by . id ( 'root-screen-playground-Events' ) ) )
5550 . toBeVisible ( )
0 commit comments