2020-02-18 08:57:00 +01:00
|
|
|
import onBeforeLoad from "./browser-language";
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
describe("Registration", () => {
|
|
|
|
it("Tests that everything is present", () => {
|
|
|
|
cy.visit("/register/user", { onBeforeLoad });
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.get("form .field").first().contains("label", "Email");
|
|
|
|
cy.get("form .field").eq(1).contains("label", "Password");
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.get("input[type=email]").click();
|
|
|
|
cy.get("input[type=password]").type("short").should("have.value", "short");
|
|
|
|
cy.get("form").contains("button.button.is-primary", "Register");
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
cy.get("form")
|
|
|
|
.contains(".control a.button", "Didn't receive the instructions ?")
|
|
|
|
.click();
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.url().should("include", "/resend-instructions");
|
|
|
|
cy.go("back");
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
cy.get("form")
|
|
|
|
.get(".control a.button")
|
|
|
|
.contains("Login")
|
|
|
|
.click({ force: true });
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.url().should("include", "/login");
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.go("back");
|
2019-10-05 19:07:50 +02:00
|
|
|
});
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
it("Tests that registration works", () => {
|
|
|
|
cy.visit("/register/user", { onBeforeLoad });
|
|
|
|
cy.get("input[type=email]").type("user2register@email.com");
|
|
|
|
cy.get("input[type=password]").type("userPassword");
|
|
|
|
cy.get("form").contains("button.button.is-primary", "Register").click();
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.url().should("include", "/register/profile");
|
|
|
|
cy.get("form > .field")
|
|
|
|
.eq(1)
|
|
|
|
.contains("label", "Username")
|
|
|
|
.parent()
|
|
|
|
.find("input")
|
|
|
|
.type("tester");
|
|
|
|
cy.get("form > .field")
|
|
|
|
.first()
|
|
|
|
.contains("label", "Display name")
|
|
|
|
.parent()
|
|
|
|
.find("input")
|
|
|
|
.type("tester account");
|
|
|
|
cy.get("form > .field")
|
|
|
|
.eq(2)
|
|
|
|
.contains("label", "Description")
|
|
|
|
.parent()
|
|
|
|
.find("textarea")
|
|
|
|
.type("This is a test account");
|
2020-11-30 10:24:11 +01:00
|
|
|
cy.get(".control.has-text-centered")
|
|
|
|
.contains("button", "Create my profile")
|
|
|
|
.click();
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
cy.contains(
|
|
|
|
"article.message.is-success",
|
|
|
|
"Your account is nearly ready, tester"
|
|
|
|
).contains("A validation email was sent to user2register@email.com");
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.visit("/sent_emails");
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
cy.get("iframe")
|
|
|
|
.first()
|
|
|
|
.iframeLoaded()
|
|
|
|
.its("document")
|
|
|
|
.getInDocument("a")
|
|
|
|
.eq(1)
|
|
|
|
.contains("Activate my account")
|
|
|
|
.invoke("attr", "href")
|
|
|
|
.then((href) => {
|
|
|
|
cy.visit(href);
|
|
|
|
});
|
2019-10-05 19:07:50 +02:00
|
|
|
|
|
|
|
// cy.url().should('include', '/validate/');
|
|
|
|
// cy.contains('Your account is being validated');
|
|
|
|
cy.location().should((loc) => {
|
2020-02-18 08:57:00 +01:00
|
|
|
expect(loc.pathname).to.eq("/");
|
2019-10-05 19:07:50 +02:00
|
|
|
});
|
2019-10-07 13:47:46 +02:00
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
cy.get(".navbar-link span.icon i").should(
|
|
|
|
"have.class",
|
|
|
|
"mdi-account-circle"
|
|
|
|
);
|
|
|
|
cy.contains(
|
|
|
|
"article.message.is-info",
|
|
|
|
"Welcome to Mobilizon, tester account!"
|
|
|
|
);
|
2019-10-05 19:07:50 +02:00
|
|
|
});
|
2020-02-18 08:57:00 +01:00
|
|
|
});
|