diff --git a/playwright/PageObjects/CreateOrImport.ts b/playwright/PageObjects/CreateOrImport.ts index 0b37af7..764f9fd 100644 --- a/playwright/PageObjects/CreateOrImport.ts +++ b/playwright/PageObjects/CreateOrImport.ts @@ -3,6 +3,7 @@ import { type Locator, type Page } from "@playwright/test"; export class CreateOrImportPage extends MainPage { readonly buttonCreateAccount: Locator; + readonly buttonImportAccount: Locator; readonly labelCreateTitle: Locator; readonly textCreateDescription: Locator; @@ -12,6 +13,7 @@ export class CreateOrImportPage extends MainPage { ) { super(page, viewport); this.buttonCreateAccount = this.page.getByTestId("button-create-account"); + this.buttonImportAccount = this.page.getByTestId("button-import-account"); this.labelCreateTitle = this.page.getByTestId("label-create-title"); this.textCreateDescription = this.page.getByTestId( "text-create-description", @@ -22,7 +24,15 @@ export class CreateOrImportPage extends MainPage { await this.buttonCreateAccount.click(); } + async clickImportAccount() { + await this.buttonImportAccount.click(); + } + async navigateTo() { await this.page.goto("/"); } + + async validatePageIsDisplayed() { + await this.labelCreateTitle.waitFor({ state: "attached" }); + } } diff --git a/playwright/PageObjects/ImportAccount.ts b/playwright/PageObjects/ImportAccount.ts new file mode 100644 index 0000000..5b97865 --- /dev/null +++ b/playwright/PageObjects/ImportAccount.ts @@ -0,0 +1,159 @@ +import MainPage from "./MainPage"; +import { expect, type Locator, type Page } from "@playwright/test"; +import { readFile } from "fs/promises"; + +export class ImportAccountPage extends MainPage { + readonly buttonGoBack: Locator; + readonly buttonImportAccountFromFile: Locator; + readonly buttonImportAccountFromRemote: Locator; + readonly buttonUploadPassphrase: Locator; + readonly textImportAccountSecondary: Locator; + readonly titleImportAccount: Locator; + + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); + this.buttonGoBack = this.page.getByTestId("button-import-account-go-back"); + this.buttonImportAccountFromFile = this.page.getByTestId( + "import-account-file", + ); + this.buttonImportAccountFromRemote = + this.page.getByTestId("import-account"); + this.buttonUploadPassphrase = this.page.getByTestId("upload-passphrase"); + this.textImportAccountSecondary = this.page.getByTestId( + "text-import-account-secondary", + ); + this.titleImportAccount = this.page.getByTestId("title-import-account"); + } + + async clickOnGoBack() { + await this.buttonGoBack.click(); + } + + async clickOnImportAccountFromFile() { + await this.buttonImportAccountFromFile.click(); + } + + async clickOnImportAccountFromRemote() { + await this.buttonImportAccountFromRemote.click(); + } + + async clickOnUploadPassphrase() { + await this.buttonUploadPassphrase.click(); + } + + async enterSeedPhraseManually(seedPhrase: string[]) { + // Loop through each of the 12 input fields + for (let i = 1; i <= 12; i++) { + // Get the text from the array element and type it on input field + await this.page + .locator(`[data-cy="ordered-phrase-word-${i}"]`) + .locator("input") + .fill(seedPhrase[i - 1]); + } + } + + async getRecoveryPhrase() { + let phrase = []; + + // Loop through each of the 12 phrases + for (let i = 1; i <= 12; i++) { + // Ensure the phrase number element exists + await this.page + .locator(`[data-cy="ordered-phrase-number-${i}"]`) + .waitFor({ state: "attached" }); + + // Ensure the phrase word element exists + await this.page + .locator(`[data-cy="ordered-phrase-word-${i}"]`) + .waitFor({ state: "attached" }); + + // Get the text from the

tag inside the phrase word element + const text = await this.page + .locator(`[data-cy="ordered-phrase-word-${i}"]`) + .locator("p") + .innerText(); + phrase.push(text); + } + + return phrase; + } + + async getNumberOfSeedWordsDisplayed() { + const count = await this.page + .locator(`[data-cy^="ordered-phrase-word-`) + .count(); + return count; + } + + async importAccountFromFile( + phraseType: "file" | "manual", + backUpFile: string, + seedPhrasePath?: string, + seedPhrase?: string[], + ) { + if (phraseType === "file") { + await this.uploadSeedPhraseFile(seedPhrasePath); + } else if (phraseType === "manual") { + await this.enterSeedPhraseManually(seedPhrase); + } else { + throw new Error("Invalid passphrase type"); + } + await this.uploadImportedFile(backUpFile); + } + + async importAccountFromRemote( + phraseType: "file" | "manual", + seedPhrasePath?: string, + seedPhrase?: string[], + ) { + if (phraseType === "file") { + await this.uploadSeedPhraseFile(seedPhrasePath); + } else if (phraseType === "manual") { + await this.enterSeedPhraseManually(seedPhrase); + } else { + throw new Error("Invalid passphrase type"); + } + await this.clickOnImportAccountFromRemote(); + } + + async readRecoveryPhraseFile(filePath: string) { + const fileContent = await readFile(filePath, "utf-8"); + const fileSeedPhraseArray = fileContent.split(/\s+/).filter(Boolean); + return fileSeedPhraseArray; + } + + async uploadImportedFile(filePath: string) { + const fileChooserPromise = this.page.waitForEvent("filechooser"); + await this.clickOnImportAccountFromFile(); + const fileChooser = await fileChooserPromise; + await fileChooser.setFiles(filePath); + } + + async uploadSeedPhraseFile(filePath: string) { + const fileChooserPromise = this.page.waitForEvent("filechooser"); + await this.clickOnUploadPassphrase(); + const fileChooser = await fileChooserPromise; + await fileChooser.setFiles(filePath); + } + + async validateToastInvalidPhrase() { + await this.toastNotificationText.waitFor({ state: "attached" }); + await expect(this.toastNotificationText).toHaveText( + "Invalid word in phrase", + ); + } + + async validateToastUnkwnownError() { + await this.toastNotificationText.waitFor({ state: "attached" }); + await expect(this.toastNotificationText).toHaveText( + "An unknown error occurred", + ); + } + + async validatePageIsLoaded() { + await this.titleImportAccount.waitFor({ state: "attached" }); + } +} diff --git a/playwright/PageObjects/LoginPin.ts b/playwright/PageObjects/LoginPin.ts index 802724d..e7e1068 100644 --- a/playwright/PageObjects/LoginPin.ts +++ b/playwright/PageObjects/LoginPin.ts @@ -6,6 +6,7 @@ export class LoginPinPage extends MainPage { readonly buttonCreateNewProfile: Locator; readonly buttonPinSettings: Locator; readonly labelChooseEnterPin: Locator; + readonly oldAccountToBeOverwrittenText: Locator; readonly pinButton0: Locator; readonly pinButton1: Locator; readonly pinButton2: Locator; @@ -39,6 +40,9 @@ export class LoginPinPage extends MainPage { ); this.buttonPinSettings = this.page.getByTestId("button-settings"); this.labelChooseEnterPin = this.page.getByTestId("label-choose-enter-pin"); + this.oldAccountToBeOverwrittenText = this.page.getByText( + "By continuing your old account will be overwritten!", + ); this.pinButton0 = this.page.getByTestId("button-pin-0"); this.pinButton1 = this.page.getByTestId("button-pin-1"); this.pinButton2 = this.page.getByTestId("button-pin-2"); diff --git a/playwright/PageObjects/MainPage.ts b/playwright/PageObjects/MainPage.ts index c735ad6..93c5691 100644 --- a/playwright/PageObjects/MainPage.ts +++ b/playwright/PageObjects/MainPage.ts @@ -1,4 +1,5 @@ import { expect, type Locator, type Page } from "@playwright/test"; +import { readFile } from "fs/promises"; const fs = require("fs"); const path = require("path"); export default class MainPage { @@ -288,6 +289,12 @@ export default class MainPage { }); } + async readRecoveryPhraseFile(filePath: string) { + const fileContent = await readFile(filePath, "utf-8"); + const fileSeedPhraseArray = fileContent.split(/\s+/).filter(Boolean); + return fileSeedPhraseArray; + } + async validateNoFavoritesAreVisible() { await this.clickOnShowSidebarIfClosed(); await this.favoriteCircle.waitFor({ state: "detached" }); diff --git a/playwright/PageObjects/SaveRecoverySeed.ts b/playwright/PageObjects/SaveRecoverySeed.ts index abc996e..affc973 100644 --- a/playwright/PageObjects/SaveRecoverySeed.ts +++ b/playwright/PageObjects/SaveRecoverySeed.ts @@ -1,6 +1,5 @@ import MainPage from "./MainPage"; -import { expect, type Locator, type Page } from "@playwright/test"; -import { readFile } from "fs/promises"; +import { type Locator, type Page } from "@playwright/test"; export class SaveRecoverySeedPage extends MainPage { readonly buttonDownloadPhrase: Locator; @@ -58,12 +57,6 @@ export class SaveRecoverySeedPage extends MainPage { return count; } - async readRecoveryPhraseFile(filePath: string) { - const fileContent = await readFile(filePath, "utf-8"); - const fileSeedPhraseArray = fileContent.split(/\s+/).filter(Boolean); - return fileSeedPhraseArray; - } - async saveRecoverySeed() { // Wait for the download event const filename = "seed-phrase.txt"; diff --git a/playwright/PageObjects/Settings/SettingsProfile.ts b/playwright/PageObjects/Settings/SettingsProfile.ts index 52d5199..62beccb 100644 --- a/playwright/PageObjects/Settings/SettingsProfile.ts +++ b/playwright/PageObjects/Settings/SettingsProfile.ts @@ -1,5 +1,7 @@ import { expect, type Locator, type Page } from "@playwright/test"; import { SettingsBase } from "./SettingsBase"; +const fs = require("fs"); +const path = require("path"); export class SettingsProfile extends SettingsBase { readonly accountIntegrations: Locator; @@ -37,6 +39,11 @@ export class SettingsProfile extends SettingsBase { readonly deleteAccountSectionButton: Locator; readonly deleteAccountSectionLabel: Locator; readonly deleteAccountSectionText: Locator; + readonly exportAccountSection: Locator; + readonly exportAccountSectionLabel: Locator; + readonly exportAccountSectionText: Locator; + readonly exportAccountSectionFileButton: Locator; + readonly exportAccountSectionRemoteButton: Locator; readonly identiconSettingsProfile: Locator; readonly inputSettingsProfileShortID: Locator; readonly inputSettingsProfileShortIDGroup: Locator; @@ -201,6 +208,18 @@ export class SettingsProfile extends SettingsBase { this.deleteAccountSectionText = this.deleteAccountSection.getByTestId( "setting-section-text", ); + this.exportAccountSection = this.page.getByTestId("export-account"); + this.exportAccountSectionLabel = this.exportAccountSection.getByTestId( + "setting-section-label", + ); + this.exportAccountSectionText = this.exportAccountSection.getByTestId( + "setting-section-text", + ); + this.exportAccountSectionFileButton = this.exportAccountSection.getByTestId( + "export-account-file", + ); + this.exportAccountSectionRemoteButton = + this.exportAccountSection.getByTestId("export-account-remote"); this.identiconSettingsProfile = this.page .locator(".identicon") .locator("img"); @@ -329,12 +348,39 @@ export class SettingsProfile extends SettingsBase { ); } - // Rewrite everything here in playwright - async copyShortID() { await this.inputSettingsProfileShortIDGroup.click(); } + async deleteAccount() { + await this.deleteAccountSectionButton.click(); + } + + async exportAccountToFile() { + const downloadPath = path.join(__dirname, "downloads"); + if (!fs.existsSync(downloadPath)) { + fs.mkdirSync(downloadPath); + } + + const downloadPromise = this.page.waitForEvent("download"); + await this.exportAccountSectionFileButton.click(); + const download = await downloadPromise; + + const fileName = download.suggestedFilename(); // Get the suggested filename + const filePath = path.join(downloadPath, fileName); + await download.saveAs(filePath); // Save the file to the designated path + + // Validate the downloaded file + expect(fs.existsSync(filePath)).toBeTruthy(); // Check file exists + expect([".upk"]).toContain(path.extname(fileName)); // Validate file extension + } + + async exportAccountToRemote() { + await this.exportAccountSectionRemoteButton.click(); + await this.validateToastSuccessRemoteExport(); + await this.waitForToastNotificationToDisappear(); + } + async getProfileIdenticonSource() { const source = await this.identiconSettingsProfile.getAttribute("src"); return source; @@ -517,6 +563,16 @@ export class SettingsProfile extends SettingsBase { await expect(this.toastNotificationText).toHaveText("Profile Updated!"); } + async validateToastSuccessRemoteExport() { + await this.toastNotification.waitFor({ state: "attached" }); + const textToast = this.toastNotification.getByText( + "Successfully exported account to remote", + ); + await expect(textToast).toHaveText( + "Successfully exported account to remote", + ); + } + async uploadProfileBanner(file: string) { await this.profileBanner.click(); await this.profileBannerInput.setInputFiles(file); diff --git a/playwright/PageObjects/Settings/downloads/export.upk b/playwright/PageObjects/Settings/downloads/export.upk new file mode 100644 index 0000000..d7b61f1 Binary files /dev/null and b/playwright/PageObjects/Settings/downloads/export.upk differ diff --git a/playwright/assets/export.upk b/playwright/assets/export.upk new file mode 100644 index 0000000..24f209a Binary files /dev/null and b/playwright/assets/export.upk differ diff --git a/playwright/assets/seed-phrase.txt b/playwright/assets/seed-phrase.txt new file mode 100644 index 0000000..2da4d41 --- /dev/null +++ b/playwright/assets/seed-phrase.txt @@ -0,0 +1 @@ +shoe enough industry soft unit dilemma slight venture mirror man nice motion \ No newline at end of file diff --git a/playwright/specs/01-pin-input.spec.ts b/playwright/specs/01-pin-input.spec.ts index 3195eda..ef696a8 100644 --- a/playwright/specs/01-pin-input.spec.ts +++ b/playwright/specs/01-pin-input.spec.ts @@ -24,7 +24,7 @@ test.describe("Create Account and Login Tests", () => { const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); await test.step("Validate Create or Import Page and then click on Create New Account", async () => { - await createOrImport.labelCreateTitle.waitFor({ state: "attached" }); + await createOrImport.validatePageIsDisplayed(); await expect(createOrImport.labelCreateTitle).toHaveText( "Account Creation", ); diff --git a/playwright/specs/04-import-account.spec.ts b/playwright/specs/04-import-account.spec.ts new file mode 100644 index 0000000..9124078 --- /dev/null +++ b/playwright/specs/04-import-account.spec.ts @@ -0,0 +1,304 @@ +import { CreateOrImportPage } from "playwright/PageObjects/CreateOrImport"; +import { expect, test } from "../fixtures/setup"; +import { faker } from "@faker-js/faker"; +import { ImportAccountPage } from "playwright/PageObjects/ImportAccount"; +import { LoginPinPage } from "playwright/PageObjects/LoginPin"; +import { ChatsMainPage } from "playwright/PageObjects/ChatsElements/ChatsMain"; +import { AuthNewAccount } from "playwright/PageObjects/AuthNewAccount"; +import { SaveRecoverySeedPage } from "playwright/PageObjects/SaveRecoverySeed"; +import { SettingsProfile } from "playwright/PageObjects/Settings/SettingsProfile"; +import { DeleteAccountModal } from "playwright/PageObjects/Settings/DeleteAccountModal"; + +test.describe("Import Account Tests", () => { + test("U1 to U6 - Import Account - Negative Input tests, go back and scramble keypad", async ({ + enterPinUserContext, + }) => { + const page = enterPinUserContext.page; + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const importAccount = new ImportAccountPage(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + + await test.step("Validate Create or Import Page is displayed and then click on Import Account", async () => { + await createOrImport.validatePageIsDisplayed(); + await createOrImport.clickImportAccount(); + }); + + await test.step("Dismiss installer download banner", async () => { + await createOrImport.dismissDownloadAlert(); + }); + + await test.step("Enter valid PIN", async () => { + await loginPinPage.enterDefaultPin(); + }); + + await test.step("Go Back button returns to first screen", async () => { + await importAccount.validatePageIsLoaded(); + await importAccount.clickOnGoBack(); + await createOrImport.validatePageIsDisplayed(); + }); + + await test.step("Go to Import Account and Validate PIN settings options", async () => { + await createOrImport.clickImportAccount(); + await loginPinPage.goToPinSettings(); + await expect(loginPinPage.scrambleKeypadLabel).toBeVisible(); + await expect(loginPinPage.scrambleKeypadLabel).toHaveText( + "Scramble keypad?", + ); + await expect(loginPinPage.stayUnlockedLabel).toBeVisible(); + await expect(loginPinPage.stayUnlockedLabel).toHaveText("Stay unlocked?"); + }); + + await test.step("Validate scramble pad change the order of pin input buttons", async () => { + await loginPinPage.clickScrambleKeypadSwitch(); + const newKeyOrder = + await loginPinPage.pinKeypad.getAttribute("data-keyorder"); + expect(newKeyOrder).not.toEqual("1,2,3,4,5,6,7,8,9,0"); + }); + + await test.step("Scramble keypad is disabled again by the user and order of keys is restored", async () => { + await loginPinPage.clickScrambleKeypadSwitch(); + await expect(loginPinPage.pinKeypad).toHaveAttribute( + "data-keyorder", + "1,2,3,4,5,6,7,8,9,0", + ); + }); + + await test.step("PIN should have at least 4 digits otherwise continue button is disabled", async () => { + await loginPinPage.enterPin("123"); + await loginPinPage.validateConfirmButtonIsDisabled(); + }); + + await test.step("Validate user cannot Enter a PIN with more than 8 digits", async () => { + await loginPinPage.enterPin("12345678901234"); + const count = await loginPinPage.pinDotFilled.count(); + expect(count).toEqual(8); + }); + + await test.step("Red button should reset pin input", async () => { + await loginPinPage.buttonClearInput.click(); + const count = await loginPinPage.pinDotFilled.count(); + expect(count).toEqual(0); + }); + }); + + test("U7, U10 - Import Account From File Backup - Seed phrase from file", async ({ + enterPinUserContext, + }) => { + const page = enterPinUserContext.page; + const viewport = enterPinUserContext.viewport; + const chatsPage = new ChatsMainPage(page, viewport); + const createOrImport = new CreateOrImportPage(page, viewport); + const importAccount = new ImportAccountPage(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + + await test.step("Validate Create or Import Page is displayed and then click on Import Account", async () => { + await createOrImport.validatePageIsDisplayed(); + await createOrImport.clickImportAccount(); + }); + + await test.step("Dismiss installer download banner", async () => { + await createOrImport.dismissDownloadAlert(); + }); + + await test.step("Enter valid PIN", async () => { + await loginPinPage.enterDefaultPin(); + }); + + await test.step("Import account using a seed phrase from file", async () => { + await importAccount.validatePageIsLoaded(); + await importAccount.importAccountFromFile( + "file", + "playwright/assets/export.upk", + "playwright/assets/seed-phrase.txt", + ); + }); + + await test.step("After successful import from file, user is redirected to chats page", async () => { + await page.waitForURL("/chat"); + await chatsPage.validateChatsMainPageIsShown(); + }); + }); + + test("U8, U10 - Import Account From File Backup - Seed phrase entered manually", async ({ + enterPinUserContext, + }) => { + const page = enterPinUserContext.page; + const viewport = enterPinUserContext.viewport; + const chatsPage = new ChatsMainPage(page, viewport); + const createOrImport = new CreateOrImportPage(page, viewport); + const importAccount = new ImportAccountPage(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + + await test.step("Validate Create or Import Page is displayed and then click on Import Account", async () => { + await createOrImport.validatePageIsDisplayed(); + await createOrImport.clickImportAccount(); + }); + + await test.step("Dismiss installer download banner", async () => { + await createOrImport.dismissDownloadAlert(); + }); + + await test.step("Enter valid PIN", async () => { + await loginPinPage.enterDefaultPin(); + }); + + await test.step("Import account entering seed phrase manually ", async () => { + await importAccount.validatePageIsLoaded(); + const recoverySeedArray = await importAccount.readRecoveryPhraseFile( + "playwright/assets/seed-phrase.txt", + ); + await importAccount.importAccountFromFile( + "manual", + "playwright/assets/export.upk", + "", + recoverySeedArray, + ); + }); + + await test.step("After successful import entering seed phrase manually, user is redirected to chats page", async () => { + await page.waitForURL("/chat"); + await chatsPage.validateChatsMainPageIsShown(); + }); + }); + + test("U9 - Import Account - Provide wrong seed phrase", async ({ + enterPinUserContext, + }) => { + const page = enterPinUserContext.page; + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const importAccount = new ImportAccountPage(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + + await test.step("Validate Create or Import Page is displayed and then click on Import Account", async () => { + await createOrImport.validatePageIsDisplayed(); + await createOrImport.clickImportAccount(); + }); + + await test.step("Dismiss installer download banner", async () => { + await createOrImport.dismissDownloadAlert(); + }); + + await test.step("Enter valid PIN", async () => { + await loginPinPage.enterDefaultPin(); + }); + + await test.step("Import account entering seed phrase manually ", async () => { + await importAccount.validatePageIsLoaded(); + let invalidRecoverySeedArray = await importAccount.readRecoveryPhraseFile( + "playwright/assets/seed-phrase.txt", + ); + invalidRecoverySeedArray[invalidRecoverySeedArray.length - 1] = "invalid"; + await importAccount.importAccountFromFile( + "manual", + "playwright/assets/export.upk", + "", + invalidRecoverySeedArray, + ); + }); + + await test.step("Validate toast notification for wrong phrase is shown", async () => { + await importAccount.validateToastInvalidPhrase(); + }); + }); + + test("U12 - Export Account - Export account to File", async ({ + enterPinUserContext, + }) => { + const page = enterPinUserContext.page; + const viewport = enterPinUserContext.viewport; + const authNewAccount = new AuthNewAccount(page, viewport); + const chatsPage = new ChatsMainPage(page, viewport); + const createOrImport = new CreateOrImportPage(page, viewport); + const deleteAccount = new DeleteAccountModal(page, viewport); + const importAccount = new ImportAccountPage(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const settingsProfile = new SettingsProfile(page, viewport); + const username = + faker.person.firstName() + faker.number.int({ min: 100, max: 10000 }); + const status = faker.lorem.sentence(3); + + await test.step("Validate Create or Import Page is shown and then click on Create New Account", async () => { + await createOrImport.validatePageIsDisplayed(); + await createOrImport.clickCreateNewAccount(); + }); + + await test.step("Enter username and status and continue", async () => { + await authNewAccount.validateLoadingHeader(); + await authNewAccount.typeOnUsername(username); + await authNewAccount.typeOnStatus(status); + await authNewAccount.buttonNewAccountCreate.click(); + }); + + await test.step("Enter a valid pin and continue", async () => { + await loginPinPage.waitUntilPageIsLoaded(); + await loginPinPage.enterDefaultPin(); + }); + + await test.step("Save Recovery Seed file and continue", async () => { + await saveRecoverySeed.validatePageIsLoaded(); + await saveRecoverySeed.saveRecoverySeed(); + await saveRecoverySeed.clickOnSavedIt(); + }); + + await test.step("Go to settings profile", async () => { + // Once that user is in Chats page, go to Settings Profile + await page.waitForURL("/chat"); + await chatsPage.goToSettings(); + await page.waitForURL("/settings/profile"); + + // Hide sidebar if viewport is Mobile Chrome + if (viewport === "mobile-chrome") { + await chatsPage.buttonHideSidebar.click(); + } + }); + + await test.step("Validate Export Account Section contents", async () => { + await expect(settingsProfile.exportAccountSectionLabel).toHaveText( + "Export", + ); + await expect(settingsProfile.exportAccountSectionText).toHaveText( + "Export your account manually to a file.", + ); + }); + + await test.step("Validate user can export account to file", async () => { + await settingsProfile.exportAccountToFile(); + }); + + await test.step("Now Delete the Account so it can be restored from remote", async () => { + await settingsProfile.deleteAccount(); + await deleteAccount.enterDefaultPin(); + await createOrImport.validatePageIsDisplayed(); + }); + + await test.step("Validate Create or Import Page is displayed and then click on Import Account", async () => { + await createOrImport.validatePageIsDisplayed(); + await createOrImport.clickImportAccount(); + }); + + await test.step("Dismiss installer download banner", async () => { + await createOrImport.dismissDownloadAlert(); + }); + + await test.step("Enter valid PIN", async () => { + await loginPinPage.enterDefaultPin(); + }); + + /*await test.step("Import account using a seed phrase from file", async () => { + await importAccount.validatePageIsLoaded(); + await importAccount.importAccountFromFile( + "file", + "./downloads/export.upk", + "./downloads/seed-phrase.txt", + ); + }); + + await test.step("After successful import from file, user is redirected to chats page", async () => { + await page.waitForURL("/chat"); + await chatsPage.validateChatsMainPageIsShown(); + });*/ + }); +}); diff --git a/playwright/specs/07-settings-profile.spec.ts b/playwright/specs/07-settings-profile.spec.ts index fde0682..87903fc 100644 --- a/playwright/specs/07-settings-profile.spec.ts +++ b/playwright/specs/07-settings-profile.spec.ts @@ -591,7 +591,7 @@ test.describe("Settings Profile Tests", () => { }); await test.step("Click on Delete Account button and validate contents from modal prompt", async () => { - await settingsProfile.deleteAccountSectionButton.click(); + await settingsProfile.deleteAccount(); await expect(deleteAccount.textDeleteAccount).toHaveText( "This action will delete your account permanently", ); @@ -609,7 +609,7 @@ test.describe("Settings Profile Tests", () => { await test.step("Enter correct pin and validate account is deleted", async () => { await deleteAccount.enterDefaultPin(); - await createOrImport.labelCreateTitle.waitFor({ state: "attached" }); + await createOrImport.validatePageIsDisplayed(); await expect(createOrImport.labelCreateTitle).toHaveText( "Account Creation", );