Skip to content

Commit

Permalink
test(e2e): run all tests against tab navigator (valora-inc#5325)
Browse files Browse the repository at this point in the history
### Description

As part of removing the drawer nav, run all e2e tests against the tab
navigator and remove drawer nav specific tests. WalletConenct test still
runs against drawer because it uses openUrl to launch app and there
isn't an easy way to specify a launchArg

### Test plan

CI

### Related issues

- Part of ACT-1133

### Backwards compatibility

Yes

### Network scalability

Yes
  • Loading branch information
satish-ravi authored and shottah committed May 15, 2024
1 parent ce78e9a commit f679506
Show file tree
Hide file tree
Showing 22 changed files with 121 additions and 440 deletions.
7 changes: 2 additions & 5 deletions e2e/src/AccountManagement.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ describe('Account', () => {
})

describe('Support', Support)
describe.each([{ navType: 'drawer' }, { navType: 'tab' }])('Settings ($navType)', Settings)
describe.each([{ navType: 'drawer' }, { navType: 'tab' }])(
'Reset Account ($navType)',
ResetAccount
)
describe('Settings', Settings)
describe('Reset Account', ResetAccount)
})
2 changes: 0 additions & 2 deletions e2e/src/AccountSetup.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import ChooseYourAdventure from './usecases/ChooseYourAdventure'
import NewAccountOnboarding from './usecases/NewAccountOnboarding'
import NewAccountOnboardingDrawer from './usecases/NewAccountOnboardingDrawer'
import RestoreAccountOnboarding from './usecases/RestoreAccountOnboarding'

describe('Account Setup', () => {
describe('New Account', NewAccountOnboarding)
describe('New Account Drawer', NewAccountOnboardingDrawer)
describe('Restore', RestoreAccountOnboarding)
describe('Choose Your Adventure', ChooseYourAdventure)
})
3 changes: 0 additions & 3 deletions e2e/src/Assets.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import Assets from './usecases/Assets'
import AssetsDrawer from './usecases/AssetsDrawer'

describe('Assets', Assets)

describe('Assets drawer', AssetsDrawer)
11 changes: 7 additions & 4 deletions e2e/src/CeloPage.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import CeloEducation from './usecases/CeloEducation'
import PriceChart from './usecases/PriceChart'
import CeloNews from './usecases/CeloNews'
import { quickOnboarding, waitForElementByIdAndTap } from './utils/utils'
import { celoEducation } from './utils/celoEducation'
import { quickOnboarding } from './utils/utils'
import { launchApp } from './utils/retries'

