Skip to content

Commit

Permalink
Merge pull request #8869 from LedgerHQ/support/qaa-415_detox_account_…
Browse files Browse the repository at this point in the history
…name_persist

[QAA-415][Detox][Speculos] Account name persist after restart
  • Loading branch information
abdurrahman-ledger authored Jan 29, 2025
2 parents 335f059 + af774f4 commit 7eefdda
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
21 changes: 20 additions & 1 deletion apps/ledger-live-mobile/e2e/page/accounts/account.page.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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() {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function AccountNameRow({ navigation, account }: Props) {
event="AccountNameRow"
title={<Trans i18nKey="account.settings.accountName.title" />}
desc={<Trans i18nKey="account.settings.accountName.desc" />}
testID="account-settings-rename-row"
arrowRight
onPress={onPress}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
</Box>
<Button
Expand Down

0 comments on commit 7eefdda

Please sign in to comment.