From 3ef2becde705958b11c5defff1456096ed4426e0 Mon Sep 17 00:00:00 2001 From: eunjisong Date: Wed, 23 Oct 2024 12:02:05 -0400 Subject: [PATCH 1/2] small fixes --- packages/core-mobile/e2e/pages/createPin.page.ts | 8 ++++---- packages/core-mobile/e2e/pages/send.page.ts | 2 +- packages/core-mobile/e2e/pages/swapTab.page.ts | 4 ++-- .../core-mobile/e2e/tests/settings/changePin.e2e.smoke.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/core-mobile/e2e/pages/createPin.page.ts b/packages/core-mobile/e2e/pages/createPin.page.ts index e57bdaf707..78a04793ff 100644 --- a/packages/core-mobile/e2e/pages/createPin.page.ts +++ b/packages/core-mobile/e2e/pages/createPin.page.ts @@ -86,14 +86,14 @@ class CreatePinPage { } async enterNewCurrentPin() { - while (await Action.isVisible(this.numpadOne, 0)) { + while (await Action.isVisible(this.setNewPinHeader, 0)) { await element(this.numpadOne).multiTap(6) } } - async enterCurrentPin() { - while (await Action.isVisible(this.numpadZero, 0)) { - await element(this.numpadZero).multiTap(6) + async enterCurrentPin(pin = '0') { + while (await Action.isVisible(this.enterYourPinHeader, 0)) { + await element(by.id(pin)).multiTap(6) } } } diff --git a/packages/core-mobile/e2e/pages/send.page.ts b/packages/core-mobile/e2e/pages/send.page.ts index fcedc07a67..95a29c50e3 100644 --- a/packages/core-mobile/e2e/pages/send.page.ts +++ b/packages/core-mobile/e2e/pages/send.page.ts @@ -73,7 +73,7 @@ class SendPage { } async waitForNextBtnEnabled() { - await Actions.waitForElement(this.nextButton, 5000) + await Actions.waitForElementNoSync(this.nextButton, 8000) } async tapMyAccounts() { diff --git a/packages/core-mobile/e2e/pages/swapTab.page.ts b/packages/core-mobile/e2e/pages/swapTab.page.ts index 423d692f78..062bfc2234 100644 --- a/packages/core-mobile/e2e/pages/swapTab.page.ts +++ b/packages/core-mobile/e2e/pages/swapTab.page.ts @@ -76,7 +76,7 @@ class SwapTabPage { } async tapReviewOrderButton(index = 0) { - await Actions.waitForElementNoSync(this.reviewOrderBtn, 8000) + await Actions.waitForElementNoSync(this.reviewOrderBtn, 15000) await Actions.tapElementAtIndex(this.reviewOrderBtn, index) } @@ -123,7 +123,7 @@ class SwapTabPage { await sendPage.selectToken(to) await this.tapReviewOrderButton() try { - await Actions.waitForElement(this.tokenSpendApproval, 5000) + await Actions.waitForElementNoSync(this.tokenSpendApproval, 8000) await this.tapApproveButton() } catch (e) { console.error('Token spend approval not found') diff --git a/packages/core-mobile/e2e/tests/settings/changePin.e2e.smoke.ts b/packages/core-mobile/e2e/tests/settings/changePin.e2e.smoke.ts index 2bf94eb51f..e4922e3292 100644 --- a/packages/core-mobile/e2e/tests/settings/changePin.e2e.smoke.ts +++ b/packages/core-mobile/e2e/tests/settings/changePin.e2e.smoke.ts @@ -24,7 +24,7 @@ describe('Change Pin', () => { it('Should set previous Pin', async () => { await Actions.waitForElement(SecurityAndPrivacyPage.changePin) await SecurityAndPrivacyPage.tapChangePin() - await CreatePinPage.enterNewCurrentPin() + await CreatePinPage.enterCurrentPin('1') await CreatePinPage.createPin() }) }) From 63dd7020129914f74370e29704dfa6da3c333bb7 Mon Sep 17 00:00:00 2001 From: eunjisong Date: Wed, 23 Oct 2024 14:24:51 -0400 Subject: [PATCH 2/2] handle new swap default tokens --- .../core-mobile/app/screens/swap/SwapView.tsx | 2 ++ .../core-mobile/e2e/locators/swapTab.loc.ts | 5 +-- .../core-mobile/e2e/pages/swapTab.page.ts | 32 ++++++++++++------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/packages/core-mobile/app/screens/swap/SwapView.tsx b/packages/core-mobile/app/screens/swap/SwapView.tsx index 69160ac283..32a6731108 100644 --- a/packages/core-mobile/app/screens/swap/SwapView.tsx +++ b/packages/core-mobile/app/screens/swap/SwapView.tsx @@ -180,6 +180,7 @@ export default function SwapView(): JSX.Element { { @@ -218,6 +219,7 @@ export default function SwapView(): JSX.Element { { const tkWithBalance = token as TokenWithBalance diff --git a/packages/core-mobile/e2e/locators/swapTab.loc.ts b/packages/core-mobile/e2e/locators/swapTab.loc.ts index 87e4d621e1..a57828257c 100644 --- a/packages/core-mobile/e2e/locators/swapTab.loc.ts +++ b/packages/core-mobile/e2e/locators/swapTab.loc.ts @@ -3,7 +3,6 @@ export default { avaxSymbol: 'AVAX', usdcToken: 'USD Coin', tokenValueAvax: '0.01', - selectTokenDropdown: 'Select', amountField: 'universal_token_selector__amount_field', from: 'From', reviewOrderBtn: 'review_order_button', @@ -13,5 +12,7 @@ export default { approveBtn: 'approve_button', rejectBtn: 'reject_button', tokenSpendApproval: 'Token Spend Approval', - swapTitle: 'Swap' + swapTitle: 'Swap', + fromTokenSelector: 'from_token_selector', + toTokenSelector: 'to_token_selector' } diff --git a/packages/core-mobile/e2e/pages/swapTab.page.ts b/packages/core-mobile/e2e/pages/swapTab.page.ts index 062bfc2234..7e6abe5be7 100644 --- a/packages/core-mobile/e2e/pages/swapTab.page.ts +++ b/packages/core-mobile/e2e/pages/swapTab.page.ts @@ -11,10 +11,6 @@ import sendPage from './send.page' const platformIndex = Actions.platform() === Platform.Android ? 1 : 0 class SwapTabPage { - get selectTokenDropdown() { - return by.text(swapTab.selectTokenDropdown) - } - get avaxToken() { return by.text(swapTab.avaxToken) } @@ -63,6 +59,14 @@ class SwapTabPage { return by.text(swapTab.swapTitle) } + get fromTokenSelector() { + return by.id(swapTab.fromTokenSelector) + } + + get toTokenSelector() { + return by.id(swapTab.toTokenSelector) + } + async tapAvaxToken() { return Actions.tapElementAtIndex(this.avaxToken, 0) } @@ -70,9 +74,12 @@ class SwapTabPage { async tapUsdcToken() { return Actions.tapElementAtIndex(this.usdcToken, 0) } + async tapFromTokenSelector() { + await Actions.tapElementAtIndex(this.fromTokenSelector, 0) + } - async tapSelectTokenDropdown() { - await Actions.tapElementAtIndex(this.selectTokenDropdown, 0) + async tapToTokenSelector() { + await Actions.tapElementAtIndex(this.toTokenSelector, 0) } async tapReviewOrderButton(index = 0) { @@ -116,11 +123,15 @@ class SwapTabPage { async swap(from: string, to: string, amount = '0.00001') { await bottomTabsPage.tapPlusIcon() await plusMenuPage.tapSwapButton() - await this.tapSelectTokenDropdown() - await sendPage.selectToken(from) + if (from !== 'AVAX') { + await this.tapFromTokenSelector() + await sendPage.selectToken(from) + } + if (to !== 'USDC') { + await this.tapToTokenSelector() + await sendPage.selectToken(to) + } await this.inputTokenAmount(amount) - await this.tapSelectTokenDropdown() - await sendPage.selectToken(to) await this.tapReviewOrderButton() try { await Actions.waitForElementNoSync(this.tokenSpendApproval, 8000) @@ -134,7 +145,6 @@ class SwapTabPage { async verifySwapScreen() { await Actions.waitForElement(this.swapTitle) - await Actions.waitForElement(this.selectTokenDropdown) await Actions.waitForElement(this.disabledReviewOrderBtn) } }