V16 Added acceptance tests for the regression issue #19529 (#19713)

* Added tests for regression issue that cannot create a variant document blueprint

* Make tests run in the pipeline

* Reverted npm command
This commit is contained in:
Nhu Dinh
2025-07-21 10:23:44 +07:00
committed by GitHub
parent 0442ddc739
commit d31b88b94a

View File

@@ -3,13 +3,10 @@ import {expect} from "@playwright/test";
const documentBlueprintName = 'TestDocumentBlueprints';
const documentTypeName = 'DocumentTypeForBlueprint';
let documentTypeId = '';
test.beforeEach(async ({umbracoApi, umbracoUi}) => {
test.beforeEach(async ({umbracoApi}) => {
await umbracoApi.documentBlueprint.ensureNameNotExists(documentBlueprintName);
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
documentTypeId = await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
await umbracoUi.goToBackOffice();
});
test.afterEach(async ({umbracoApi}) => {
@@ -19,6 +16,8 @@ test.afterEach(async ({umbracoApi}) => {
test('can create a document blueprint from the settings menu', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
await umbracoUi.goToBackOffice();
await umbracoUi.documentBlueprint.goToSection(ConstantHelper.sections.settings);
// Act
@@ -29,17 +28,19 @@ test('can create a document blueprint from the settings menu', {tag: '@smoke'},
await umbracoUi.documentBlueprint.clickSaveButton();
// Assert
await umbracoUi.documentBlueprint.waitForDocumentBlueprintToBeCreated()
await umbracoUi.documentBlueprint.waitForDocumentBlueprintToBeCreated();
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeTruthy();
await umbracoUi.documentBlueprint.isDocumentBlueprintRootTreeItemVisible(documentBlueprintName, true);
});
test('can rename a document blueprint', async ({umbracoApi, umbracoUi}) => {
// Arrange
const documentTypeId = await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
const wrongDocumentBlueprintName = 'Wrong Document Blueprint';
await umbracoApi.documentBlueprint.ensureNameNotExists(wrongDocumentBlueprintName);
await umbracoApi.documentBlueprint.createDefaultDocumentBlueprint(wrongDocumentBlueprintName, documentTypeId);
expect(await umbracoApi.documentBlueprint.doesNameExist(wrongDocumentBlueprintName)).toBeTruthy();
await umbracoUi.goToBackOffice();
await umbracoUi.documentBlueprint.goToSection(ConstantHelper.sections.settings);
// Act
@@ -57,8 +58,10 @@ test('can rename a document blueprint', async ({umbracoApi, umbracoUi}) => {
test('can delete a document blueprint', async ({umbracoApi, umbracoUi}) => {
// Arrange
const documentTypeId = await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
await umbracoApi.documentBlueprint.createDefaultDocumentBlueprint(documentBlueprintName, documentTypeId);
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeTruthy();
await umbracoUi.goToBackOffice();
await umbracoUi.documentBlueprint.goToSection(ConstantHelper.sections.settings);
// Act
@@ -75,9 +78,9 @@ test('can delete a document blueprint', async ({umbracoApi, umbracoUi}) => {
test('can create a document blueprint from the content menu', async ({umbracoApi, umbracoUi}) => {
// Arrange
const documentTypeName = 'DocumentTypeForContent';
const documentTypeId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeName);
await umbracoApi.document.createDefaultDocument(documentBlueprintName, documentTypeId);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
// Act
@@ -94,3 +97,29 @@ test('can create a document blueprint from the content menu', async ({umbracoApi
// Clean
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
});
test('can create a variant document blueprint', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.language.createDanishLanguage();
await umbracoApi.documentType.createDocumentTypeWithAllowVaryByCulture(documentTypeName);
await umbracoUi.goToBackOffice();
await umbracoUi.documentBlueprint.goToSection(ConstantHelper.sections.settings);
// Act
await umbracoUi.documentBlueprint.clickActionsMenuAtRoot();
await umbracoUi.documentBlueprint.clickCreateActionMenuOption();
await umbracoUi.documentBlueprint.clickTextButtonWithName(documentTypeName);
await umbracoUi.documentBlueprint.enterDocumentBlueprintName(documentBlueprintName);
await umbracoUi.documentBlueprint.clickSaveButton();
// Assert
await umbracoUi.documentBlueprint.waitForDocumentBlueprintToBeCreated();
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeTruthy();
await umbracoUi.documentBlueprint.isDocumentBlueprintRootTreeItemVisible(documentBlueprintName, true);
await umbracoUi.documentBlueprint.page.on('console', message => {
expect(message.type()).not.toBe('error');
});
// Clean
await umbracoApi.language.ensureIsoCodeNotExists('da');
});