From bbbf5b5a0c275a831c10671417798fc95876de33 Mon Sep 17 00:00:00 2001 From: d4vidi Date: Tue, 21 May 2024 17:42:10 +0300 Subject: [PATCH] Revert "Unify e2e tests back; Settle on withAncestor()" This reverts commit f7b71215d8baedb2b22e668eae4f41b28e967044. --- e2e/Stack.test.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/e2e/Stack.test.js b/e2e/Stack.test.js index 028852d592..e7c371b1b0 100644 --- a/e2e/Stack.test.js +++ b/e2e/Stack.test.js @@ -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'), }, }; @@ -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 () => { @@ -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();