Skip to content

Commit

Permalink
test(e2e): enable more tests on android with getAttribute changes (#5387
Browse files Browse the repository at this point in the history
)

### 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
  • Loading branch information
MuckT committed May 7, 2024
1 parent 6df3859 commit 4b73685
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 5 additions & 4 deletions e2e/src/HomeFeed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions e2e/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 4b73685

Please sign in to comment.