Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
piyalbasu committed Jan 12, 2024
1 parent e1f47db commit ac2acfc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ module.exports = {
chrome: "readonly",
DEV_SERVER: "readonly",
},
ignorePatterns: ["dist/", "node_modules/", "build/", "__mocks__/"],
ignorePatterns: [
"dist/",
"node_modules/",
"build/",
"__mocks__/",
"e2e-tests/",
],
overrides: [
{
files: ["webpack.*.js"],
Expand Down
51 changes: 50 additions & 1 deletion extension/e2e-tests/onboarding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test("Create new wallet", async ({ page }) => {
await expect(page).toHaveScreenshot("wallet-create-complete-page.png");
});

test("Import wallet", async ({ page }) => {
test("Import 12 word wallet", async ({ page }) => {
await expect(page).toHaveScreenshot("welcome-page.png");
await page.getByText("Import Wallet").click();
await expect(
Expand Down Expand Up @@ -89,6 +89,55 @@ test("Import wallet", async ({ page }) => {
await expect(page).toHaveScreenshot("wallet-import-complete-page.png");
});

test("Import 24 word wallet", async ({ page }) => {
await expect(page).toHaveScreenshot("welcome-page.png");
await page.getByText("Import Wallet").click();
await expect(
page.getByText("Import wallet from recovery phrase"),
).toBeVisible();
await page.locator(".RecoverAccount__phrase-toggle > label").click();
await page.waitForTimeout(150);

const TEST_WORDS = [
"shrug",
"absent",
"sausage",
"later",
"salute",
"mesh",
"increase",
"flavor",
"pilot",
"patch",
"pole",
"twenty",
"chef",
"coffee",
"faint",
"apology",
"crucial",
"scene",
"attend",
"replace",
"wolf",
"error",
"swift",
"device",
];

for (let i = 1; i <= TEST_WORDS.length; i++) {
await page.locator(`#MnemonicPhrase-${i}`).fill(TEST_WORDS[i - 1]);
}

await page.locator("#password-input").fill("My-password123");
await page.locator("#confirm-password-input").fill("My-password123");
await page.locator("#termsOfUse-input").check({ force: true });
await page.getByRole("button", { name: "Import" }).click();

await expect(page.getByText("Wallet created successfully!")).toBeVisible();
await expect(page).toHaveScreenshot("wallet-import-complete-page.png");
});

test("Import wallet with wrong password", async ({ page }) => {
await expect(page).toHaveScreenshot("welcome-page.png");
await page.getByText("Import Wallet").click();
Expand Down

0 comments on commit ac2acfc

Please sign in to comment.