Add tests for content attributes fo 3.1 (#1773)

This commit is contained in:
Karolina Rakoczy 2022-01-24 13:09:48 +01:00 committed by GitHub
parent ede2094d30
commit 204dfac29f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 3 deletions

View file

@ -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()}`;

View file

@ -0,0 +1,62 @@
// / <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 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);
});
});
});
});

View file

@ -27,7 +27,7 @@ export function createAttribute({
}
}
}
attributeErrors{
errors{
field
message
}