Skip to content
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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');
});