Fixed tests for creating and updating page (#2273)
This commit is contained in:
parent
d13cf7d06d
commit
c236d5346a
4 changed files with 13 additions and 11 deletions
|
@ -154,12 +154,13 @@ describe("Tests for pages", () => {
|
||||||
createPageRequest({
|
createPageRequest({
|
||||||
pageTypeId: pageType.id,
|
pageTypeId: pageType.id,
|
||||||
title: randomName,
|
title: randomName,
|
||||||
|
isPublished: true,
|
||||||
})
|
})
|
||||||
.then(({ page }) => {
|
.then(({ page }) => {
|
||||||
cy.visit(pageDetailsUrl(page.id))
|
cy.visit(pageDetailsUrl(page.id))
|
||||||
.get(PAGE_DETAILS.nameInput)
|
.get(PAGE_DETAILS.nameInput)
|
||||||
.clearAndType(updatedName)
|
.clearAndType(updatedName)
|
||||||
.get(PAGE_DETAILS.isPublishedCheckbox)
|
.get(PAGE_DETAILS.isNotPublishedCheckbox)
|
||||||
.click()
|
.click()
|
||||||
.addAliasToGraphRequest("PageUpdate")
|
.addAliasToGraphRequest("PageUpdate")
|
||||||
.get(BUTTON_SELECTORS.confirm)
|
.get(BUTTON_SELECTORS.confirm)
|
||||||
|
@ -169,7 +170,7 @@ describe("Tests for pages", () => {
|
||||||
})
|
})
|
||||||
.then(page => {
|
.then(page => {
|
||||||
expect(page.title).to.eq(updatedName);
|
expect(page.title).to.eq(updatedName);
|
||||||
expect(page.isPublished).to.eq(true);
|
expect(page.isPublished).to.eq(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,9 +3,9 @@ export const PAGE_DETAILS = {
|
||||||
pageTypesAutocompleteSelect:
|
pageTypesAutocompleteSelect:
|
||||||
'[data-test-id="page-types-autocomplete-select"]',
|
'[data-test-id="page-types-autocomplete-select"]',
|
||||||
attributeValues: '[data-test-id="attribute-value"]',
|
attributeValues: '[data-test-id="attribute-value"]',
|
||||||
isPublishedCheckbox: '[name="isPublished"][value=true]',
|
isNotPublishedCheckbox: '[name="isPublished"][value=false]',
|
||||||
uploadFileButton: '[data-test-id="button-upload-file"]',
|
uploadFileButton: '[data-test-id="button-upload-file"]',
|
||||||
richTextEditorAttributeValue: '[class*="ce-paragraph"]',
|
richTextEditorAttributeValue: '[class*="ce-paragraph"]',
|
||||||
booleanAttributeValueCheckbox: '[name*="attribute:"][type="checkbox"]',
|
booleanAttributeValueCheckbox: '[name*="attribute:"][type="checkbox"]',
|
||||||
numericAttributeValueInput: '[name*="attribute:"]'
|
numericAttributeValueInput: '[name*="attribute:"]',
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,9 +18,10 @@ export function getPage(pageId, auth = "auth") {
|
||||||
return cy.sendRequestWithQuery(query, auth).its("body.data.page");
|
return cy.sendRequestWithQuery(query, auth).its("body.data.page");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createPage({ title, pageTypeId }) {
|
export function createPage({ title, pageTypeId, isPublished = false }) {
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
pageCreate(input:{
|
pageCreate(input:{
|
||||||
|
isPublished: ${isPublished}
|
||||||
title:"${title}"
|
title:"${title}"
|
||||||
pageType:"${pageTypeId}"
|
pageType:"${pageTypeId}"
|
||||||
}){
|
}){
|
||||||
|
|
|
@ -9,14 +9,14 @@ export const attributesTypes = {
|
||||||
MULTISELECT: addSelectAttributeValue,
|
MULTISELECT: addSelectAttributeValue,
|
||||||
RICH_TEXT: addRichTextAttributeValue,
|
RICH_TEXT: addRichTextAttributeValue,
|
||||||
BOOLEAN: addBooleanAttributeValue,
|
BOOLEAN: addBooleanAttributeValue,
|
||||||
NUMERIC: addNumericAttributeValue
|
NUMERIC: addNumericAttributeValue,
|
||||||
};
|
};
|
||||||
export function createPage({
|
export function createPage({
|
||||||
pageName,
|
pageName,
|
||||||
pageTypeName,
|
pageTypeName,
|
||||||
isPublished = false,
|
isPublished = false,
|
||||||
attributeType = "DROPDOWN",
|
attributeType = "DROPDOWN",
|
||||||
attributeValue
|
attributeValue,
|
||||||
}) {
|
}) {
|
||||||
openCreatePageAndFillUpGeneralFields({ pageName, pageTypeName, isPublished });
|
openCreatePageAndFillUpGeneralFields({ pageName, pageTypeName, isPublished });
|
||||||
attributesTypes[attributeType](attributeValue);
|
attributesTypes[attributeType](attributeValue);
|
||||||
|
@ -48,19 +48,19 @@ export function addNumericAttributeValue(attributeValue) {
|
||||||
function openCreatePageAndFillUpGeneralFields({
|
function openCreatePageAndFillUpGeneralFields({
|
||||||
pageName,
|
pageName,
|
||||||
pageTypeName,
|
pageTypeName,
|
||||||
isPublished
|
isPublished,
|
||||||
}) {
|
}) {
|
||||||
cy.visit(urlList.pages)
|
cy.visit(urlList.pages)
|
||||||
.get(PAGES_LIST.createPageButton)
|
.get(PAGES_LIST.createPageButton)
|
||||||
.click()
|
.click()
|
||||||
.get(PAGE_DETAILS.nameInput)
|
.get(PAGE_DETAILS.nameInput)
|
||||||
.type(pageName);
|
.type(pageName);
|
||||||
if (isPublished) {
|
if (!isPublished) {
|
||||||
cy.get(PAGE_DETAILS.isPublishedCheckbox).click();
|
cy.get(PAGE_DETAILS.isNotPublishedCheckbox).click();
|
||||||
}
|
}
|
||||||
cy.fillAutocompleteSelect(
|
cy.fillAutocompleteSelect(
|
||||||
PAGE_DETAILS.pageTypesAutocompleteSelect,
|
PAGE_DETAILS.pageTypesAutocompleteSelect,
|
||||||
pageTypeName
|
pageTypeName,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue