2020-08-20 13:36:00 +00:00
|
|
|
import "./user";
|
2021-01-19 21:17:49 +00:00
|
|
|
import "./softAsserations";
|
2020-07-20 09:42:44 +00:00
|
|
|
|
|
|
|
Cypress.Commands.add("clearSessionData", () => {
|
|
|
|
// Because of known cypress bug, not all local storage data are cleared.
|
|
|
|
// Here is workaround to ensure tests have no side effects.
|
|
|
|
// Suggested usage:
|
|
|
|
|
|
|
|
// beforeEach(() => {
|
|
|
|
// cy.clearSessionData();
|
|
|
|
// });
|
|
|
|
|
|
|
|
cy.clearCookies();
|
|
|
|
cy.clearLocalStorage();
|
|
|
|
cy.visit("/", {
|
|
|
|
onBeforeLoad: win => {
|
|
|
|
win.sessionStorage.clear();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2021-01-27 09:41:55 +00:00
|
|
|
|
|
|
|
Cypress.Commands.add("sendRequestWithQuery", query =>
|
|
|
|
cy.request({
|
|
|
|
method: "POST",
|
|
|
|
body: {
|
|
|
|
method: "POST",
|
|
|
|
url: Cypress.env("API_URI"),
|
|
|
|
query
|
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
Authorization: `JWT ${window.sessionStorage.getItem("auth")}`
|
|
|
|
},
|
|
|
|
url: Cypress.env("API_URI")
|
|
|
|
})
|
|
|
|
);
|