Add tests for content attributes fo 3.1 (#1773)
This commit is contained in:
parent
ede2094d30
commit
204dfac29f
3 changed files with 71 additions and 3 deletions
|
@ -6,7 +6,10 @@ import faker from "faker";
|
||||||
import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details";
|
import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details";
|
||||||
import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
|
import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
|
||||||
import { urlList } from "../../../fixtures/urlList";
|
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 { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
|
||||||
import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData";
|
import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData";
|
||||||
import filterTests from "../../../support/filterTests";
|
import filterTests from "../../../support/filterTests";
|
||||||
|
@ -20,7 +23,9 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
"MULTISELECT",
|
"MULTISELECT",
|
||||||
"FILE",
|
"FILE",
|
||||||
"RICH_TEXT",
|
"RICH_TEXT",
|
||||||
"BOOLEAN"
|
"BOOLEAN",
|
||||||
|
"DATE",
|
||||||
|
"DATE_TIME"
|
||||||
];
|
];
|
||||||
const attributeReferenceType = ["PRODUCT", "PAGE"];
|
const attributeReferenceType = ["PRODUCT", "PAGE"];
|
||||||
const attributeNumericType = [
|
const attributeNumericType = [
|
||||||
|
@ -43,6 +48,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.get(ATTRIBUTES_DETAILS.pageTypeAttributeCheckbox)
|
.get(ATTRIBUTES_DETAILS.pageTypeAttributeCheckbox)
|
||||||
.click();
|
.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
attributesTypes.forEach(attributeType => {
|
attributesTypes.forEach(attributeType => {
|
||||||
it(`should create ${attributeType} attribute`, () => {
|
it(`should create ${attributeType} attribute`, () => {
|
||||||
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -27,7 +27,7 @@ export function createAttribute({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attributeErrors{
|
errors{
|
||||||
field
|
field
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue