saleor-dashboard/cypress/support/customCommands/basicOperations/index.js
poulch d5ed6fb202
Feature flags (#2961)
* [Feature Flags] Abstraction over flags provider (#2928)

* Remove useFlag hook

* [Feature Flags] GraphQL build multiple schemas (#2937)

* Build script

* Refactor build types script

* Remove old codegen.yml

* Clean feature flags in script

* Refactor schema path

* Restore useAuthProvider

* Update configuration file

* encapsulate details for feature flags provider

* Add proper env to flagsmith provider

* Remove flagsmith mocks

* Vite config define global variables

* Render flagmisth provider only when is used

* Keep name service agnostic

* Test with mocked flagsmith

* Use global FLAGS varaible for env flags

* Fix type issue with FLAGS

* Fix build issue

* Remove duplicate translations

* Fix typo

* Prepare for QA tests

* Remove test feature flag
2023-01-16 14:55:38 +01:00

33 lines
893 B
JavaScript

Cypress.Commands.add("getTextFromElement", element =>
cy.get(element).invoke("text"),
);
Cypress.Commands.add("clearAndType", { prevSubject: true }, (subject, text) => {
cy.wrap(subject)
.clear()
.type(text);
});
Cypress.Commands.add("waitForRequestAndCheckIfNoErrors", alias => {
cy.wait(alias).then(resp => {
expect(
resp.response.body.errors,
`No errors in ${alias} operation in graphql response`,
).to.be.undefined;
return resp;
});
});
Cypress.Commands.add("checkIfDataAreNotNull", data => {
expect(data, "Created data should not be null").to.be.not.null;
if (typeof data === "object") {
Object.keys(data).forEach(key => {
cy.checkIfDataAreNotNull(data[key]);
});
} else if (Array.isArray(data)) {
expect(data).not.to.be.empty;
data.forEach(singleData => {
cy.checkIfDataAreNotNull(singleData);
});
}
});