mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 22:41:37 +02:00
👷 Add e2e test to profile area
This commit is contained in:
parent
bc2a0432b9
commit
f185836fd4
31 changed files with 412 additions and 206 deletions
|
@ -9,33 +9,31 @@
|
|||
"use strict";
|
||||
|
||||
describe("account creation", () => {
|
||||
let validUser
|
||||
let validUser;
|
||||
|
||||
beforeEach(() => {
|
||||
cy.fixture('validuser.json').then((user) => {
|
||||
cy.fixture("validuser.json").then((user) => {
|
||||
validUser = user;
|
||||
});
|
||||
cy.visit("http://localhost:3449/#/auth/login");
|
||||
cy.get("a").contains("Create an account").click()
|
||||
cy.getBySel("register-submit").click();
|
||||
});
|
||||
|
||||
it("displays the account creation form", () => {
|
||||
cy.get("input[type=submit]").contains("Create an account").should("exist");
|
||||
cy.getBySel("register-form-submit").should("exist");
|
||||
});
|
||||
|
||||
it("create an account of an existent email fails", () => {
|
||||
cy.get("#email").type(validUser.email);
|
||||
cy.get("#password").type("anewpassword");
|
||||
cy.get("input[type=submit]").contains("Create an account").click();
|
||||
cy.get(".error").should("contain", "Email already used")
|
||||
cy.getBySel("register-form-submit").click();
|
||||
cy.getBySel("email-input-error").should("exist");
|
||||
});
|
||||
|
||||
|
||||
it("can go back", () => {
|
||||
cy.get("a").contains("Login here").click()
|
||||
cy.contains("Great to see you again!").should("exist");
|
||||
cy.getBySel("login-here-link").click();
|
||||
cy.getBySel("login-title").should("exist");
|
||||
cy.get("#email").should("exist");
|
||||
cy.get("#password").should("exist");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
|
||||
describe("demo account", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://localhost:3449/#/auth/login");
|
||||
cy.visit("http://localhost:3449/#/auth/login");
|
||||
});
|
||||
|
||||
it.only("create demo account", () => {
|
||||
cy.get("a").contains("Create demo account").click()
|
||||
cy.get(".profile").contains("Demo User")
|
||||
it("create demo account", () => {
|
||||
cy.getBySel("demo-account-link").should("exist");
|
||||
cy.getBySel("demo-account-link").click();
|
||||
cy.get(".profile").contains("Demo User");
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -14,7 +14,7 @@ describe("login", () => {
|
|||
});
|
||||
|
||||
it("displays the login form", () => {
|
||||
cy.contains("Great to see you again!").should("exist");
|
||||
cy.getBySel("login-title").should("exist");
|
||||
cy.get("#email").should("exist");
|
||||
cy.get("#password").should("exist");
|
||||
});
|
||||
|
@ -22,20 +22,17 @@ describe("login", () => {
|
|||
it("can't login with an invalid user", () => {
|
||||
cy.get("#email").type("bad@mail.com");
|
||||
cy.get("#password").type("badpassword");
|
||||
cy.get("input[type=submit]").first().click();
|
||||
cy.get(".warning")
|
||||
.should("exist")
|
||||
.should("contain", "Username or password seems to be wrong.");
|
||||
cy.getBySel("login-submit").click();
|
||||
cy.getBySel("login-banner").should("exist");
|
||||
});
|
||||
|
||||
it("can login with a valid user", () => {
|
||||
cy.fixture('validuser.json').then((user) => {
|
||||
cy.fixture("validuser.json").then((user) => {
|
||||
cy.get("#email").type(user.email);
|
||||
cy.get("#password").type(user.password);
|
||||
});
|
||||
|
||||
cy.get("input[type=submit]").first().click();
|
||||
|
||||
cy.getBySel("login-submit").click();
|
||||
cy.get(".dashboard-layout").should("exist");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -11,36 +11,31 @@
|
|||
describe("recover password", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://localhost:3449/#/auth/login");
|
||||
cy.get("a").contains("Forgot password?").click()
|
||||
cy.getBySel("forgot-password").click();
|
||||
});
|
||||
|
||||
it("displays the recover form", () => {
|
||||
cy.get("input[type=submit]").contains("Recover Password").should("exist");
|
||||
cy.getBySel("recovery-resquest-submit").should("exist");
|
||||
});
|
||||
|
||||
it("recover password with wrong mail works", () => {
|
||||
cy.get("#email").type("bad@mail.com");
|
||||
cy.get("input[type=submit]").contains("Recover Password").click();
|
||||
cy.get(".info")
|
||||
.should("exist")
|
||||
.should("contain", "Password recovery link sent to your inbox.");
|
||||
cy.getBySel("recovery-resquest-submit").click();
|
||||
cy.get(".info").should("exist");
|
||||
});
|
||||
|
||||
it("recover password with good mail works", () => {
|
||||
cy.fixture('validuser.json').then((user) => {
|
||||
cy.fixture("validuser.json").then((user) => {
|
||||
cy.get("#email").type(user.email);
|
||||
});
|
||||
cy.get("input[type=submit]").contains("Recover Password").click();
|
||||
cy.get(".info")
|
||||
.should("exist")
|
||||
.should("contain", "Password recovery link sent to your inbox.");
|
||||
});
|
||||
cy.getBySel("recovery-resquest-submit").click();
|
||||
cy.get(".info").should("exist");
|
||||
});
|
||||
|
||||
it("can go back", () => {
|
||||
cy.get("a").contains("Go back").click()
|
||||
cy.contains("Great to see you again!").should("exist");
|
||||
cy.getBySel("go-back-link").click();
|
||||
cy.getBySel("login-title").should("exist");
|
||||
cy.get("#email").should("exist");
|
||||
cy.get("#password").should("exist");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue