V14 Added Content tests with different document types properties (#17131)
* Added tests for Allow At Root property * Added Content tests for Allowed Child Nodes property * Added Content tests for the Allow at root property * Added Content tests for the Allowed child node property * Added Content tests for the Collection property * Added Content tests with allow vary by culture * Added more waits * Updated tests due to api helper changes * Added Content tests with allowed templates * Bumped version of test helper * Updated code due to api helper changes * Fixed naming
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "^2.0.20",
|
||||
"@umbraco/playwright-testhelpers": "^2.0.0-beta.84",
|
||||
"@umbraco/playwright-testhelpers": "^2.0.0-beta.86",
|
||||
"camelize": "^1.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"node-fetch": "^2.6.7"
|
||||
@@ -64,10 +64,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@umbraco/playwright-testhelpers": {
|
||||
"version": "2.0.0-beta.84",
|
||||
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.84.tgz",
|
||||
"integrity": "sha512-vH13Lg48knTkkLVTwhMXUKTOdjtmixFj0wF5Qhgb++13u4AVDb+oW+TbFwTjSYaLeNMraq5Uhwmto/XuJPs2Rw==",
|
||||
"license": "MIT",
|
||||
"version": "2.0.0-beta.86",
|
||||
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.86.tgz",
|
||||
"integrity": "sha512-tF7nJCMgBJwaPtxWAuDOJ9lc3T11aO6ped9AxzAJTmzFdSJG16w8jzjWiNgCaU2xRsw5fRyos+I1YrFW249vLw==",
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "2.0.20",
|
||||
"node-fetch": "^2.6.7"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "^2.0.20",
|
||||
"@umbraco/playwright-testhelpers": "^2.0.0-beta.84",
|
||||
"@umbraco/playwright-testhelpers": "^2.0.0-beta.86",
|
||||
"camelize": "^1.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"node-fetch": "^2.6.7"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
|
||||
const documentTypeName = 'TestDocumentTypeForContent';
|
||||
|
||||
test.beforeEach(async ({umbracoApi, umbracoUi}) => {
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoUi.goToBackOffice();
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
});
|
||||
|
||||
test('cannot create content if allow at root is disabled', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const noAllowedDocumentTypeAvailableMessage = 'There are no allowed Document Types available for creating content here';
|
||||
await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuAtRoot();
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isDocumentTypeNameVisible(documentTypeName, false);
|
||||
await umbracoUi.content.doesModalHaveText(noAllowedDocumentTypeAvailableMessage);
|
||||
});
|
||||
@@ -0,0 +1,128 @@
|
||||
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
import {expect} from "@playwright/test";
|
||||
|
||||
const contentName = 'TestContent';
|
||||
const documentTypeName = 'TestDocumentTypeForContent';
|
||||
const secondLanguageName = 'Danish';
|
||||
|
||||
test.beforeEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.language.ensureNameNotExists(secondLanguageName);
|
||||
await umbracoApi.language.createDanishLanguage();
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.language.ensureNameNotExists(secondLanguageName);
|
||||
});
|
||||
|
||||
test('can create content with allow vary by culture enabled', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
await umbracoApi.documentType.createDocumentTypeWithAllowVaryByCulture(documentTypeName);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuAtRoot();
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(documentTypeName);
|
||||
await umbracoUi.content.enterContentName(contentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
await umbracoUi.content.clickSaveAndCloseButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('can create content with names that vary by culture', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const danishContentName = 'Test indhold';
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowVaryByCulture(documentTypeName);
|
||||
await umbracoApi.document.createDefaultDocumentWithEnglishCulture(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickVariantSelectorButton();
|
||||
await umbracoUi.content.clickVariantAddModeButton();
|
||||
await umbracoUi.content.enterContentName(danishContentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
await umbracoUi.content.clickSaveAndCloseButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(danishContentName)).toBeTruthy();
|
||||
const contentData = await umbracoApi.document.getByName(danishContentName);
|
||||
expect(contentData.variants.length).toBe(2);
|
||||
expect(contentData.variants[0].name).toBe(contentName);
|
||||
expect(contentData.variants[1].name).toBe(danishContentName);
|
||||
});
|
||||
|
||||
test('can create content with names that vary by culture and content that is invariant', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const danishContentName = 'Test indhold';
|
||||
const textContent = 'This is a test text';
|
||||
const danishTextContent = 'Dette er testtekst';
|
||||
const dataTypeName = 'Textstring';
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id, 'Test Group', false);
|
||||
await umbracoApi.document.createDocumentWithEnglishCultureAndTextContent(contentName, documentTypeId, textContent, dataTypeName);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickVariantSelectorButton();
|
||||
await umbracoUi.content.clickVariantAddModeButton();
|
||||
await umbracoUi.content.enterContentName(danishContentName);
|
||||
await umbracoUi.content.enterTextstring(danishTextContent);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
await umbracoUi.content.clickSaveAndCloseButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(danishContentName)).toBeTruthy();
|
||||
const contentData = await umbracoApi.document.getByName(danishContentName);
|
||||
expect(contentData.variants.length).toBe(2);
|
||||
expect(contentData.variants[0].name).toBe(contentName);
|
||||
expect(contentData.variants[1].name).toBe(danishContentName);
|
||||
expect(contentData.values.length).toBe(1);
|
||||
expect(contentData.values[0].value).toBe(danishTextContent);
|
||||
});
|
||||
|
||||
test('can create content with names and content that vary by culture', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const danishContentName = 'Test indhold';
|
||||
const textContent = 'This is a test text';
|
||||
const danishTextContent = 'Dette er testtekst';
|
||||
const dataTypeName = 'Textstring';
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id, 'Test Group', true);
|
||||
await umbracoApi.document.createDocumentWithEnglishCultureAndTextContent(contentName, documentTypeId, textContent, dataTypeName, true);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickVariantSelectorButton();
|
||||
await umbracoUi.content.clickVariantAddModeButton();
|
||||
await umbracoUi.content.enterContentName(danishContentName);
|
||||
await umbracoUi.content.enterTextstring(danishTextContent);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
await umbracoUi.content.clickSaveAndCloseButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(danishContentName)).toBeTruthy();
|
||||
const contentData = await umbracoApi.document.getByName(danishContentName);
|
||||
expect(contentData.variants.length).toBe(2);
|
||||
expect(contentData.variants[0].name).toBe(contentName);
|
||||
expect(contentData.variants[1].name).toBe(danishContentName);
|
||||
expect(contentData.values.length).toBe(2);
|
||||
expect(contentData.values[0].value).toBe(textContent);
|
||||
expect(contentData.values[1].value).toBe(danishTextContent);
|
||||
});
|
||||
@@ -0,0 +1,98 @@
|
||||
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
import {expect} from "@playwright/test";
|
||||
|
||||
const contentName = 'TestContent';
|
||||
const documentTypeName = 'TestDocumentTypeForContent';
|
||||
|
||||
test.beforeEach(async ({umbracoApi, umbracoUi}) => {
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoUi.goToBackOffice();
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
});
|
||||
|
||||
test('can create content with allowed child node enabled', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const childDocumentTypeName = 'Test Child Document Type';
|
||||
const childDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childDocumentTypeName);
|
||||
await umbracoApi.documentType.createDocumentTypeWithAllowedChildNode(documentTypeName, childDocumentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuAtRoot();
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(documentTypeName);
|
||||
await umbracoUi.content.enterContentName(contentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
|
||||
|
||||
// Clean
|
||||
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeName);
|
||||
});
|
||||
|
||||
test('cannot create child content if allowed child node is disabled', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const noAllowedDocumentTypeAvailableMessage = 'There are no allowed Document Types available for creating content here';
|
||||
const documentTypeId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuForContent(contentName);
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isDocumentTypeNameVisible(documentTypeName, false);
|
||||
await umbracoUi.content.doesModalHaveText(noAllowedDocumentTypeAvailableMessage);
|
||||
});
|
||||
|
||||
test('can create multiple child nodes with different document types', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const firstChildDocumentTypeName = 'First Child Document Type';
|
||||
const secondChildDocumentTypeName = 'Second Child Document Type';
|
||||
const firstChildContentName = 'First Child Content';
|
||||
const secondChildContentName = 'Second Child Content';
|
||||
const firstChildDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(firstChildDocumentTypeName);
|
||||
const secondChildDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(secondChildDocumentTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedTwoChildNodes(documentTypeName, firstChildDocumentTypeId, secondChildDocumentTypeId);
|
||||
const contentId = await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoApi.document.createDefaultDocumentWithParent(firstChildContentName, firstChildDocumentTypeId, contentId);
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuForContent(contentName);
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(secondChildDocumentTypeName);
|
||||
// This wait is needed
|
||||
await umbracoUi.waitForTimeout(500);
|
||||
await umbracoUi.content.enterContentName(secondChildContentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(secondChildContentName)).toBeTruthy();
|
||||
const childData = await umbracoApi.document.getChildren(contentId);
|
||||
expect(childData.length).toBe(2);
|
||||
expect(childData[0].variants[0].name).toBe(firstChildContentName);
|
||||
expect(childData[1].variants[0].name).toBe(secondChildContentName);
|
||||
// verify that the child content displays in the tree after reloading children
|
||||
await umbracoUi.content.clickActionsMenuForContent(contentName);
|
||||
await umbracoUi.content.clickReloadButton();
|
||||
await umbracoUi.content.clickCaretButtonForContentName(contentName);
|
||||
await umbracoUi.content.doesContentTreeHaveName(firstChildContentName);
|
||||
await umbracoUi.content.doesContentTreeHaveName(secondChildContentName);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.document.ensureNameNotExists(firstChildContentName);
|
||||
await umbracoApi.document.ensureNameNotExists(secondChildContentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(firstChildDocumentTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(secondChildDocumentTypeName);
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
import {expect} from "@playwright/test";
|
||||
|
||||
const contentName = 'TestContent';
|
||||
const documentTypeName = 'TestDocumentTypeForContent';
|
||||
const templateName = 'TestTemplate';
|
||||
let templateId = '';
|
||||
|
||||
test.beforeEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.template.ensureNameNotExists(templateName);
|
||||
templateId = await umbracoApi.template.createDefaultTemplate(templateName);
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.template.ensureNameNotExists(templateName);
|
||||
});
|
||||
|
||||
test('can create content with an allowed template', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
await umbracoApi.documentType.createDocumentTypeWithAllowedTemplate(documentTypeName, templateId, true);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuAtRoot();
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(documentTypeName);
|
||||
await umbracoUi.content.enterContentName(contentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
|
||||
const contentData = await umbracoApi.document.getByName(contentName);
|
||||
expect(contentData.template.id).toBe(templateId);
|
||||
});
|
||||
|
||||
test('can create content with multiple allowed templates', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const defaultTemplateName = 'TestDefaultTemplate';
|
||||
await umbracoApi.template.ensureNameNotExists(defaultTemplateName);
|
||||
const defaultTemplateId = await umbracoApi.template.createDefaultTemplate(templateName);
|
||||
await umbracoApi.documentType.createDocumentTypeWithTwoAllowedTemplates(documentTypeName, templateId, defaultTemplateId, true, defaultTemplateId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuAtRoot();
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(documentTypeName);
|
||||
await umbracoUi.content.enterContentName(contentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
|
||||
const contentData = await umbracoApi.document.getByName(contentName);
|
||||
expect(contentData.template.id).toBe(defaultTemplateId);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.template.ensureNameNotExists(defaultTemplateName);
|
||||
});
|
||||
@@ -0,0 +1,138 @@
|
||||
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
import {expect} from "@playwright/test";
|
||||
|
||||
const contentName = 'TestContent';
|
||||
const documentTypeName = 'TestDocumentTypeForContent';
|
||||
const childDocumentTypeName = 'TestChildDocumentType';
|
||||
const firstChildContentName = 'First Child Content';
|
||||
const secondChildContentName = 'Second Child Content';
|
||||
const dataTypeName = 'List View - Content';
|
||||
let dataTypeData;
|
||||
|
||||
test.beforeEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
});
|
||||
|
||||
test('can create content configured as a collection', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const noItemsToShowMessage = 'There are no items to show in the list.';
|
||||
await umbracoApi.documentType.createDocumentTypeWithCollectionId(documentTypeName, dataTypeData.id);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuAtRoot();
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(documentTypeName);
|
||||
await umbracoUi.content.enterContentName(contentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
await umbracoUi.content.isTabNameVisible('Collection');
|
||||
await umbracoUi.content.doesDocumentWorkspaceHaveText(noItemsToShowMessage);
|
||||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('can create child content in a collection', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const expectedNames = [firstChildContentName];
|
||||
const childDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childDocumentTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNodeAndCollectionId(documentTypeName, childDocumentTypeId, dataTypeData.id);
|
||||
const contentId = await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuForContent(contentName);
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(childDocumentTypeName);
|
||||
// This wait is needed
|
||||
await umbracoUi.waitForTimeout(500);
|
||||
await umbracoUi.content.enterContentName(firstChildContentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
const childData = await umbracoApi.document.getChildren(contentId);
|
||||
expect(childData.length).toBe(expectedNames.length);
|
||||
expect(childData[0].variants[0].name).toBe(firstChildContentName);
|
||||
// verify that the child content displays in collection list after reloading tree
|
||||
await umbracoUi.waitForTimeout(1000);
|
||||
await umbracoUi.content.clickActionsMenuForContent(contentName);
|
||||
await umbracoUi.content.clickReloadButton();
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.doesDocumentTableColumnNameValuesMatch(expectedNames);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.document.ensureNameNotExists(firstChildContentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeName);
|
||||
});
|
||||
|
||||
test('can create multiple child nodes in a collection', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const expectedNames = [secondChildContentName, firstChildContentName];
|
||||
const childDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childDocumentTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNodeAndCollectionId(documentTypeName, childDocumentTypeId, dataTypeData.id);
|
||||
const contentId = await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoApi.document.createDefaultDocumentWithParent(firstChildContentName, childDocumentTypeId, contentId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuForContent(contentName);
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(childDocumentTypeName);
|
||||
// This wait is needed
|
||||
await umbracoUi.waitForTimeout(500);
|
||||
await umbracoUi.content.enterContentName(secondChildContentName);
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
const childData = await umbracoApi.document.getChildren(contentId);
|
||||
expect(childData.length).toBe(expectedNames.length);
|
||||
expect(childData[0].variants[0].name).toBe(firstChildContentName);
|
||||
expect(childData[1].variants[0].name).toBe(secondChildContentName);
|
||||
// verify that the child content displays in collection list after reloading tree
|
||||
await umbracoUi.waitForTimeout(1000);
|
||||
await umbracoUi.content.clickActionsMenuForContent(contentName);
|
||||
await umbracoUi.content.clickReloadButton();
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.doesDocumentTableColumnNameValuesMatch(expectedNames);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.document.ensureNameNotExists(firstChildContentName);
|
||||
await umbracoApi.document.ensureNameNotExists(secondChildContentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeName);
|
||||
});
|
||||
|
||||
test('can search in a collection of content', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const searchKeyword = 'First';
|
||||
const expectedSearchResult = [firstChildContentName];
|
||||
const childDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childDocumentTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNodeAndCollectionId(documentTypeName, childDocumentTypeId, dataTypeData.id);
|
||||
const contentId = await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoApi.document.createDefaultDocumentWithParent(firstChildContentName, childDocumentTypeId, contentId);
|
||||
await umbracoApi.document.createDefaultDocumentWithParent(secondChildContentName, childDocumentTypeId, contentId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.searchByKeywordInCollection(searchKeyword);
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesDocumentTableColumnNameValuesMatch(expectedSearchResult);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.document.ensureNameNotExists(firstChildContentName);
|
||||
await umbracoApi.document.ensureNameNotExists(secondChildContentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeName);
|
||||
});
|
||||
@@ -397,7 +397,7 @@ test('can enable validation for a property in a document type', async ({umbracoA
|
||||
test('can allow vary by culture for a property in a document type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id, groupName, true);
|
||||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id, groupName, false);
|
||||
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);
|
||||
|
||||
// Act
|
||||
|
||||
Reference in New Issue
Block a user