Skip to content

Commit

Permalink
QA - fix automation (#2189)
Browse files Browse the repository at this point in the history
  • Loading branch information
eunjisong authored Jan 14, 2025
1 parent c033e5b commit 994a2ca
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 34 deletions.
3 changes: 2 additions & 1 deletion packages/core-mobile/e2e/locators/Stake/stakeScreen.loc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ export default {
customBaseFee: 'custom_base_fee',
slowBaseFee: 'slow_base_fee',
fastBaseFee: 'fast_base_fee',
instantBaseFee: 'instant_base_fee'
instantBaseFee: 'instant_base_fee',
durationScreenTitle: 'Duration'
}
3 changes: 2 additions & 1 deletion packages/core-mobile/e2e/locators/connectToSite.loc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export default {
signMessage: 'Sign Message',
accountCheckBox: 'account_check_box',
selectAccounts: 'Select Accounts',
selectAccountsId: 'select_accounts'
selectAccountsId: 'select_accounts',
connectWalletTitle: 'Connect Wallet?'
}
2 changes: 1 addition & 1 deletion packages/core-mobile/e2e/locators/send.loc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
avaxToken: 'AVAX',
ethToken: 'ETH',
btcToken: 'BTC',
sendingAmount: '0.000001',
sendingAmount: '0.00001',
myAccounts: 'My Accounts',
nextBtn: 'next_btn',
sendTitle: 'Send',
Expand Down
1 change: 1 addition & 0 deletions packages/core-mobile/e2e/pages/Stake/duration.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class DurationPage {
}

async verifyDurationScreenItems(devnet: boolean) {
await Actions.waitForElement(this.durationDescription, 30000)
await Assert.isVisible(this.durationTitle)
await Assert.isVisible(this.durationDescription)
await Assert.isVisible(this.nextButton, 0)
Expand Down
34 changes: 5 additions & 29 deletions packages/core-mobile/e2e/pages/Stake/stake.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ class StakePage {
return by.id(stakeScreenLoc.customBaseFee)
}

get durationScreenTitle() {
return by.text(stakeScreenLoc.durationScreenTitle)
}

async tapActiveTab() {
await Actions.tap(this.activeTab)
}
Expand Down Expand Up @@ -513,6 +517,7 @@ class StakePage {
await this.tapNextButton()
await this.inputStakingAmount(amount)
await this.tapNextButton()
await Actions.waitForElement(this.durationScreenTitle, 30000)
if (custom) {
await Actions.tap(this.customRadio)
await Actions.tap(commonElsPage.calendarSVG)
Expand All @@ -535,40 +540,11 @@ class StakePage {
}
await this.tapNextButton()
await Actions.waitForElementNoSync(this.stakeNow, 30000)
await this.selectRandomDynamicFee()
await this.tapStakeNow()
}

async selectRandomDynamicFee() {
const feeOptions = [
this.slowBaseFee,
this.fastBaseFee,
this.instantBaseFee,
this.customBaseFee
]
const randomIndex = Actions.getRandomIndex(feeOptions.length)
const selectedFeeOption = feeOptions[randomIndex] as Detox.NativeMatcher

await Actions.tap(selectedFeeOption)

// If the selected fee option is custom, set the fee to the instant fee
if (randomIndex === 3) {
const instantFeeText = (await Actions.getElementText(
this.instantBaseFee
)) as string
await Actions.waitForElementNoSync(this.instantBaseFee)
await Actions.setInputText(this.customFeeInput, instantFeeText)
await Actions.tap(this.customSaveBtn)
}
}

async verifyStakeSuccessToast() {
await Actions.waitForElement(this.stakingSuccessful, 60000, 0)
try {
await this.tapNotNowButton()
} catch (e) {
console.log('No stake notification prompt is displayed')
}
await delay(5000)
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/core-mobile/e2e/pages/browser.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class BrowserPage {
default: // core app
xpath = '//*[text()="WalletConnect"]'
}
await delay(2000)
await Wbs.waitForEleByXpathToBeVisible(xpath, 10000)
await Wbs.tapByXpath(xpath)
}
Expand Down
5 changes: 5 additions & 0 deletions packages/core-mobile/e2e/pages/connectToSite.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class ConnectToSite {
return by.id(connectToSiteLoc.selectAccountsId)
}

get connectWalletTitle() {
return by.text(connectToSiteLoc.connectWalletTitle)
}

async tapPlusIcon() {
if (Action.platform() === 'ios') {
await Action.tapElementAtIndex(this.plusIcon, 1)
Expand Down Expand Up @@ -70,6 +74,7 @@ class ConnectToSite {

async selectAccountAndconnect() {
await Action.waitForElement(this.selectAccountsId, 25000)
await Action.waitForElement(this.connectWalletTitle, 25000)
await this.tapSelectAccounts()
await this.tapAccountCheckBox()
await this.tapApproveBtn()
Expand Down
4 changes: 2 additions & 2 deletions packages/core-mobile/e2e/tests/stake/stakingTestnet.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BottomTabsPage from '../../pages/bottomTabs.page'
import { warmup } from '../../helpers/warmup'
import StakePage from '../../pages/Stake/stake.page'
import ClaimPage from '../../pages/Stake/claim.page'
import { cleanup } from '../../helpers/cleanup'
import advancedPage from '../../pages/burgerMenu/advanced.page'

describe('Stake on Testnet', () => {
beforeAll(async () => {
Expand All @@ -13,7 +13,7 @@ describe('Stake on Testnet', () => {
})

afterAll(async () => {
await cleanup()
await advancedPage.switchToMainnet()
})
const duration = Actions.getRandomEle([
'1 Day',
Expand Down

0 comments on commit 994a2ca

Please sign in to comment.