Skip to content

Commit d1d244b

Browse files
committed
Revert "Unify e2e tests back; Settle on withAncestor()"
This reverts commit f7b7121.
1 parent a191d0d commit d1d244b

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

e2e/Stack.test.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ const driver = {
1414
},
1515

1616
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'),
2123
},
2224
};
2325

@@ -96,8 +98,8 @@ describe('Stack', () => {
9698

9799
it('push title with subtitle', async () => {
98100
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();
101103
});
102104

103105
it('push title & subtitle with derived test IDs', async () => {
@@ -106,6 +108,16 @@ describe('Stack', () => {
106108
await expect(innerDriver.subtitle()).toBeVisible();
107109
});
108110

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+
109121
it.e2e('screen lifecycle', async () => {
110122
await elementById(TestIDs.PUSH_LIFECYCLE_BTN).tap();
111123
await expect(elementByLabel('didAppear')).toBeVisible();

0 commit comments

Comments
 (0)