-
Notifications
You must be signed in to change notification settings - Fork 476
[LWDM] detox evm staking #17564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dilaouid
wants to merge
6
commits into
develop
Choose a base branch
from
tests/detox-evm-staking
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[LWDM] detox evm staking #17564
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1ac25df
test(e2e): add detox for evm native staking
dilaouid d7273df
test(sei-evm): add missing tags for ci
henri-ly 04be586
test(sei-evm): copilot feedback
henri-ly cda0d8a
fix(sei-evm): add nano X and SP tags
henri-ly 8fb66f6
feat(e2e): confirmation screen e2e desktop sei delegate
dilaouid 80323ab
feat(sei-evm): add more accurate test for mobile part
henri-ly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "live-mobile": minor | ||
| "@ledgerhq/live-common": minor | ||
| "ledger-live-mobile-e2e-tests": minor | ||
| --- | ||
|
henri-ly marked this conversation as resolved.
|
||
|
|
||
| tests(e2e): add detox for evm native staking (sei_evm) and mock smoke under `apps/ledger-live-mobile/e2e` and Speculos delegate flow under `e2e/mobile` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
apps/ledger-live-mobile/e2e/page/trade/evmDelegate.page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { expect } from "detox"; | ||
| import { Step } from "jest-allure2-reporter/api"; | ||
|
|
||
| const FEE_ESTIMATION_TIMEOUT = 120000; | ||
|
|
||
| export default class EvmDelegatePage { | ||
| startStakeButtonId = "account-quick-action-button-cta"; | ||
| addDelegationButtonId = "account-quick-action-button-addDelegation"; | ||
| validatorName = "Ledger by Figment"; | ||
| validatorRowId = "evm-validator-row-seivaloper1mockvalidator000000000000000000000001"; | ||
| amountInputId = "evm-delegation-amount-input"; | ||
| useMaxButtonId = "evm-delegation-use-max"; | ||
| amountContinueButtonId = "enabled-evm-delegation-amount-continue"; | ||
| delegationSummaryLabel = "Delegated assets"; | ||
|
|
||
| @Step("Start EVM delegation flow from account quick actions") | ||
| async startDelegate() { | ||
| await waitForElementById(this.startStakeButtonId); | ||
| await tapById(this.startStakeButtonId); | ||
| } | ||
|
dilaouid marked this conversation as resolved.
dilaouid marked this conversation as resolved.
dilaouid marked this conversation as resolved.
dilaouid marked this conversation as resolved.
dilaouid marked this conversation as resolved.
|
||
|
|
||
| @Step("Wait for validator list to be visible") | ||
| async waitForValidatorListVisible() { | ||
| await waitForElementByText(this.validatorName); | ||
| } | ||
|
|
||
| @Step("Select the first validator in the list") | ||
| async selectFirstValidator() { | ||
| await waitForElementByText(this.validatorName); | ||
| await tapById(this.validatorRowId); | ||
| if (await IsIdVisible(this.amountInputId)) { | ||
| return; | ||
| } | ||
| await tapByText(this.validatorName); | ||
| await waitForElementById(this.amountInputId); | ||
| } | ||
|
|
||
| @Step("Set delegation amount to {amount}") | ||
| async setAmount(amount: string) { | ||
| await waitForElementById(this.amountInputId); | ||
| await typeTextById(this.amountInputId, amount); | ||
| } | ||
|
|
||
| @Step("Wait until network fees are loaded and continue is enabled") | ||
| async waitForAmountContinueEnabled(timeout = FEE_ESTIMATION_TIMEOUT) { | ||
| await waitForElementById(this.amountContinueButtonId, timeout); | ||
| } | ||
|
|
||
| @Step("Tap use max amount button") | ||
| async useMaxAmount() { | ||
| await waitForElementById(this.useMaxButtonId); | ||
| await tapById(this.useMaxButtonId); | ||
| await this.waitForAmountContinueEnabled(); | ||
| } | ||
|
|
||
| @Step("Continue from amount screen") | ||
| async continueAmount() { | ||
| await waitForElementById(this.amountContinueButtonId); | ||
| await tapById(this.amountContinueButtonId); | ||
| } | ||
|
|
||
| @Step("Set amount and continue once fees are ready") | ||
| async setAmountAndContinue(amount: string) { | ||
| await this.setAmount(amount); | ||
| await this.waitForAmountContinueEnabled(); | ||
| await this.continueAmount(); | ||
| } | ||
|
|
||
| @Step("Expect delegated assets summary visible") | ||
| async expectDelegatedAssetsVisible() { | ||
| await waitForElementByText(this.delegationSummaryLabel); | ||
| await expect(getElementByText(this.delegationSummaryLabel)).toBeVisible(); | ||
| } | ||
|
|
||
| @Step("Expect add delegation CTA visible") | ||
| async expectAddDelegationCtaVisible() { | ||
| await waitForElementById(this.addDelegationButtonId); | ||
| await expect(getElementById(this.addDelegationButtonId)).toBeVisible(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| describe("SEI EVM Native Staking - Delegate flow", () => { | ||
|
dilaouid marked this conversation as resolved.
|
||
| const SEI_CURRENCY_ID = "sei_evm"; | ||
| const DELEGATION_AMOUNT = "2"; | ||
| const EMPTY_ACCOUNT_ID = "mock:2:sei_evm:0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707:"; | ||
| const STAKED_ACCOUNT_ID = "mock:2:sei_evm:0x18E9A4F2A5A2B01F35E7D086E75D7D01530A1A9F:"; | ||
|
|
||
| async function selectAccount(accountId: string) { | ||
| const accountRowId = `account-row-${accountId}`; | ||
| if (!(await IsIdVisible(accountRowId))) { | ||
| await scrollToId(accountRowId); | ||
| } | ||
| await waitForElementById(accountRowId); | ||
| await tapById(accountRowId); | ||
| } | ||
|
|
||
| beforeAll(async () => { | ||
| await app.init({ | ||
| userdata: "seiEvmStaking", | ||
| }); | ||
| await app.portfolio.waitForPortfolioPageToLoad(); | ||
| }); | ||
|
|
||
| it("Delegate happy path: start delegating, validator list is shown, validator selected", async () => { | ||
| await app.assetAccountsPage.openViaDeeplink(SEI_CURRENCY_ID); | ||
| await selectAccount(EMPTY_ACCOUNT_ID); | ||
| await app.evmDelegate.startDelegate(); | ||
| await app.evmDelegate.selectFirstValidator(); | ||
| await app.evmDelegate.setAmountAndContinue(DELEGATION_AMOUNT); | ||
| }); | ||
|
|
||
| it("Already-delegated validator is reflected on the account page", async () => { | ||
| await app.assetAccountsPage.openViaDeeplink(SEI_CURRENCY_ID); | ||
| await selectAccount(STAKED_ACCOUNT_ID); | ||
| await app.evmDelegate.expectDelegatedAssetsVisible(); | ||
| await app.evmDelegate.expectAddDelegationCtaVisible(); | ||
| }); | ||
| }); | ||
209 changes: 209 additions & 0 deletions
209
apps/ledger-live-mobile/e2e/userdata/seiEvmStaking.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| { | ||
| "data": { | ||
| "SPECTRON_RUN": { | ||
| "localStorage": { | ||
| "acceptedTermsVersion": "2019-12-04" | ||
| } | ||
| }, | ||
| "settings": { | ||
| "hasCompletedOnboarding": true, | ||
| "counterValue": "USD", | ||
| "language": "en", | ||
| "theme": "light", | ||
| "region": null, | ||
| "locale": "en-US", | ||
| "orderAccounts": "balance|desc", | ||
| "countervalueFirst": false, | ||
| "autoLockTimeout": 10, | ||
| "selectedTimeRange": "month", | ||
| "marketIndicator": "western", | ||
| "currenciesSettings": {}, | ||
| "pairExchanges": {}, | ||
| "developerMode": false, | ||
| "loaded": true, | ||
| "shareAnalytics": true, | ||
| "sentryLogs": true, | ||
| "readOnlyModeEnabled": false, | ||
| "hasOrderedNano": true, | ||
| "lastUsedVersion": "99.99.99", | ||
| "dismissedBanners": [], | ||
| "accountsViewMode": "list", | ||
| "showAccountsHelperBanner": true, | ||
| "hideEmptyTokenAccounts": false, | ||
| "sidebarCollapsed": false, | ||
| "discreetMode": false, | ||
| "preferredDeviceModel": "nanoX", | ||
| "hasInstalledApps": true, | ||
| "dismissedDynamicCards": [], | ||
| "seenDevices": [], | ||
| "blacklistedTokenIds": [], | ||
| "swapAcceptedProviderIds": [], | ||
| "deepLinkUrl": null, | ||
| "firstTimeLend": false, | ||
| "swapProviders": [], | ||
| "showClearCacheBanner": false, | ||
| "starredAccountIds": [], | ||
| "hasPassword": false | ||
| }, | ||
| "user": { | ||
| "id": "08cf3393-c5eb-4ea7-92de-0deea22e3971" | ||
| }, | ||
| "accounts": [ | ||
| { | ||
| "data": { | ||
| "id": "mock:2:sei_evm:0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707:", | ||
| "seedIdentifier": "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", | ||
| "name": "SEI Network (EVM) 1", | ||
| "starred": false, | ||
| "used": true, | ||
| "derivationMode": "", | ||
| "index": 0, | ||
| "freshAddress": "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", | ||
| "freshAddressPath": "44'/60'/0'/0/0", | ||
| "blockHeight": 100000, | ||
| "creationDate": "2024-01-01T00:00:00.000Z", | ||
| "operationsCount": 0, | ||
| "operations": [], | ||
| "pendingOperations": [], | ||
| "currencyId": "sei_evm", | ||
| "unitMagnitude": 18, | ||
| "lastSyncDate": "2024-01-01T00:00:00.000Z", | ||
| "balance": "10000000000000000000", | ||
| "spendableBalance": "10000000000000000000", | ||
| "xpub": "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", | ||
| "stakingResources": { | ||
| "delegations": [], | ||
| "redelegations": [], | ||
| "unbondings": [], | ||
| "delegatedBalance": "0", | ||
| "pendingRewardsBalance": "0", | ||
| "unbondingBalance": "0", | ||
| "validators": [ | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000001", | ||
| "name": "Ledger by Figment", | ||
| "votingPower": 0, | ||
| "commission": 0.05, | ||
| "estimatedYearlyRewardsRate": 0.12, | ||
| "tokens": 123456789000000 | ||
| }, | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000002", | ||
| "name": "Chorus One", | ||
| "votingPower": 1, | ||
| "commission": 0.07, | ||
| "estimatedYearlyRewardsRate": 0.1, | ||
| "tokens": 99000000000000 | ||
| }, | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000003", | ||
| "name": "Everstake", | ||
| "votingPower": 2, | ||
| "commission": 0.1, | ||
| "estimatedYearlyRewardsRate": 0.09, | ||
| "tokens": 77000000000000 | ||
| } | ||
| ] | ||
| }, | ||
| "swapHistory": [] | ||
| }, | ||
| "version": 1 | ||
| }, | ||
| { | ||
| "data": { | ||
| "id": "mock:2:sei_evm:0x18E9A4F2A5A2B01F35E7D086E75D7D01530A1A9F:", | ||
| "seedIdentifier": "0x6EB963EFD0FEF7A4CFAB6CE6F1421C3279D11707", | ||
| "name": "SEI Network (EVM) Staked", | ||
| "starred": false, | ||
| "used": true, | ||
| "derivationMode": "", | ||
| "index": 1, | ||
| "freshAddress": "0x18E9A4F2A5A2B01F35E7D086E75D7D01530A1A9F", | ||
| "freshAddressPath": "44'/60'/1'/0/0", | ||
| "blockHeight": 100000, | ||
| "creationDate": "2024-01-01T00:00:00.000Z", | ||
| "operationsCount": 0, | ||
| "operations": [], | ||
| "pendingOperations": [], | ||
| "currencyId": "sei_evm", | ||
| "unitMagnitude": 18, | ||
| "lastSyncDate": "2024-01-01T00:00:00.000Z", | ||
| "balance": "10000000000000000000", | ||
| "spendableBalance": "7500000000000000000", | ||
| "xpub": "0x18E9A4F2A5A2B01F35E7D086E75D7D01530A1A9F", | ||
| "stakingResources": { | ||
| "delegations": [ | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000001", | ||
| "amount": "2500000000000000000", | ||
| "pendingRewards": "120000000000000000", | ||
| "status": "bonded" | ||
| } | ||
| ], | ||
| "redelegations": [ | ||
| { | ||
| "validatorSrcAddress": "seivaloper1mockvalidator000000000000000000000002", | ||
| "validatorDstAddress": "seivaloper1mockvalidator000000000000000000000003", | ||
| "amount": "1000000000000000000", | ||
| "completionDate": "2042-01-02T03:04:05.000Z" | ||
| } | ||
| ], | ||
| "unbondings": [ | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000001", | ||
| "amount": "500000000000000000", | ||
| "completionDate": "2042-01-02T03:04:05.000Z" | ||
| } | ||
| ], | ||
| "delegatedBalance": "2500000000000000000", | ||
| "pendingRewardsBalance": "120000000000000000", | ||
| "unbondingBalance": "500000000000000000", | ||
| "validators": [ | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000001", | ||
| "name": "Ledger by Figment", | ||
| "votingPower": 0, | ||
| "commission": 0.05, | ||
| "estimatedYearlyRewardsRate": 0.12, | ||
| "tokens": 123456789000000 | ||
| }, | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000002", | ||
| "name": "Chorus One", | ||
| "votingPower": 1, | ||
| "commission": 0.07, | ||
| "estimatedYearlyRewardsRate": 0.1, | ||
| "tokens": 99000000000000 | ||
| }, | ||
| { | ||
| "validatorAddress": "seivaloper1mockvalidator000000000000000000000003", | ||
| "name": "Everstake", | ||
| "votingPower": 2, | ||
| "commission": 0.1, | ||
| "estimatedYearlyRewardsRate": 0.09, | ||
| "tokens": 77000000000000 | ||
| } | ||
| ] | ||
| }, | ||
| "swapHistory": [] | ||
| }, | ||
| "version": 1 | ||
| } | ||
| ], | ||
| "countervalues": {}, | ||
| "featureFlags": { | ||
| "overrides": { | ||
| "evmNativeStaking": { | ||
| "enabled": true, | ||
| "params": { | ||
| "supportedCurrencyIds": ["sei_evm"] | ||
| } | ||
| }, | ||
| "llmAccountListUI": { | ||
| "enabled": false | ||
| } | ||
| }, | ||
| "bannerVisible": false | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.