saleor-dashboard/cypress/e2e/configuration/attributes/deleteAndUpdateContentAttribute.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

68 lines
2.2 KiB
JavaScript

// / <reference types="cypress"/>
// / <reference types="../../../support"/>
import faker from "faker";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { attributeDetailsUrl } from "../../../fixtures/urlList";
import {
createAttribute,
getAttribute,
} from "../../../support/api/requests/Attribute";
import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
import { fillUpAttributeNameAndCode } from "../../../support/pages/attributesPage";
describe("As an admin I want to delete and update content attribute", () => {
const startsWith = "AttrContDel";
let attribute;
before(() => {
cy.clearSessionData().loginUserViaRequest();
deleteAttributesStartsWith(startsWith);
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
createAttribute({
name: `${startsWith}${faker.datatype.number()}`,
type: "PAGE_TYPE",
}).then(attributeResp => {
attribute = attributeResp;
});
cy.checkIfDataAreNotNull(attribute);
});
it(
"should be able delete content attribute. TC:SALEOR_0529",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
cy.visit(attributeDetailsUrl(attribute.id))
.get(BUTTON_SELECTORS.deleteButton)
.click()
.addAliasToGraphRequest("AttributeDelete")
.get(BUTTON_SELECTORS.submit)
.click()
.waitForRequestAndCheckIfNoErrors("@AttributeDelete");
getAttribute(attribute.id).should("be.null");
},
);
it(
"should be able update content attribute. TC:SALEOR_0530",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeUpdatedName = `${startsWith}${faker.datatype.number()}`;
cy.visit(attributeDetailsUrl(attribute.id));
fillUpAttributeNameAndCode(attributeUpdatedName);
cy.addAliasToGraphRequest("AttributeUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@AttributeUpdate");
getAttribute(attribute.id).then(attributeResp => {
expect(attributeResp.name).to.eq(attributeUpdatedName);
expect(attributeResp.slug).to.eq(attributeUpdatedName);
});
},
);
});