2021-09-27 10:04:21 +00:00
|
|
|
// / <reference types="cypress" />
|
|
|
|
|
|
|
|
import "./customCommands/user";
|
|
|
|
import "./customCommands/basicOperations";
|
|
|
|
import "./customCommands/deleteElementsViaApi";
|
|
|
|
import "./customCommands/softAssertions";
|
|
|
|
import "./customCommands/sharedElementsOperations/addressForm.js";
|
|
|
|
import "./customCommands/sharedElementsOperations/assignElementsForm.js";
|
|
|
|
import "./customCommands/sharedElementsOperations/confirmationMessages.js";
|
|
|
|
import "./customCommands/sharedElementsOperations/progressBar.js";
|
|
|
|
import "./customCommands/sharedElementsOperations/selects.js";
|
|
|
|
import "./customCommands/sharedElementsOperations/tables";
|
2022-01-14 10:08:25 +00:00
|
|
|
import "./customCommands/sharedElementsOperations/deleteElement";
|
2021-06-07 11:35:53 +00:00
|
|
|
import "cypress-mailhog";
|
2021-10-14 10:47:41 +00:00
|
|
|
import "cypress-file-upload";
|
2022-03-03 10:25:27 +00:00
|
|
|
import "cypress-mochawesome-reporter/register";
|
|
|
|
|
|
|
|
import { commandTimings } from "cypress-timings";
|
2022-06-27 09:30:51 +00:00
|
|
|
|
|
|
|
import cypressGrep from "../support/cypress-grep/support";
|
2022-03-03 10:25:27 +00:00
|
|
|
commandTimings();
|
2020-07-20 09:42:44 +00:00
|
|
|
|
2021-09-27 10:04:21 +00:00
|
|
|
import { urlList } from "../fixtures/urlList";
|
2021-02-11 13:58:05 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
cypressGrep();
|
|
|
|
|
2020-07-20 09:42:44 +00:00
|
|
|
Cypress.Commands.add("clearSessionData", () => {
|
|
|
|
cy.clearCookies();
|
|
|
|
cy.clearLocalStorage();
|
|
|
|
});
|
2021-01-27 09:41:55 +00:00
|
|
|
|
2021-02-23 12:09:58 +00:00
|
|
|
Cypress.Commands.add("addAliasToGraphRequest", operationName => {
|
2021-02-11 14:17:00 +00:00
|
|
|
cy.intercept("POST", urlList.apiUri, req => {
|
2021-02-11 13:58:05 +00:00
|
|
|
req.statusCode = 200;
|
|
|
|
const requestBody = req.body;
|
|
|
|
if (Array.isArray(requestBody)) {
|
|
|
|
requestBody.forEach(element => {
|
|
|
|
if (element.operationName === operationName) {
|
|
|
|
req.alias = operationName;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
if (requestBody.operationName === operationName) {
|
|
|
|
req.alias = operationName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-03-09 15:22:36 +00:00
|
|
|
Cypress.Commands.add(
|
|
|
|
"sendRequestWithQuery",
|
|
|
|
(query, authorization = "auth", variables = "") =>
|
2022-06-06 08:47:39 +00:00
|
|
|
cy
|
|
|
|
.request({
|
|
|
|
body: {
|
|
|
|
variables,
|
2022-06-27 16:49:35 +00:00
|
|
|
query,
|
2022-06-06 08:47:39 +00:00
|
|
|
},
|
|
|
|
headers: {
|
2022-06-27 16:49:35 +00:00
|
|
|
Authorization: `JWT ${window.sessionStorage.getItem(authorization)}`,
|
2022-06-06 08:47:39 +00:00
|
|
|
},
|
|
|
|
method: "POST",
|
|
|
|
url: urlList.apiUri,
|
2022-06-27 16:49:35 +00:00
|
|
|
log: true,
|
2022-06-06 08:47:39 +00:00
|
|
|
})
|
|
|
|
.then(response => {
|
|
|
|
const respInSting = JSON.stringify(response.body);
|
|
|
|
if (respInSting.includes(`"errors":[{`)) {
|
|
|
|
cy.log(query).log(JSON.stringify(response.body));
|
|
|
|
}
|
2022-06-27 16:49:35 +00:00
|
|
|
}),
|
2021-01-27 09:41:55 +00:00
|
|
|
);
|
2021-05-16 11:38:53 +00:00
|
|
|
Cypress.on(
|
|
|
|
"uncaught:exception",
|
|
|
|
(err, runnable) =>
|
|
|
|
// returning false here prevents Cypress from
|
|
|
|
// failing the test
|
2022-06-27 16:49:35 +00:00
|
|
|
false,
|
2021-05-16 11:38:53 +00:00
|
|
|
);
|