describe('Celo page', () => {
beforeAll(async () => {
// TODO(ACT-1133): remove launchApp once drawer nav is removed
await launchApp({
newInstance: true,
launchArgs: { statsigGateOverrides: 'use_tab_navigator=true' },
})
await quickOnboarding()
await waitForElementByIdAndTap('Hamburger')
await waitForElementByIdAndTap('CELO')
})

describe('celo education', CeloEducation)
Expand Down
16 changes: 0 additions & 16 deletions e2e/src/DappList.spec.js

This file was deleted.

88 changes: 43 additions & 45 deletions e2e/src/HomeFeed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,47 @@ beforeAll(async () => {
})

// iOS only as getAttributes on multiple elements is not supported on Android
describe.each([{ navType: 'drawer' }, { navType: 'tabs' }])(
':ios: Home Feed - $navType',
({ navType }) => {
beforeAll(async () => {
await launchApp({
newInstance: true,
permissions: { notifications: 'YES', contacts: 'YES', camera: 'YES' },
launchArgs: { statsigGateOverrides: `use_tab_navigator=${navType === 'tabs'}` },
})
describe(':ios: Home Feed', () => {
// TODO(ACT-1133): remove this beforeAll when drawer nav is removed
beforeAll(async () => {
await launchApp({
newInstance: true,
permissions: { notifications: 'YES', contacts: 'YES', camera: 'YES' },
launchArgs: { statsigGateOverrides: `use_tab_navigator=true` },
})

it('should show correct information on tap of feed item', async () => {
// Load Wallet Home
await waitForElementId('WalletHome')
const items = await element(by.id('TransferFeedItem')).getAttributes()

// Tap top TransferFeedItem
await element(by.id('TransferFeedItem')).atIndex(0).tap()

// Assert on text based on elements returned earlier
const address = items.elements[0].label.split(' ')[0]
const amount = items.elements[0].label.match(/(\d+\.\d+)/)[1]
await expect(element(by.text(address)).atIndex(0)).toBeVisible()
await expect(element(by.text(`$${amount}`)).atIndex(0)).toBeVisible()
})

it('should load more items on scroll', async () => {
// Tap back button if present form previous test
try {
await element(by.id('BackChevron')).tap()
} catch {}

// Load Wallet Home
await waitForElementId('WalletHome')
const startingItems = await element(by.id('TransferFeedItem')).getAttributes()

// Scroll to bottom
await element(by.id('WalletHome/SectionList')).scrollTo('bottom')
await sleep(5000)

// Compare initial number of items to new number of items after scroll
const endingItems = await element(by.id('TransferFeedItem')).getAttributes()
jestExpect(endingItems.elements.length).toBeGreaterThan(startingItems.elements.length)
})
}
)
})

it('should show correct information on tap of feed item', async () => {
// Load Wallet Home
await waitForElementId('WalletHome')
const items = await element(by.id('TransferFeedItem')).getAttributes()

// Tap top TransferFeedItem
await element(by.id('TransferFeedItem')).atIndex(0).tap()

// Assert on text based on elements returned earlier
const address = items.elements[0].label.split(' ')[0]
const amount = items.elements[0].label.match(/(\d+\.\d+)/)[1]
await expect(element(by.text(address)).atIndex(0)).toBeVisible()
await expect(element(by.text(`$${amount}`)).atIndex(0)).toBeVisible()
})

it('should load more items on scroll', async () => {
// Tap back button if present form previous test
try {
await element(by.id('BackChevron')).tap()
} catch {}

// Load Wallet Home
await waitForElementId('WalletHome')
const startingItems = await element(by.id('TransferFeedItem')).getAttributes()

// Scroll to bottom
await element(by.id('WalletHome/SectionList')).scrollTo('bottom')
await sleep(5000)

// Compare initial number of items to new number of items after scroll
const endingItems = await element(by.id('TransferFeedItem')).getAttributes()
jestExpect(endingItems.elements.length).toBeGreaterThan(startingItems.elements.length)
})
})
36 changes: 17 additions & 19 deletions e2e/src/Pin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ import PINRequire from './usecases/PINRequire'
import { launchApp } from './utils/retries'
import { quickOnboarding } from './utils/utils'

describe.each([{ navType: 'drawer' }, { navType: 'tab' }])(
'Given PIN (Navigation type: $navType)',
({ navType }) => {
beforeEach(async () => {
await device.uninstallApp()
await device.installApp()
await launchApp({
newInstance: true,
permissions: { notifications: 'YES', contacts: 'YES' },
launchArgs: { statsigGateOverrides: `use_tab_navigator=${navType === 'tab'}` },
})
await quickOnboarding()
describe('Given PIN', () => {
beforeEach(async () => {
await device.uninstallApp()
await device.installApp()
await launchApp({
newInstance: true,
permissions: { notifications: 'YES', contacts: 'YES' },
// TODO(ACT-1133): remove launchArgs
launchArgs: { statsigGateOverrides: `use_tab_navigator=true` },
})
await quickOnboarding()
})

afterAll(async () => {
await device.uninstallApp()
})
afterAll(async () => {
await device.uninstallApp()
})

describe('When Requiring Pin', PINRequire(navType))
describe('When Changing Pin', PINChange(navType))
}
)
describe('When Requiring Pin', PINRequire)
describe('When Changing Pin', PINChange)
})
47 changes: 0 additions & 47 deletions e2e/src/usecases/AssetsDrawer.js

This file was deleted.

19 changes: 11 additions & 8 deletions e2e/src/usecases/CeloEducation.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const progressButtonCheck = async (text = 'Next', timeout = 10 * 1000) => {
}

export default CeloEducation = () => {
beforeEach(async () => {
// If we end up on the ExchangeHomeScreen, we need to navigate back to the Celo screen
try {
await element(by.id('ExchangeHomeScreen/Info')).tap()
} catch {}
await waitForElementId('Education')
beforeAll(async () => {
await waitForElementByIdAndTap('WalletHome/NotificationBell')
await waitForElementId('NotificationView/celo_asset_education')
await element(
by.text('Learn More').withAncestor(by.id('NotificationView/celo_asset_education'))
).tap()
})

it('should be able to navigate with swipes', async () => {
Expand All @@ -53,11 +53,14 @@ export default CeloEducation = () => {

it('should be able to close CELO education carousel', async () => {
await waitForElementByIdAndTap('Education/CloseIcon')
await waitForElementId('ExchangeHomeScreen/Info')
await waitForElementId('NotificationView/celo_asset_education')
})

it('should be able to complete CELO education carousel', async () => {
await element(
by.text('Learn More').withAncestor(by.id('NotificationView/celo_asset_education'))
).tap()
await celoEducation()
await waitForElementId('ExchangeHomeScreen')
await waitForElementId('Tab/Home')
})
}
72 changes: 0 additions & 72 deletions e2e/src/usecases/DappListRecent.js

This file was deleted.

2 changes: 1 addition & 1 deletion e2e/src/usecases/NewAccountOnboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default NewAccountOnboarding = () => {
await element(by.id('WalletHome/NotificationBell')).tap()
await expect(element(by.text('Back up now'))).not.toExist()
await element(by.id('BackChevron')).tap()
await navigateToSettings('tab')
await navigateToSettings()
await waitForElementId('RecoveryPhrase')
await element(by.id('RecoveryPhrase')).tap()
await enterPinUi()
Expand Down
Loading

0 comments on commit f679506

Please sign in to comment.