Merge branch 'master' into maintenance
This commit is contained in:
commit
7fd5a96bcf
2 files changed
+17
-5
No files matched your search
@@ -1,4 +1,10 @@
|
||||
import {prepare_server, await_coreui, await_loginui, login} from "../util/util";
|
||||
import {
|
||||
prepare_server,
|
||||
await_coreui,
|
||||
await_loginui,
|
||||
login,
|
||||
get_cookie_name
|
||||
} from "../util/util";
|
||||
|
||||
context("Login tests", () => {
|
||||
const username = "admin";
|
||||
@@ -27,8 +33,8 @@ context("Login tests", () => {
|
||||
await_coreui();
|
||||
|
||||
cy.get("[data-test-id=login-menu-title]").should("contain", username);
|
||||
cy.getCookie("session_P5000").should("exist");
|
||||
cy.getCookie("remember_token_P5000").should("not.exist");
|
||||
cy.getCookie(get_cookie_name("session")).should("exist");
|
||||
cy.getCookie(get_cookie_name("remember_token")).should("not.exist");
|
||||
cy.location().should((loc) => {
|
||||
expect(loc.hash).to.eq("#temp");
|
||||
});
|
||||
@@ -45,8 +51,8 @@ context("Login tests", () => {
|
||||
await_coreui();
|
||||
|
||||
cy.get("[data-test-id=login-menu-title]").should("contain", username);
|
||||
cy.getCookie("session_P5000").should("exist");
|
||||
cy.getCookie("remember_token_P5000").should(($cookie) => {
|
||||
cy.getCookie(get_cookie_name("session")).should("exist");
|
||||
cy.getCookie(get_cookie_name("remember_token")).should(($cookie) => {
|
||||
expect($cookie).to.have.property("value");
|
||||
expect($cookie.value).to.match(new RegExp("^" + username + "|"));
|
||||
});
|
||||
|
||||
@@ -70,3 +70,9 @@ export const ensure_file_unknown = (location, name) => {
|
||||
failOnStatusCode: false
|
||||
});
|
||||
};
|
||||
|
||||
export const get_cookie_name = (cookie) => {
|
||||
const url = new URL(Cypress.config("baseUrl"));
|
||||
const port = url.port || (url.protocol === "https:" ? 443 : 80);
|
||||
return `${cookie}_P${port}`;
|
||||
};
|
||||
Reference in new issue
Block a user