Skip to content

Commit

Permalink
Revert "Unify e2e tests back; Settle on withAncestor()"
Browse files Browse the repository at this point in the history
This reverts commit f7b7121.
  • Loading branch information
d4vidi committed May 21, 2024
1 parent f400650 commit bbbf5b5
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions e2e/Stack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ const driver = {
},

titleWithSubtitle: {
title: () => element(by.id(`${TestIDs.TOPBAR_ID}.title`).withAncestor(by.id(TestIDs.TOPBAR_ID))),
titleByText: () => element(by.text('Title').withAncestor(by.id(TestIDs.TOPBAR_ID))),
subtitle: () => element(by.id(`${TestIDs.TOPBAR_ID}.subtitle`).withAncestor(by.id(TestIDs.TOPBAR_ID))),
subtitleByText: () => element(by.text('Subtitle').withAncestor(by.id(TestIDs.TOPBAR_ID))),
titleId: `${TestIDs.TOPBAR_ID}.title`,
subtitleId: `${TestIDs.TOPBAR_ID}.subtitle`,
title: () => elementById(driver.titleWithSubtitle.titleId),
titleByLabel: () => elementByLabel('Title'),
subtitle: () => elementById(driver.titleWithSubtitle.subtitleId),
subtitleByLabel: () => elementByLabel('Subtitle'),
},
};

Expand Down Expand Up @@ -96,8 +98,8 @@ describe('Stack', () => {

it('push title with subtitle', async () => {
const innerDriver = await driver.root.navToTitleAndSubtitle();
await expect(innerDriver.titleByText()).toBeVisible();
await expect(innerDriver.subtitleByText()).toBeVisible();
await expect(innerDriver.titleByLabel()).toBeVisible();
await expect(innerDriver.subtitleByLabel()).toBeVisible();
});

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

it.e2e('push title & subtitle with derived test IDs (strict e2e)', async () => {
const innerDriver = await driver.root.navToTitleAndSubtitle();

const titleAttr = await innerDriver.titleByLabel().getAttributes();
jestExpect(titleAttr.identifier).toEqual(innerDriver.titleId);

const subtitleAttr = await innerDriver.subtitleByLabel().getAttributes();
jestExpect(subtitleAttr.identifier).toEqual(innerDriver.subtitleId);
});

it.e2e('screen lifecycle', async () => {
await elementById(TestIDs.PUSH_LIFECYCLE_BTN).tap();
await expect(elementByLabel('didAppear')).toBeVisible();
Expand Down

0 comments on commit bbbf5b5

Please sign in to comment.