test: Clear session data on logout
This commit is contained in:
parent
95f59234ca
commit
413f4915e8
4 changed files with 9 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
context("Login", () => {
|
||||
beforeEach(() => {
|
||||
cy.request("/api/method/logout");
|
||||
cy.call("logout");
|
||||
cy.visit("/login");
|
||||
cy.location("pathname").should("eq", "/login");
|
||||
});
|
||||
|
|
@ -48,7 +48,7 @@ context("Login", () => {
|
|||
base64_string: "aGVsbG8gYWxs",
|
||||
});
|
||||
|
||||
cy.request("/api/method/logout");
|
||||
cy.call("logout");
|
||||
|
||||
// redirect-to /me page with params to mock OAuth 2.0 like request
|
||||
cy.visit(
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ context("Navigation", () => {
|
|||
cy.visit("/app/todo");
|
||||
cy.get(".page-head").findByTitle("To Do").should("be.visible");
|
||||
cy.clear_filters();
|
||||
cy.request("/api/method/logout");
|
||||
cy.call("logout");
|
||||
cy.reload().as("reload");
|
||||
cy.get("@reload").get(".page-card .btn-primary").contains("Login").click();
|
||||
cy.location("pathname").should("eq", "/login");
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ context("Web Form", () => {
|
|||
|
||||
cy.url().should("include", "/note/new");
|
||||
|
||||
cy.request("/api/method/logout");
|
||||
cy.call("logout");
|
||||
cy.visit("/note");
|
||||
|
||||
cy.url().should("include", "/note/new");
|
||||
|
|
@ -49,6 +49,7 @@ context("Web Form", () => {
|
|||
});
|
||||
|
||||
it("Login Required", () => {
|
||||
cy.call("logout");
|
||||
cy.login("Administrator");
|
||||
cy.visit("/app/web-form/note");
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ Cypress.Commands.add("login", (email, password) => {
|
|||
email = Cypress.config("testUser") || "Administrator";
|
||||
}
|
||||
if (!password) {
|
||||
password = Cypress.env("adminPassword") || "admin";
|
||||
password = Cypress.env("adminPassword");
|
||||
}
|
||||
cy.session(
|
||||
[email, password] || "",
|
||||
|
|
@ -70,6 +70,9 @@ Cypress.Commands.add("call", (method, args) => {
|
|||
})
|
||||
.then((res) => {
|
||||
expect(res.status).eq(200);
|
||||
if (method === "logout") {
|
||||
Cypress.session.clearAllSavedSessions();
|
||||
}
|
||||
return res.body;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue