From d31b88b94affc0f5d2d1362c5c9ac5db04ba5223 Mon Sep 17 00:00:00 2001 From: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com> Date: Mon, 21 Jul 2025 10:23:44 +0700 Subject: [PATCH] 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 --- .../DocumentBlueprint.spec.ts | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/DocumentBlueprint/DocumentBlueprint.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/DocumentBlueprint/DocumentBlueprint.spec.ts index 56663d32fe..c387a03496 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/DocumentBlueprint/DocumentBlueprint.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/DocumentBlueprint/DocumentBlueprint.spec.ts @@ -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'); +});