diff --git a/apps/ledger-live-desktop/src/renderer/components/Onboarding/Screens/Welcome/index.tsx b/apps/ledger-live-desktop/src/renderer/components/Onboarding/Screens/Welcome/index.tsx index a0a21a35c5a2..e9e4062d6d7f 100644 --- a/apps/ledger-live-desktop/src/renderer/components/Onboarding/Screens/Welcome/index.tsx +++ b/apps/ledger-live-desktop/src/renderer/components/Onboarding/Screens/Welcome/index.tsx @@ -162,7 +162,13 @@ export function Welcome() { - handleOpenFeatureFlagsDrawer("1")}> + handleOpenFeatureFlagsDrawer("1")} + > {t("onboarding.screens.welcome.title")} handleOpenFeatureFlagsDrawer("2")}> diff --git a/apps/ledger-live-desktop/src/renderer/screens/settings/sections/Help/ResetButton.tsx b/apps/ledger-live-desktop/src/renderer/screens/settings/sections/Help/ResetButton.tsx index faa3a4fe27cd..577bb17826a6 100644 --- a/apps/ledger-live-desktop/src/renderer/screens/settings/sections/Help/ResetButton.tsx +++ b/apps/ledger-live-desktop/src/renderer/screens/settings/sections/Help/ResetButton.tsx @@ -30,7 +30,7 @@ export default function ResetButton() { }, [pending, handleConfirm, handleError, hardReset]); return ( <> - @@ -48,7 +48,7 @@ export default function ResetButton() { desc={ {t("settings.hardResetModal.desc")} - + {t("settings.hardResetModal.warning")} diff --git a/apps/ledger-live-desktop/tests/page/index.ts b/apps/ledger-live-desktop/tests/page/index.ts index 8d2d4544998f..168f84e88f27 100644 --- a/apps/ledger-live-desktop/tests/page/index.ts +++ b/apps/ledger-live-desktop/tests/page/index.ts @@ -23,6 +23,8 @@ import { LockscreenPage } from "tests/page/lockscreen.page"; import { NFTDrawer } from "./drawer/nft.drawer"; import { NftGallery } from "./nftGallery.page"; import { AssetPage } from "./asset.page"; +import { SettingsModal } from "tests/page/modal/settings.modal"; +import { OnboardingPage } from "tests/page/onboarding.page"; export class Application extends PageHolder { public account = new AccountPage(this.page); @@ -49,4 +51,6 @@ export class Application extends PageHolder { public nftDrawer = new NFTDrawer(this.page); public nftGallery = new NftGallery(this.page); public assetPage = new AssetPage(this.page); + public settingsModal = new SettingsModal(this.page); + public onboarding = new OnboardingPage(this.page); } diff --git a/apps/ledger-live-desktop/tests/page/modal/settings.modal.ts b/apps/ledger-live-desktop/tests/page/modal/settings.modal.ts new file mode 100644 index 000000000000..ce1c6db0055d --- /dev/null +++ b/apps/ledger-live-desktop/tests/page/modal/settings.modal.ts @@ -0,0 +1,20 @@ +import { expect } from "@playwright/test"; +import { Modal } from "../../component/modal.component"; +import { step } from "tests/misc/reporters/step"; + +export class SettingsModal extends Modal { + readonly warningMessage = this.page.getByTestId("warning-message"); + + @step("Check Reset Modal") + async checkResetModal() { + await expect(this.title).toHaveText("Reset Ledger Live"); + await expect(this.warningMessage).toHaveText( + "Resetting Ledger Live will erase your swap transaction history for all your accounts.", + ); + } + + @step("Click on Confirm Button") + async clickOnConfirmButton() { + await this.confirmButton.click(); + } +} diff --git a/apps/ledger-live-desktop/tests/page/onboarding.page.ts b/apps/ledger-live-desktop/tests/page/onboarding.page.ts index 48c64788178d..c0bd818f7d52 100644 --- a/apps/ledger-live-desktop/tests/page/onboarding.page.ts +++ b/apps/ledger-live-desktop/tests/page/onboarding.page.ts @@ -26,9 +26,11 @@ export class OnboardingPage extends AppPage { private quizAnswerTopButton = this.page.getByTestId("v3-quiz-answer-0"); private quizAnswerBottomButton = this.page.getByTestId("v3-quiz-answer-1"); readonly roleAnimation = this.page.locator("[role=animation]"); + private onbordingWelcomeTitle = this.page.getByTestId("onbording-welcome-title"); async waitForLaunch() { await this.getStartedButton.waitFor({ state: "visible" }); + await this.onbordingWelcomeTitle.waitFor({ state: "visible" }); } async waitForPedagogyModal() { diff --git a/apps/ledger-live-desktop/tests/page/settings.page.ts b/apps/ledger-live-desktop/tests/page/settings.page.ts index d0be3d45f6dd..79e9436c96d4 100644 --- a/apps/ledger-live-desktop/tests/page/settings.page.ts +++ b/apps/ledger-live-desktop/tests/page/settings.page.ts @@ -14,6 +14,7 @@ export class SettingsPage extends AppPage { private developerTab = this.page.getByTestId("settings-developer-tab"); private experimentalDevModeToggle = this.page.getByTestId("MANAGER_DEV_MODE-button"); private ledgerSupport = this.page.getByTestId("ledgerSupport-link"); + private resetAppButton = this.page.getByTestId("reset-button"); readonly counterValueSelector = this.page.locator( "[data-testid='setting-countervalue-dropDown'] .select__value-container", @@ -39,14 +40,17 @@ export class SettingsPage extends AppPage { await this.accountsTab.click(); } + @step("Go to Settings About tab") async goToAboutTab() { await this.aboutTab.click(); } + @step("Go to Settings Help tab") async goToHelpTab() { await this.helpTab.click(); } + @step("Go to Settings Experimental tab") async goToExperimentalTab() { await this.experimentalTab.click(); } @@ -124,4 +128,9 @@ export class SettingsPage extends AppPage { } expect(url).toBe("https://support.ledger.com/?redirect=false"); } + + @step("Reset App") + async resetApp() { + await this.resetAppButton.click(); + } } diff --git a/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts index 3b0eb3bc1980..957d5734b922 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts @@ -3,6 +3,7 @@ import { addTmsLink } from "tests/utils/allureUtils"; import { getDescription } from "../../utils/customJsonReporter"; import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; import { CLI } from "tests/utils/cliUtils"; +import { FileUtils } from "tests/utils/fileUtils"; test.describe("Settings", () => { test.use({ @@ -147,3 +148,32 @@ test.describe("Ledger Support (web link)", () => { }, ); }); + +test.describe("Reset app", () => { + test.use({ + userdata: "1AccountBTC1AccountETH", + }); + + test( + "Verify that user can Reset app", + { + annotation: { + type: "TMS", + description: "B2CQA-821", + }, + }, + async ({ app, userdataFile }) => { + await addTmsLink(getDescription(test.info().annotations, "TMS").split(", ")); + + await app.layout.goToSettings(); + const appJsonBefore = await FileUtils.getAppJsonSize(userdataFile); + await app.settings.goToHelpTab(); + await app.settings.resetApp(); + await app.settingsModal.checkResetModal(); + await app.settingsModal.clickOnConfirmButton(); + await app.onboarding.waitForLaunch(); + const appJsonAfter = await FileUtils.getAppJsonSize(userdataFile); + await FileUtils.compareAppJsonSize(appJsonBefore, appJsonAfter); + }, + ); +}); diff --git a/apps/ledger-live-desktop/tests/utils/fileUtils.ts b/apps/ledger-live-desktop/tests/utils/fileUtils.ts index 33fe540be3e8..20579628c392 100644 --- a/apps/ledger-live-desktop/tests/utils/fileUtils.ts +++ b/apps/ledger-live-desktop/tests/utils/fileUtils.ts @@ -1,4 +1,7 @@ import { appendFile } from "fs/promises"; +import { expect } from "@playwright/test"; +import { step } from "tests/misc/reporters/step"; +import fs from "fs/promises"; export async function safeAppendFile(filePath: string, data: string) { try { @@ -7,3 +10,16 @@ export async function safeAppendFile(filePath: string, data: string) { if (e) console.error("couldn't append file", e); } } + +export class FileUtils { + @step("get app.json size") + static async getAppJsonSize(userdataFile: string) { + const fileStats = await fs.stat(userdataFile); + return fileStats.size; + } + + @step("Compare 2 app.json files") + static async compareAppJsonSize(appJson1: number, appJson2: number) { + expect(appJson1).not.toEqual(appJson2); + } +}