From 4b73685598e9b5b640adc0381900327afbfab289 Mon Sep 17 00:00:00 2001 From: Tom McGuire Date: Tue, 7 May 2024 09:26:47 -0700 Subject: [PATCH] test(e2e): enable more tests on android with getAttribute changes (#5387) ### Description With the recent upgrade to Detox in #5375 [`getAttributes()`](https://wix.github.io/Detox/docs/api/actions#getattributes) now works with multiple elements on Android. With this change more tests that previously only ran on iOS can now be run on Android. ### Test plan - [x] Tested locally on Android - [x] Tested in CI ### Related issues N/A ### Backwards compatibility Yes ### Network scalability N/A --- e2e/src/HomeFeed.spec.js | 9 +++++---- e2e/src/utils/utils.js | 9 +++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/e2e/src/HomeFeed.spec.js b/e2e/src/HomeFeed.spec.js index 6cc2d1cccd4..228be8ec749 100644 --- a/e2e/src/HomeFeed.spec.js +++ b/e2e/src/HomeFeed.spec.js @@ -6,8 +6,7 @@ beforeAll(async () => { await quickOnboarding() }) -// iOS only as getAttributes on multiple elements is not supported on Android -describe(':ios: Home Feed', () => { +describe('Home Feed', () => { it('should show correct information on tap of feed item', async () => { // Load Wallet Home await waitForElementId('WalletHome') @@ -33,8 +32,10 @@ describe(':ios: Home Feed', () => { await waitForElementId('WalletHome') const startingItems = await element(by.id('TransferFeedItem')).getAttributes() - // Scroll to bottom - await element(by.id('WalletHome/SectionList')).scrollTo('bottom') + // Scroll to bottom - Android will scroll forever so we set a static value + device.getPlatform() === 'ios' + ? await element(by.id('WalletHome/SectionList')).scrollTo('bottom') + : await element(by.id('WalletHome/SectionList')).scroll(2000, 'down') await sleep(5000) // Compare initial number of items to new number of items after scroll diff --git a/e2e/src/utils/utils.js b/e2e/src/utils/utils.js index 720f5754b38..70ab23984f0 100644 --- a/e2e/src/utils/utils.js +++ b/e2e/src/utils/utils.js @@ -344,12 +344,9 @@ export async function confirmTransaction(commentText) { .toBeVisible() .withTimeout(60 * 1000) - // getAttributes() for multiple elements only supported on iOS for Detox < 20.12.0 - if (device.getPlatform() === 'ios') { - // Comment should be present in the feed - const { elements } = await element(by.id('TransferFeedItem/subtitle')).getAttributes() - jestExpect(elements.some((element) => element.text === commentText)).toBeTruthy() - } + // Comment should be present in the feed + const { elements } = await element(by.id('TransferFeedItem/subtitle')).getAttributes() + jestExpect(elements.some((element) => element.text === commentText)).toBeTruthy() // Scroll to transaction await waitFor(element(by.text(commentText)))