48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
import { login } from "./helpers";
|
|
|
|
describe("login", () => {
|
|
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("/learningpath/versicherungsvermittlerin");
|
|
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"
|
|
);
|
|
});
|
|
});
|