diff --git a/apps/ledger-live-mobile/e2e/page/accounts/account.page.ts b/apps/ledger-live-mobile/e2e/page/accounts/account.page.ts index 52bde820c07d..895474f9ff13 100644 --- a/apps/ledger-live-mobile/e2e/page/accounts/account.page.ts +++ b/apps/ledger-live-mobile/e2e/page/accounts/account.page.ts @@ -1,4 +1,11 @@ -import { getElementById, getTextOfElement, scrollToId, tapByElement, tapById } from "../../helpers"; +import { + getElementById, + getTextOfElement, + scrollToId, + tapByElement, + typeTextById, + tapById, +} from "../../helpers"; import { expect } from "detox"; import jestExpect from "expect"; @@ -17,6 +24,8 @@ export default class AccountPage { receiveButton = () => getElementById("account-quick-action-button-receive"); sendButton = () => getElementById("account-quick-action-button-send"); earnButtonId = "account-quick-action-button-earn"; + accountRenameRow = () => getElementById("account-settings-rename-row"); + accountRenameTextInputId = "account-rename-text-input"; @Step("Open account settings") async openAccountSettings() { @@ -38,6 +47,16 @@ export default class AccountPage { await tapByElement(this.accountDeleteConfirm()); } + @Step("Select account edit name") + async selectAccountRename() { + await tapByElement(this.accountRenameRow()); + } + + @Step("Enter new account name and submit") + async enterNewAccountName(name: string) { + await typeTextById(this.accountRenameTextInputId, name); + } + @Step("Expect operation history to be visible") async expectOperationHistoryVisible(accountId: string) { const id = this.operationHistorySectionId(accountId); diff --git a/apps/ledger-live-mobile/e2e/specs/speculos/account/accountRename.spec.ts b/apps/ledger-live-mobile/e2e/specs/speculos/account/accountRename.spec.ts new file mode 100644 index 000000000000..afbdf8f0af4e --- /dev/null +++ b/apps/ledger-live-mobile/e2e/specs/speculos/account/accountRename.spec.ts @@ -0,0 +1,45 @@ +import { launchApp } from "../../../helpers"; +import { Application } from "../../../page"; +import { CLI } from "../../../utils/cliUtils"; +import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; +import { device } from "detox"; + +const app = new Application(); +const account = Account.BTC_NATIVE_SEGWIT_1; +const newAccountName = "New Account Name"; + +$TmsLink("B2CQA-2996"); +describe("Account name change", () => { + beforeAll(async () => { + await app.init({ + speculosApp: account.currency.speculosApp, + cliCommands: [ + async () => { + return CLI.liveData({ + currency: account.currency.currencyId, + index: account.index, + appjson: app.userdataPath, + add: true, + }); + }, + ], + }); + await app.portfolio.waitForPortfolioPageToLoad(); + }); + + it("should persist Account name change after app restart", async () => { + await app.accounts.openViaDeeplink(); + await app.common.expectAccountName(account.accountName); + await app.common.goToAccountByName(account.accountName); + await app.account.openAccountSettings(); + await app.account.selectAccountRename(); + await app.account.enterNewAccountName(newAccountName); + await app.accounts.openViaDeeplink(); + await app.common.expectAccountName(newAccountName); + await device.terminateApp(); + await launchApp(); + await app.portfolio.waitForPortfolioPageToLoad(); + await app.accounts.openViaDeeplink(); + await app.common.expectAccountName(newAccountName); + }); +}); diff --git a/apps/ledger-live-mobile/src/screens/AccountSettings/AccountNameRow.tsx b/apps/ledger-live-mobile/src/screens/AccountSettings/AccountNameRow.tsx index 6966556628f1..99d018ddab69 100644 --- a/apps/ledger-live-mobile/src/screens/AccountSettings/AccountNameRow.tsx +++ b/apps/ledger-live-mobile/src/screens/AccountSettings/AccountNameRow.tsx @@ -24,6 +24,7 @@ function AccountNameRow({ navigation, account }: Props) { event="AccountNameRow" title={} desc={} + testID="account-settings-rename-row" arrowRight onPress={onPress} > diff --git a/apps/ledger-live-mobile/src/screens/AccountSettings/EditAccountName.tsx b/apps/ledger-live-mobile/src/screens/AccountSettings/EditAccountName.tsx index f2d626b0bad7..dd02727e786a 100644 --- a/apps/ledger-live-mobile/src/screens/AccountSettings/EditAccountName.tsx +++ b/apps/ledger-live-mobile/src/screens/AccountSettings/EditAccountName.tsx @@ -91,6 +91,7 @@ class EditAccountName extends PureComponent< onSubmitEditing={this.onNameEndEditing} clearButtonMode="while-editing" placeholder={i18next.t("account.settings.accountName.placeholder")} + testID="account-rename-text-input" />