Skip to content

Commit

Permalink
test(e2e): use impactMarket in dapp tests (#3937)
Browse files Browse the repository at this point in the history
### Description

Specifies [impactMarket](https://www.impactmarket.com/) as the dapp
tested in the recent dapp flow. Bidali became the dapp at the top of
list replacing Ubeswap when many dapps were disabled in
valora-inc/dapp-list#469 and due to it's unique
flow the tests started failing.

### Test plan

Tested locally on iOS and both Android and iOS with CI.

### Related issues

N/A

### Backwards compatibility

Yes
  • Loading branch information
MuckT authored Jul 6, 2023
1 parent e9bd94c commit f470fad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
18 changes: 13 additions & 5 deletions e2e/src/usecases/DappListDisplay.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { fetchDappList, navigateToDappList } from '../utils/dappList'
import { reloadReactNative } from '../utils/retries'
import { getElementText, getElementTextList, sleep, waitForElementId } from '../utils/utils'
import { getElementTextList, sleep, waitForElementId } from '../utils/utils'

jestExpect = require('expect')

export default DappListDisplay = () => {
let dappList = null
let dappToTest = null

beforeAll(async () => {
dappList = await fetchDappList()
dappToTest = {
dapp: dappList.applications.find((dapp) => dapp.id === 'impactmarket'),
index: dappList.applications
.filter((dapp) => dapp[device.getPlatform() === 'ios' ? 'listOnIos' : 'listOnAndroid'])
.findIndex((dapp) => dapp.id === 'impactmarket'),
}
})

it('should show dapp info icon and subsequent modal', async () => {
Expand All @@ -32,19 +40,19 @@ export default DappListDisplay = () => {
})

it('should show dapp bottom sheet when dapp is selected', async () => {
await element(by.id('DappCard')).atIndex(0).tap()
await element(by.id('DappCard')).atIndex(dappToTest.index).tap()
await waitForElementId('ConfirmDappButton')
await waitFor(element(by.text(`Go to ${dappList.applications[0].name}`)))
await waitFor(element(by.text(`Go to ${dappToTest.dapp.name}`)))
.toBeVisible()
.withTimeout(10 * 1000)
})

it('should open internal webview with correct dapp when dapp opened', async () => {
await element(by.id('ConfirmDappButton')).tap()
await waitFor(element(by.id(`WebViewScreen/${dappList.applications[0].name}`)))
await waitFor(element(by.id(`WebViewScreen/${dappToTest.dapp.name}`)))
.toBeVisible()
.withTimeout(10 * 1000)
const url = new URL(dappList.applications[0].url)
const url = new URL(dappToTest.dapp.url)
// Should show correct hostname in webview
await waitFor(element(by.text(url.hostname)))
.toBeVisible()
Expand Down
8 changes: 5 additions & 3 deletions e2e/src/usecases/DappListRecent.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default DappListRecent = () => {

// Scroll to first dapp or next after most recent dapp
await scrollToDapp(startRecentDappCount + 1)
await element(by.id('DappCard')).atIndex(startRecentDappCount).tap()
// The E2E test wallet always receives a non-shuffled dapp list which is controlled by Statsig
// Unless Bidali or impactMarket are removed impactMarket will always be second in the list
await element(by.text('impactMarket')).tap()

// Get dapp name in confirmation dialog
const dappPressed = await element(by.id('ConfirmDappButton')).getAttributes()
Expand Down Expand Up @@ -57,8 +59,8 @@ export default DappListRecent = () => {
// Navigate to DappList reload and navigate again - ci issue
await navigateToDappList()

// Scroll doesn't work well for android so we just tap the first dapp
await element(by.id('DappCard')).atIndex(0).tap()
// Scroll doesn't work well for android so we just tap the second dapp
await element(by.id('DappCard')).atIndex(1).tap()

// Get dapp name in confirmation dialog
const dappPressed = await element(by.id('ConfirmDappTitle')).getAttributes()
Expand Down

0 comments on commit f470fad

Please sign in to comment.