saleor-dashboard/cypress/support/index.js
Karolina Rakoczy f85786f203
Run critical tests after test env deployment (#1902)
* run critical tests after test env deployment

* add cache

* add all branches

* change workflow name

* add run on pull request for testing

* change type

* add run on deployment

* run on copleted

* test critical

* add quote

* change baseUrl

* fix base url

* fix base url

* upload reports

* run in parallel

* save build folder

* remove build from gitignore

* remove build

* update nide version

* last try with parallel

* save build

* save build

* Run critical

* change cypress API url

* run critical in parallel

* check which workflow has lower duration time

* save all reports with container in name

* add reports on failure

* remove reporters

* fix jobs

* merge

* add group name

* run critical

* Refactor critical tests (#1906)

* refactored tag added to purchaseWithProductsTypes, navigation, stocksInCheckout

* homePageAnalitics - refactor

* refactor home page

* refactor creating variants

* refactor adding product without sku to order

* add script to run critical locally

* change tests cases names

* fix names, remove comments, add script to run refactored tests

* remove workflow for parallel

* remove key
2022-03-21 13:17:37 +01:00

67 lines
1.9 KiB
JavaScript

// / <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";
import "./customCommands/sharedElementsOperations/deleteElement";
import "cypress-mailhog";
import "cypress-file-upload";
import "cypress-mochawesome-reporter/register";
import { commandTimings } from "cypress-timings";
commandTimings();
import { urlList } from "../fixtures/urlList";
Cypress.Commands.add("clearSessionData", () => {
cy.clearCookies();
cy.clearLocalStorage();
});
Cypress.Commands.add("addAliasToGraphRequest", operationName => {
cy.intercept("POST", urlList.apiUri, req => {
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;
}
}
});
});
Cypress.Commands.add(
"sendRequestWithQuery",
(query, authorization = "auth", variables = "") =>
cy.request({
body: {
variables,
query
},
headers: {
Authorization: `JWT ${window.sessionStorage.getItem(authorization)}`
},
method: "POST",
url: urlList.apiUri
})
);
Cypress.on(
"uncaught:exception",
(err, runnable) =>
// returning false here prevents Cypress from
// failing the test
false
);