End-to-end login test
This finishes the e2e login test, and adds lock/unlock testing. It also fixes an error the locking test caught (for accounts with no items), and caching of node_modules when testing, for faster results.
This commit is contained in:
parent
5ca373993a
commit
1819f36c66
|
@ -10,6 +10,23 @@ jobs:
|
|||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.npm
|
||||
~/.nvm
|
||||
node_modules
|
||||
packages/app/node_modules
|
||||
packages/cordova/node_modules
|
||||
packages/core/node_modules
|
||||
packages/electron/node_modules
|
||||
packages/extension/node_modules
|
||||
packages/locale/node_modules
|
||||
packages/manage/node_modules
|
||||
packages/pwa/node_modules
|
||||
packages/server/node_modules
|
||||
packages/tauri/node_modules
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm i -g npm@8.2.0
|
||||
|
|
|
@ -3,15 +3,15 @@ describe("Signup/Login", () => {
|
|||
cy.signup();
|
||||
});
|
||||
|
||||
// it("can login without errors", () => {
|
||||
// cy.login();
|
||||
// });
|
||||
it("can login without errors", () => {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
// it("can unlock without errors", () => {
|
||||
// cy.login();
|
||||
it("can lock/unlock without errors", () => {
|
||||
cy.login();
|
||||
|
||||
// cy.lock();
|
||||
cy.lock();
|
||||
|
||||
// cy.unlock();
|
||||
// });
|
||||
cy.unlock();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@ Cypress.Commands.add("signup", () => {
|
|||
.type(emailToken, { force: true });
|
||||
|
||||
// Confirm token
|
||||
cy.get("pl-app").find("pl-prompt-dialog").find("pl-button#confirmButton").find("button").click({ force: true });
|
||||
cy.get("pl-app").find("pl-prompt-dialog").find("pl-button#confirmButton").click({ force: true });
|
||||
|
||||
// Enter name
|
||||
cy.get("pl-app")
|
||||
|
@ -47,7 +47,12 @@ Cypress.Commands.add("signup", () => {
|
|||
.type("The Dude", { force: true });
|
||||
|
||||
// Accept TOS
|
||||
cy.get("pl-app").find("pl-start").find("pl-login-signup").find("pl-drawer:eq(2)").find("input#tosCheckbox").click();
|
||||
cy.get("pl-app")
|
||||
.find("pl-start")
|
||||
.find("pl-login-signup")
|
||||
.find("pl-drawer:eq(2)")
|
||||
.find("input#tosCheckbox")
|
||||
.click({ force: true });
|
||||
|
||||
// Continue
|
||||
cy.get("pl-app").find("pl-start").find("pl-login-signup").find("pl-button:eq(2)").click({ force: true });
|
||||
|
@ -61,7 +66,7 @@ Cypress.Commands.add("signup", () => {
|
|||
.click({ force: true });
|
||||
|
||||
// Choose my own
|
||||
cy.get("pl-app").find("pl-alert-dialog").find("pl-button:eq(2)").find("button").click({ force: true });
|
||||
cy.get("pl-app").find("pl-alert-dialog").find("pl-button:eq(2)").click({ force: true });
|
||||
|
||||
// Type master password
|
||||
cy.get("pl-app")
|
||||
|
@ -71,13 +76,13 @@ Cypress.Commands.add("signup", () => {
|
|||
.type(password, { force: true });
|
||||
|
||||
// Confirm master password
|
||||
cy.get("pl-app").find("pl-prompt-dialog").find("pl-button#confirmButton").find("button").click({ force: true });
|
||||
cy.get("pl-app").find("pl-prompt-dialog").find("pl-button#confirmButton").click({ force: true });
|
||||
|
||||
// Give the app some time to render the alert, otherwise it sometimes shows out of place
|
||||
cy.wait(100);
|
||||
|
||||
// Confirm weak password
|
||||
cy.get("pl-app").find("pl-alert-dialog").find("pl-button:eq(1)").find("button").click({ force: true });
|
||||
cy.get("pl-app").find("pl-alert-dialog").find("pl-button:eq(1)").click({ force: true });
|
||||
|
||||
// Continue signup
|
||||
cy.get("pl-app")
|
||||
|
@ -139,32 +144,42 @@ Cypress.Commands.add("login", () => {
|
|||
.find("pl-start")
|
||||
.find("pl-login-signup")
|
||||
.find("pl-button#submitEmailButton")
|
||||
.find("button")
|
||||
.click({ force: true });
|
||||
|
||||
// Give the app some time to render the animations
|
||||
cy.wait(100);
|
||||
|
||||
cy.get("pl-app")
|
||||
.find("pl-prompt-dialog")
|
||||
.find("pl-input")
|
||||
.find("input[placeholder='Enter Verification Code']")
|
||||
.type(emailToken, { force: true });
|
||||
|
||||
cy.get("pl-app").find("pl-prompt-dialog").find("pl-button#confirmButton").find("button").click({ force: true });
|
||||
cy.get("pl-app").find("pl-prompt-dialog").find("pl-button#confirmButton").click({ force: true });
|
||||
|
||||
// Give the app some time to render the animations
|
||||
cy.wait(100);
|
||||
|
||||
cy.get("pl-app")
|
||||
.find("pl-start")
|
||||
.find("pl-unlock")
|
||||
.find("pl-password-input#passwordInput")
|
||||
.find("pl-login-signup")
|
||||
.find("pl-drawer:eq(3)")
|
||||
.find("pl-password-input#loginPasswordInput")
|
||||
.find("input[type='password']")
|
||||
.type(password);
|
||||
.type(password, { force: true });
|
||||
|
||||
cy.get("pl-app")
|
||||
.find("pl-start")
|
||||
.find("pl-unlock")
|
||||
.find("pl-button#unlockButton")
|
||||
.find("button")
|
||||
.find("pl-login-signup")
|
||||
.find("pl-drawer:eq(3)")
|
||||
.find("pl-button#loginButton")
|
||||
.click({ force: true });
|
||||
|
||||
// TODO: "Trust device"
|
||||
// Give the app some time to render the animations
|
||||
cy.wait(100);
|
||||
|
||||
// Add trusted device
|
||||
cy.get("pl-app").find("pl-alert-dialog").find("pl-button:eq(0)").click({ force: true });
|
||||
|
||||
cy.url().should("include", "/items");
|
||||
});
|
||||
|
@ -173,15 +188,10 @@ Cypress.Commands.add("lock", () => {
|
|||
cy.visit("/");
|
||||
|
||||
// Open menu
|
||||
cy.get("pl-app")
|
||||
.find("pl-items")
|
||||
.find("pl-items-list")
|
||||
.find("pl-button.menu-button:eq(0)")
|
||||
.find("button")
|
||||
.click({ force: true });
|
||||
cy.get("pl-app").find("pl-items").find("pl-items-list").find("pl-button.menu-button:eq(0)").click({ force: true });
|
||||
|
||||
// Click lock
|
||||
cy.get("pl-app").find("pl-menu").find("pl-button.menu-footer-button:eq(0)").find("button").click({ force: true });
|
||||
cy.get("pl-app").find("pl-menu").find("pl-button.menu-footer-button:eq(0)").click({ force: true });
|
||||
|
||||
cy.url().should("include", "/unlock");
|
||||
});
|
||||
|
@ -191,6 +201,9 @@ Cypress.Commands.add("unlock", () => {
|
|||
|
||||
const { email, password } = Cypress.env();
|
||||
|
||||
// Give the app some time to render the animations
|
||||
cy.wait(100);
|
||||
|
||||
cy.get("pl-app")
|
||||
.find("pl-start")
|
||||
.find("pl-unlock")
|
||||
|
@ -198,19 +211,17 @@ Cypress.Commands.add("unlock", () => {
|
|||
.find("input")
|
||||
.should("have.value", email);
|
||||
|
||||
// Give the app some time to render the animations
|
||||
cy.wait(100);
|
||||
|
||||
cy.get("pl-app")
|
||||
.find("pl-start")
|
||||
.find("pl-unlock")
|
||||
.find("pl-password-input#passwordInput")
|
||||
.find("input[type='password']")
|
||||
.type(password);
|
||||
.type(password, { force: true });
|
||||
|
||||
cy.get("pl-app")
|
||||
.find("pl-start")
|
||||
.find("pl-unlock")
|
||||
.find("pl-button#unlockButton")
|
||||
.find("button")
|
||||
.click({ force: true });
|
||||
cy.get("pl-app").find("pl-start").find("pl-unlock").find("pl-button#unlockButton").click({ force: true });
|
||||
|
||||
cy.url().should("include", "/items");
|
||||
});
|
||||
|
|
|
@ -477,7 +477,7 @@ export class App {
|
|||
* Locks the app and wipes all sensitive information from memory.
|
||||
*/
|
||||
async lock() {
|
||||
[this.account!, ...this.state.orgs, ...this.state.vaults].forEach((each) => each.lock());
|
||||
[this.account!, ...this.state.orgs, ...this.state.vaults].forEach((each) => each && each.lock());
|
||||
this.publish();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue