diff --git a/cypress/integration/configuration/attributes/contentAttribute.js b/cypress/integration/configuration/attributes/createContentAttribute.js similarity index 96% rename from cypress/integration/configuration/attributes/contentAttribute.js rename to cypress/integration/configuration/attributes/createContentAttribute.js index 55a1be047..74ca2e6ae 100644 --- a/cypress/integration/configuration/attributes/contentAttribute.js +++ b/cypress/integration/configuration/attributes/createContentAttribute.js @@ -6,7 +6,10 @@ import faker from "faker"; import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details"; import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list"; import { urlList } from "../../../fixtures/urlList"; -import { getAttribute } from "../../../support/api/requests/Attribute"; +import { + createAttribute, + getAttribute +} from "../../../support/api/requests/Attribute"; import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils"; import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData"; import filterTests from "../../../support/filterTests"; @@ -20,7 +23,9 @@ filterTests({ definedTags: ["all"] }, () => { "MULTISELECT", "FILE", "RICH_TEXT", - "BOOLEAN" + "BOOLEAN", + "DATE", + "DATE_TIME" ]; const attributeReferenceType = ["PRODUCT", "PAGE"]; const attributeNumericType = [ @@ -43,6 +48,7 @@ filterTests({ definedTags: ["all"] }, () => { .get(ATTRIBUTES_DETAILS.pageTypeAttributeCheckbox) .click(); }); + attributesTypes.forEach(attributeType => { it(`should create ${attributeType} attribute`, () => { const attributeName = `${startsWith}${faker.datatype.number()}`; diff --git a/cypress/integration/configuration/attributes/deleteAndUpdateContentAttribute.js b/cypress/integration/configuration/attributes/deleteAndUpdateContentAttribute.js new file mode 100644 index 000000000..145e005e6 --- /dev/null +++ b/cypress/integration/configuration/attributes/deleteAndUpdateContentAttribute.js @@ -0,0 +1,62 @@ +// / +// / + +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 filterTests from "../../../support/filterTests"; +import { fillUpAttributeNameAndCode } from "../../../support/pages/attributesPage"; + +filterTests({ definedTags: ["all"] }, () => { + describe("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; + }); + }); + + it("should delete attribute", () => { + 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 update attribute", () => { + 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); + }); + }); + }); +}); diff --git a/cypress/support/api/requests/Attribute.js b/cypress/support/api/requests/Attribute.js index a621e06be..fcd971507 100644 --- a/cypress/support/api/requests/Attribute.js +++ b/cypress/support/api/requests/Attribute.js @@ -27,7 +27,7 @@ export function createAttribute({ } } } - attributeErrors{ + errors{ field message }