47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
import { login } from "./helpers";
|
|
|
|
describe("login.cy.js", () => {
|
|
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("test-student1@example.com");
|
|
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, Test");
|
|
});
|
|
|
|
it("can login with helper function", () => {
|
|
login("test-student1@example.com", "test");
|
|
cy.visit("/");
|
|
cy.request("/api/core/me").its("status").should("eq", 200);
|
|
cy.get('[data-cy="welcome-message"]').should("contain", "Willkommen, Test");
|
|
});
|
|
|
|
it("login will redirect to requestet page", () => {
|
|
cy.visit("/course/test-lehrgang/learn");
|
|
cy.get("h1").should("contain", "Login");
|
|
|
|
cy.get("#username").type("test-student1@example.com");
|
|
cy.get("#password").type("test");
|
|
|
|
cy.get('[data-cy="login-button"]').click();
|
|
|
|
cy.get('[data-cy="learning-path-title"]').should(
|
|
"contain",
|
|
"Test Lehrgang"
|
|
);
|
|
});
|
|
});
|