@@ -14,10 +14,12 @@ const driver = {
14
14
} ,
15
15
16
16
titleWithSubtitle : {
17
- title : ( ) => element ( by . id ( `${ TestIDs . TOPBAR_ID } .title` ) . withAncestor ( by . id ( TestIDs . TOPBAR_ID ) ) ) ,
18
- titleByText : ( ) => element ( by . text ( 'Title' ) . withAncestor ( by . id ( TestIDs . TOPBAR_ID ) ) ) ,
19
- subtitle : ( ) => element ( by . id ( `${ TestIDs . TOPBAR_ID } .subtitle` ) . withAncestor ( by . id ( TestIDs . TOPBAR_ID ) ) ) ,
20
- subtitleByText : ( ) => element ( by . text ( 'Subtitle' ) . withAncestor ( by . id ( TestIDs . TOPBAR_ID ) ) ) ,
17
+ titleId : `${ TestIDs . TOPBAR_ID } .title` ,
18
+ subtitleId : `${ TestIDs . TOPBAR_ID } .subtitle` ,
19
+ title : ( ) => elementById ( driver . titleWithSubtitle . titleId ) ,
20
+ titleByLabel : ( ) => elementByLabel ( 'Title' ) ,
21
+ subtitle : ( ) => elementById ( driver . titleWithSubtitle . subtitleId ) ,
22
+ subtitleByLabel : ( ) => elementByLabel ( 'Subtitle' ) ,
21
23
} ,
22
24
} ;
23
25
@@ -96,8 +98,8 @@ describe('Stack', () => {
96
98
97
99
it ( 'push title with subtitle' , async ( ) => {
98
100
const innerDriver = await driver . root . navToTitleAndSubtitle ( ) ;
99
- await expect ( innerDriver . titleByText ( ) ) . toBeVisible ( ) ;
100
- await expect ( innerDriver . subtitleByText ( ) ) . toBeVisible ( ) ;
101
+ await expect ( innerDriver . titleByLabel ( ) ) . toBeVisible ( ) ;
102
+ await expect ( innerDriver . subtitleByLabel ( ) ) . toBeVisible ( ) ;
101
103
} ) ;
102
104
103
105
it ( 'push title & subtitle with derived test IDs' , async ( ) => {
@@ -106,6 +108,16 @@ describe('Stack', () => {
106
108
await expect ( innerDriver . subtitle ( ) ) . toBeVisible ( ) ;
107
109
} ) ;
108
110
111
+ it . e2e ( 'push title & subtitle with derived test IDs (strict e2e)' , async ( ) => {
112
+ const innerDriver = await driver . root . navToTitleAndSubtitle ( ) ;
113
+
114
+ const titleAttr = await innerDriver . titleByLabel ( ) . getAttributes ( ) ;
115
+ jestExpect ( titleAttr . identifier ) . toEqual ( innerDriver . titleId ) ;
116
+
117
+ const subtitleAttr = await innerDriver . subtitleByLabel ( ) . getAttributes ( ) ;
118
+ jestExpect ( subtitleAttr . identifier ) . toEqual ( innerDriver . subtitleId ) ;
119
+ } ) ;
120
+
109
121
it . e2e ( 'screen lifecycle' , async ( ) => {
110
122
await elementById ( TestIDs . PUSH_LIFECYCLE_BTN ) . tap ( ) ;
111
123
await expect ( elementByLabel ( 'didAppear' ) ) . toBeVisible ( ) ;
0 commit comments