diff --git a/cypress.json b/cypress.json
index 0f0f794..5ded01a 100644
--- a/cypress.json
+++ b/cypress.json
@@ -1,3 +1,3 @@
{
- "video": false
+ "video": true
}
diff --git a/cypress/integration/import-passphrase-page.ts b/cypress/integration/import-passphrase-page.ts
new file mode 100644
index 0000000..5cc8248
--- /dev/null
+++ b/cypress/integration/import-passphrase-page.ts
@@ -0,0 +1,78 @@
+import { cleanIndexedDB } from "../plugins/helpers/clean-indexed-db";
+import { elementNotExists } from "../plugins/helpers/element-not-exists";
+
+describe("ImportPassphrasePage", () => {
+ beforeEach(() => {
+ cleanIndexedDB();
+
+ cy.visit("http://localhost:8100");
+
+ goToPage();
+ });
+
+ it("should not show the import button initially", () => {
+ elementNotExists("page-wallet-import-passphrase", "[data-cy=import-button]");
+ });
+
+ it("should show a warning if the passwords do not match", () => {
+ cy.get("[data-cy=password-input] input").type("pass123");
+ cy.get("[data-cy=password-confirm-input] input").type("321ssap");
+
+ cy.get("[data-cy=password-error-box]");
+ });
+
+ it("should show a warning if the passphrase is invalid", () => {
+ cy.get("[data-cy=passphrase-input] textarea").type("bla bla bla");
+
+ cy.get("[data-cy=passphrase-error-box]");
+ });
+
+ it("should show the import button once all fields have been filled correctly", () => {
+ cy.get("[data-cy=passphrase-input] textarea").type("one two three");
+
+ cy.get("[data-cy=password-input] input").type("pass123");
+ cy.get("[data-cy=password-confirm-input] input").type("pass123");
+
+ cy.get("[data-cy=wallet-name-input] input").type("Wallet Name");
+
+ cy.get("[data-cy=import-button]").click();
+
+ cy.get("page-prepare-wallet");
+ });
+
+ it("should toggle the advanced options correctly", () => {
+ elementNotExists("page-wallet-import-passphrase", "[data-cy=wallet-index-input] input").then(
+ () => {
+ cy.get("[data-cy=toggle-advanced-button").click();
+
+ cy.get("[data-cy=wallet-index-input] input");
+
+ cy.get("[data-cy=toggle-advanced-button").click();
+
+ elementNotExists("page-wallet-import-passphrase", "[data-cy=wallet-index-input] input");
+ }
+ );
+ });
+
+ it("should show a warning when entering incorrect address index input", () => {
+ cy.get("[data-cy=toggle-advanced-button").click();
+
+ cy.get("[data-cy=wallet-index-input] input").clear();
+
+ cy.get("[data-cy=wallet-index-input] input").type("wrong input");
+
+ cy.get("[data-cy=wallet-index-error-box]");
+
+ cy.get("[data-cy=wallet-index-input] input").clear();
+
+ cy.get("[data-cy=wallet-index-input] input").type("100");
+
+ elementNotExists("page-wallet-import-passphrase", "[data-cy=wallet-index-error-box]");
+ });
+
+ function goToPage() {
+ cy.get("[data-cy=restore-backup-button]").click();
+
+ cy.get("[data-cy=import-passphrase-button]").click();
+ }
+});
\ No newline at end of file
diff --git a/cypress/integration/import-private-key-page.ts b/cypress/integration/import-private-key-page.ts
index 0f3816a..9742940 100644
--- a/cypress/integration/import-private-key-page.ts
+++ b/cypress/integration/import-private-key-page.ts
@@ -5,11 +5,11 @@ describe("ImportPrivateKeyPage", () => {
cleanIndexedDB();
cy.visit("http://localhost:8100");
- });
- it("should not show the import button initially", () => {
goToPage();
+ });
+ it("should not show the import button initially", () => {
cy.get("page-wallet-import-privatekey").then(
(page) => {
expect(page.find("[data-cy=import-privatekey-button]")).to.have.length(0);
@@ -18,8 +18,6 @@ describe("ImportPrivateKeyPage", () => {
});
it("should show a password warning if the passwords do not match", () => {
- goToPage();
-
cy.get("[data-cy=password-input] input").type("pass123");
cy.get("[data-cy=password-confirm-input] input").type("321ssap");
@@ -27,8 +25,6 @@ describe("ImportPrivateKeyPage", () => {
});
it("should show the import button once all fields have been filled correctly", () => {
- goToPage();
-
cy.get("[data-cy=private-key-input] textarea").type("PrivateKey");
cy.get("[data-cy=wallet-name-input] input").type("Wallet Name");
cy.get("[data-cy=password-input] input").type("pass123");
@@ -41,8 +37,6 @@ describe("ImportPrivateKeyPage", () => {
});
it("should show a password explanation dialog", () => {
- goToPage();
-
// Open modal
cy.get("[data-cy=password-explanation]").click();
@@ -53,7 +47,7 @@ describe("ImportPrivateKeyPage", () => {
cy.get("[data-cy=password-explain-ok-button]").click();
// Wait to allow the modal animation to end
- cy.wait(2000);
+ cy.wait(10000);
cy.get("body").then(
(body) => {
diff --git a/cypress/plugins/helpers/clean-indexed-db.ts b/cypress/plugins/helpers/clean-indexed-db.ts
index 4e7ced2..069f966 100644
--- a/cypress/plugins/helpers/clean-indexed-db.ts
+++ b/cypress/plugins/helpers/clean-indexed-db.ts
@@ -1,3 +1,5 @@
+///