Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
11fb297
Added tests for Allow At Root property
nhudinh0309 Sep 12, 2024
a8bfa93
Added Content tests for Allowed Child Nodes property
nhudinh0309 Sep 12, 2024
6b2c3d2
Merge branch 'v14/dev' into v14/QA/document-types-properties-in-conte…
nhudinh0309 Sep 16, 2024
4611792
Added Content tests for the Allow at root property
nhudinh0309 Sep 17, 2024
da0c5aa
Added Content tests for the Allowed child node property
nhudinh0309 Sep 17, 2024
985ae89
Added Content tests for the Collection property
nhudinh0309 Sep 17, 2024
9148721
Merge branch 'v14/dev' into v14/QA/document-types-properties-in-conte…
nhudinh0309 Sep 17, 2024
ddd2e4f
Added Content tests with allow vary by culture
nhudinh0309 Sep 18, 2024
a0cef56
Added more waits
nhudinh0309 Sep 18, 2024
a162e71
Updated tests due to api helper changes
nhudinh0309 Sep 18, 2024
c5adda2
Added Content tests with allowed templates
nhudinh0309 Sep 19, 2024
ad3e7f0
Merge branch 'v14/dev' into v14/QA/document-types-properties-in-conte…
nhudinh0309 Sep 19, 2024
6f0f5d2
Merge branch 'v14/dev' into v14/QA/document-types-properties-in-conte…
nhudinh0309 Sep 25, 2024
c648e3b
Merge branch 'v14/dev' into v14/QA/document-types-properties-in-conte…
nhudinh0309 Sep 25, 2024
b8970a2
Merge branch 'v14/QA/document-types-properties-in-content-tests-p2' i…
nhudinh0309 Sep 26, 2024
4f512df
Merge branch 'v14/dev' into v14/QA/document-types-properties-in-conte…
nhudinh0309 Sep 26, 2024
bf74a74
Bumped version of test helper
nhudinh0309 Sep 26, 2024
6043ab9
Updated code due to api helper changes
nhudinh0309 Sep 26, 2024
bc6c904
Fixed naming
nhudinh0309 Sep 26, 2024
2dcea34
Merge branch 'v14/dev' into v14/QA/document-types-properties-in-conte…
nhudinh0309 Sep 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions tests/Umbraco.Tests.AcceptanceTest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/Umbraco.Tests.AcceptanceTest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Loading