53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import { login } from "./helpers";
|
|
|
|
describe("login", () => {
|
|
Cypress.on("uncaught:exception", (err, runnable) => {
|
|
// do not fail on failed requests during tests
|
|
return false;
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.manageCommand("cypress_reset");
|
|
});
|
|
|
|
it("can login to app with username/password", () => {
|
|
cy.visit("/");
|
|
|
|
cy.get("#username").type("admin");
|
|
cy.get("#password").type("test");
|
|
|
|
cy.get('[data-cy="login-button"]').click();
|
|
cy.request("/api/core/me").its("status").should("eq", 200);
|
|
|
|
cy.get('[data-cy="welcome-message"]').should(
|
|
"contain",
|
|
"Willkommen, Peter"
|
|
);
|
|
});
|
|
|
|
it("can login with helper function", () => {
|
|
login("admin", "test");
|
|
cy.visit("/");
|
|
cy.request("/api/core/me").its("status").should("eq", 200);
|
|
cy.get('[data-cy="welcome-message"]').should(
|
|
"contain",
|
|
"Willkommen, Peter"
|
|
);
|
|
});
|
|
|
|
it("login will redirect to requestet page", () => {
|
|
cy.visit("/course/versicherungsvermittler-in/learn");
|
|
cy.get("h1").should("contain", "Login");
|
|
|
|
cy.get("#username").type("admin");
|
|
cy.get("#password").type("test");
|
|
|
|
cy.get('[data-cy="login-button"]').click();
|
|
|
|
cy.get('[data-cy="learning-path-title"]').should(
|
|
"contain",
|
|
"Versicherungsvermittler"
|
|
);
|
|
});
|
|
});
|