@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
1,059 lines • 73.9 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentUiHelper = void 0;
const test_1 = require("@playwright/test");
const UiBaseLocators_1 = require("./UiBaseLocators");
const ConstantHelper_1 = require("./ConstantHelper");
class ContentUiHelper extends UiBaseLocators_1.UiBaseLocators {
contentNameTxt;
saveAndPublishBtn;
publishBtn;
unpublishBtn;
actionMenuForContentBtn;
openedModal;
textstringTxt;
infoTab;
linkContent;
historyItems;
generalItem;
documentState;
createdDate;
editDocumentTypeBtn;
addTemplateBtn;
id;
cultureAndHostnamesBtn;
cultureLanguageDropdownBox;
addNewDomainBtn;
domainTxt;
domainLanguageDropdownBox;
deleteDomainBtn;
reloadChildrenThreeDotsBtn;
contentTree;
richTextAreaTxt;
textAreaTxt;
plusIconBtn;
enterTagTxt;
menuItemTree;
domainComboBox;
confirmToUnpublishBtn;
saveModalBtn;
dropdown;
setADateTxt;
chooseMediaPickerBtn;
chooseMemberPickerBtn;
numericTxt;
resetFocalPointBtn;
addMultiURLPickerBtn;
linkTxt;
anchorQuerystringTxt;
linkTitleTxt;
tagItems;
removeFilesBtn;
toggleBtn;
toggleInput;
documentTypeWorkspace;
addMultipleTextStringBtn;
multipleTextStringValueTxt;
markdownTxt;
codeEditorTxt;
sliderInput;
tabItems;
documentWorkspace;
searchTxt;
selectAVariantBtn;
variantAddModeBtn;
saveAndCloseBtn;
enterNameInContainerTxt;
listView;
nameBtn;
listViewTableRow;
publishSelectedListItems;
unpublishSelectedListItems;
duplicateToSelectedListItems;
moveToSelectedListItems;
trashSelectedListItems;
modalContent;
trashBtn;
documentListView;
documentGridView;
documentTreeItem;
documentLanguageSelect;
documentLanguageSelectPopover;
documentReadOnly;
documentWorkspaceEditor;
documentBlueprintModal;
documentBlueprintModalEnterNameTxt;
documentBlueprintSaveBtn;
exactTrashBtn;
emptyRecycleBinBtn;
confirmEmptyRecycleBinBtn;
duplicateToBtn;
moveToBtn;
duplicateBtn;
contentTreeRefreshBtn;
sortChildrenBtn;
rollbackBtn;
rollbackContainerBtn;
publicAccessBtn;
uuiCheckbox;
sortBtn;
containerSaveBtn;
groupBasedProtectionBtn;
nextBtn;
chooseMemberGroupBtn;
selectLoginPageDocument;
selectErrorPageDocument;
rollbackItem;
actionsMenu;
linkToDocumentBtn;
linkToMediaBtn;
linkToManualBtn;
umbDocumentCollection;
documentTableColumnName;
addBlockElementBtn;
formValidationMessage;
blockName;
addBlockSettingsTabBtn;
editBlockEntryBtn;
copyBlockEntryBtn;
deleteBlockEntryBtn;
blockGridEntry;
blockListEntry;
tipTapPropertyEditor;
tipTapEditor;
uploadedSvgThumbnail;
linkPickerModal;
pasteFromClipboardBtn;
pasteBtn;
closeBtn;
workspaceEditTab;
workspaceEditProperties;
exactCopyBtn;
openActionsMenu;
replaceExactBtn;
clipboardEntryPicker;
blockWorkspaceEditTab;
insertBlockBtn;
blockWorkspace;
saveContentBtn;
splitView;
tiptapInput;
rteBlockInline;
backofficeModalContainer;
rteBlock;
workspaceActionMenu;
workspaceActionMenuItem;
viewMoreOptionsBtn;
schedulePublishBtn;
schedulePublishModalBtn;
documentScheduleModal;
publishAtFormLayout;
unpublishAtFormLayout;
publishAtValidationMessage;
unpublishAtValidationMessage;
lastPublished;
publishAt;
blockGridAreasContainer;
blockGridBlock;
blockGridEntries;
inlineCreateBtn;
removeAt;
selectAllCheckbox;
confirmToPublishBtn;
tiptapStatusbarWordCount;
tiptapStatusbarElementPath;
publishWithDescendantsBtn;
documentPublishWithDescendantsModal;
includeUnpublishedDescendantsToggle;
publishWithDescendantsModalBtn;
documentVariantLanguagePicker;
documentVariantLanguageItem;
styleSelectBtn;
cascadingMenuContainer;
modalFormValidationMessage;
constructor(page) {
super(page);
this.saveContentBtn = page.getByTestId('workspace-action:Umb.WorkspaceAction.Document.Save');
this.saveAndPublishBtn = page.getByTestId('workspace-action:Umb.WorkspaceAction.Document.SaveAndPublish');
this.closeBtn = page.getByRole('button', { name: 'Close', exact: true });
this.linkPickerModal = page.locator('umb-link-picker-modal');
this.contentNameTxt = page.locator('#name-input input');
this.publishBtn = page.getByLabel(/^Publish(…)?$/);
this.unpublishBtn = page.getByLabel(/^Unpublish(…)?$/);
this.actionMenuForContentBtn = page.locator('#header').getByTestId('open-dropdown');
this.openedModal = page.locator('uui-modal-container[backdrop]');
this.textstringTxt = page.locator('umb-property-editor-ui-text-box #input');
this.reloadChildrenThreeDotsBtn = page.getByRole('button', { name: 'Reload children…' });
this.contentTree = page.locator('umb-tree[alias="Umb.Tree.Document"]');
this.richTextAreaTxt = page.frameLocator('iframe[title="Rich Text Area"]').locator('#tinymce');
this.textAreaTxt = page.locator('umb-property-editor-ui-textarea textarea');
this.plusIconBtn = page.locator('#icon-add svg');
this.enterTagTxt = page.getByPlaceholder('Enter tag');
this.menuItemTree = page.locator('umb-menu-item-tree-default');
this.confirmToUnpublishBtn = page.locator('umb-document-unpublish-modal').getByLabel('Unpublish');
this.dropdown = page.locator('select#native');
this.splitView = page.locator('#splitViews');
this.setADateTxt = page.getByLabel('Set a date…');
this.chooseMediaPickerBtn = page.locator('umb-property-editor-ui-media-picker #btn-add');
this.chooseMemberPickerBtn = page.locator('umb-property-editor-ui-member-picker #btn-add');
this.numericTxt = page.locator('umb-property-editor-ui-number input');
this.addMultiURLPickerBtn = page.locator('umb-property-editor-ui-multi-url-picker #btn-add');
this.linkTxt = page.getByTestId('input:url').locator('#input');
this.anchorQuerystringTxt = page.getByLabel('#value or ?key=value');
this.linkTitleTxt = this.linkPickerModal.getByLabel('Title');
this.tagItems = page.locator('uui-tag');
this.removeFilesBtn = page.locator('umb-input-upload-field [label="Clear file(s)"]');
this.toggleBtn = page.locator('umb-property-editor-ui-toggle #toggle');
this.toggleInput = page.locator('umb-property-editor-ui-toggle span');
this.documentTypeWorkspace = this.sidebarModal.locator('umb-document-type-workspace-editor');
this.addMultipleTextStringBtn = page.locator('umb-input-multiple-text-string').getByLabel('Add');
this.multipleTextStringValueTxt = page.locator('umb-input-multiple-text-string').getByLabel('Value');
this.markdownTxt = page.locator('umb-input-markdown textarea');
this.codeEditorTxt = page.locator('umb-code-editor textarea');
this.sliderInput = page.locator('umb-property-editor-ui-slider #input');
this.tabItems = page.locator('uui-tab');
this.documentWorkspace = page.locator('umb-document-workspace-editor');
this.searchTxt = this.documentWorkspace.getByLabel('Search', { exact: true });
this.selectAVariantBtn = page.getByRole('button', { name: 'Select a variant' });
this.variantAddModeBtn = page.locator('.switch-button.add-mode').locator('.variant-name');
this.saveAndCloseBtn = page.getByLabel('Save and close');
this.documentTreeItem = page.locator('umb-document-tree-item');
this.documentLanguageSelect = page.locator('umb-app-language-select');
this.documentLanguageSelectPopover = page.locator('umb-popover-layout');
this.documentReadOnly = this.documentWorkspace.locator('#name-input').getByText('Read-only');
// Info tab
this.infoTab = page.getByTestId('workspace:view-link:Umb.WorkspaceView.Document.Info');
this.linkContent = page.locator('umb-document-links-workspace-info-app');
this.historyItems = page.locator('umb-history-item');
this.generalItem = page.locator('.general-item');
this.documentState = this.generalItem.locator('uui-tag');
this.createdDate = this.generalItem.filter({ hasText: 'Created' }).locator('umb-localize-date');
this.editDocumentTypeBtn = this.generalItem.filter({ hasText: 'Document Type' }).locator('#button');
this.addTemplateBtn = this.generalItem.filter({ hasText: 'Template' }).locator('#button');
this.id = this.generalItem.filter({ hasText: 'Id' }).locator('span');
// Culture and Hostname
this.cultureAndHostnamesBtn = page.getByLabel(/^Culture and Hostnames(…)?$/);
this.cultureLanguageDropdownBox = page.locator('[headline="Culture"]').getByLabel('combobox-input');
this.addNewDomainBtn = page.getByLabel('Add new domain');
this.domainTxt = page.getByLabel('Domain', { exact: true });
this.domainLanguageDropdownBox = page.locator('[headline="Domains"]').getByLabel('combobox-input');
this.deleteDomainBtn = page.locator('[headline="Domains"] [name="icon-trash"] svg');
this.domainComboBox = page.locator('#domains uui-combobox');
this.saveModalBtn = this.sidebarModal.getByLabel('Save', { exact: true });
this.resetFocalPointBtn = page.getByLabel('Reset focal point');
// List View
this.enterNameInContainerTxt = this.container.getByTestId('input:entity-name').locator('#input');
this.listView = page.locator('umb-document-table-collection-view');
this.nameBtn = page.getByRole('button', { name: 'Name' });
this.listViewTableRow = this.listView.locator('uui-table-row');
this.publishSelectedListItems = page.locator('umb-entity-bulk-action').getByText('Publish', { exact: true });
this.unpublishSelectedListItems = page.locator('umb-entity-bulk-action').getByText('Unpublish', { exact: true });
this.duplicateToSelectedListItems = page.locator('umb-entity-bulk-action').getByText('Duplicate to', { exact: true });
this.moveToSelectedListItems = page.locator('umb-entity-bulk-action').getByText('Move to', { exact: true });
this.trashSelectedListItems = page.locator('umb-entity-bulk-action').getByText('Trash', { exact: true });
this.modalContent = page.locator('umb-tree-picker-modal');
this.trashBtn = page.getByLabel(/^Trash(…)?$/);
this.exactTrashBtn = page.getByRole('button', { name: 'Trash', exact: true });
this.documentListView = page.locator('umb-document-table-collection-view');
this.documentGridView = page.locator('umb-document-grid-collection-view');
this.documentWorkspaceEditor = page.locator('umb-workspace-editor');
this.documentBlueprintModal = page.locator('umb-create-blueprint-modal');
this.documentBlueprintModalEnterNameTxt = this.documentBlueprintModal.locator('input');
this.documentBlueprintSaveBtn = this.documentBlueprintModal.getByLabel('Save');
this.emptyRecycleBinBtn = page.getByTestId('entity-action:Umb.EntityAction.Document.RecycleBin.Empty').locator('#button');
this.confirmEmptyRecycleBinBtn = page.locator('#confirm').getByLabel('Empty Recycle Bin', { exact: true });
this.duplicateToBtn = page.getByRole('button', { name: 'Duplicate to' });
this.moveToBtn = page.getByRole('button', { name: 'Move to' });
this.duplicateBtn = page.getByLabel('Duplicate', { exact: true });
this.contentTreeRefreshBtn = page.locator('#header').getByLabel('#actions_refreshNode');
this.sortChildrenBtn = page.getByRole('button', { name: 'Sort children' });
this.rollbackBtn = page.getByRole('button', { name: 'Rollback…' });
this.rollbackContainerBtn = this.container.getByLabel('Rollback');
this.publicAccessBtn = page.getByRole('button', { name: 'Public Access' });
this.uuiCheckbox = page.locator('uui-checkbox');
this.sortBtn = page.getByLabel('Sort', { exact: true });
this.containerSaveBtn = this.container.getByLabel('Save');
this.groupBasedProtectionBtn = page.locator('span').filter({ hasText: 'Group based protection' });
this.nextBtn = page.getByLabel('Next');
this.chooseMemberGroupBtn = page.locator('umb-input-member-group').getByLabel('Choose');
this.selectLoginPageDocument = page.locator('.select-item').filter({ hasText: 'Login Page' }).locator('umb-input-document');
this.selectErrorPageDocument = page.locator('.select-item').filter({ hasText: 'Error Page' }).locator('umb-input-document');
this.rollbackItem = page.locator('.rollback-item');
this.actionsMenu = page.locator('uui-scroll-container');
this.linkToDocumentBtn = this.linkPickerModal.getByTestId('action:document').locator('#button');
this.linkToMediaBtn = this.linkPickerModal.getByTestId('action:media').locator('#button');
this.linkToManualBtn = this.linkPickerModal.getByTestId('action:external').locator('#button');
this.umbDocumentCollection = page.locator('umb-document-collection');
this.documentTableColumnName = this.listView.locator('umb-document-table-column-name');
//Block Grid - Block List
this.addBlockElementBtn = page.locator('uui-button-group > uui-button').first().filter({ has: page.locator('a#button') });
this.formValidationMessage = page.locator('#splitViews umb-form-validation-message #messages');
this.blockName = page.locator('#editor [slot="name"]');
this.addBlockSettingsTabBtn = page.locator('umb-body-layout').getByRole('tab', { name: 'Settings' });
this.editBlockEntryBtn = page.locator('[label="edit"] svg');
this.copyBlockEntryBtn = page.getByLabel('Copy to clipboard');
this.exactCopyBtn = page.getByRole('button', { name: 'Copy', exact: true });
this.deleteBlockEntryBtn = page.locator('[label="delete"] svg');
this.blockGridEntry = page.locator('umb-block-grid-entry');
this.blockGridBlock = page.locator('umb-block-grid-block');
this.blockListEntry = page.locator('umb-block-list-entry');
this.pasteFromClipboardBtn = page.getByLabel('Paste from clipboard');
this.pasteBtn = page.getByRole('button', { name: 'Paste', exact: true });
this.workspaceEditTab = page.locator('umb-content-workspace-view-edit-tab');
this.blockWorkspaceEditTab = page.locator('umb-block-workspace-view-edit-tab');
this.workspaceEditProperties = page.locator('umb-content-workspace-view-edit-properties');
this.openActionsMenu = page.locator('#action-menu');
this.replaceExactBtn = page.getByRole('button', { name: 'Replace', exact: true });
this.clipboardEntryPicker = page.locator('umb-clipboard-entry-picker');
this.blockGridAreasContainer = page.locator('umb-block-grid-areas-container');
this.blockGridEntries = page.locator('umb-block-grid-entries');
this.inlineCreateBtn = page.locator('uui-button-inline-create');
// TipTap
this.tipTapPropertyEditor = page.locator('umb-property-editor-ui-tiptap');
this.tipTapEditor = this.tipTapPropertyEditor.locator('#editor .tiptap');
this.uploadedSvgThumbnail = page.locator('umb-input-upload-field-svg img');
this.insertBlockBtn = page.locator('[title="Insert Block"]');
this.blockWorkspace = page.locator('umb-block-workspace-editor');
this.tiptapInput = page.locator('umb-input-tiptap');
this.rteBlockInline = page.locator('umb-rte-block-inline');
this.backofficeModalContainer = page.locator('umb-backoffice-modal-container');
this.rteBlock = page.locator('umb-rte-block');
this.tiptapStatusbarWordCount = page.locator('umb-tiptap-statusbar-word-count');
this.tiptapStatusbarElementPath = page.locator('umb-tiptap-statusbar-element-path');
// Scheduled Publishing
this.workspaceActionMenu = page.locator('umb-workspace-action-menu');
this.workspaceActionMenuItem = page.locator('umb-workspace-action-menu-item');
this.viewMoreOptionsBtn = this.workspaceActionMenu.locator('#popover-trigger');
this.schedulePublishBtn = this.workspaceActionMenuItem.getByLabel('Schedule publish', { exact: true });
this.documentScheduleModal = page.locator('umb-document-schedule-modal');
this.schedulePublishModalBtn = this.documentScheduleModal.getByLabel('Schedule publish', { exact: true });
this.publishAtFormLayout = this.documentScheduleModal.locator('uui-form-layout-item').first();
this.unpublishAtFormLayout = this.documentScheduleModal.locator('uui-form-layout-item').last();
this.publishAtValidationMessage = this.publishAtFormLayout.locator('#messages');
this.unpublishAtValidationMessage = this.unpublishAtFormLayout.locator('#messages');
this.lastPublished = this.generalItem.filter({ hasText: 'Last published' }).locator('umb-localize-date');
this.publishAt = this.generalItem.filter({ hasText: 'Publish at' }).locator('umb-localize-date');
this.removeAt = this.generalItem.filter({ hasText: 'Remove at' }).locator('umb-localize-date');
this.selectAllCheckbox = this.documentScheduleModal.locator('[label="Select all"]');
this.confirmToPublishBtn = page.locator('umb-document-publish-modal').getByLabel('Publish');
// Publish with descendants
this.documentPublishWithDescendantsModal = page.locator('umb-document-publish-with-descendants-modal');
this.publishWithDescendantsBtn = this.workspaceActionMenuItem.getByLabel('Publish with descendants', { exact: true });
this.includeUnpublishedDescendantsToggle = this.documentPublishWithDescendantsModal.locator('#includeUnpublishedDescendants');
this.publishWithDescendantsModalBtn = this.documentPublishWithDescendantsModal.getByLabel('Publish with descendants', { exact: true });
this.documentVariantLanguagePicker = page.locator('umb-document-variant-language-picker');
this.documentVariantLanguageItem = this.documentVariantLanguagePicker.locator('uui-menu-item');
// Tiptap - Style Select
this.styleSelectBtn = page.locator('uui-button[label="Style Select"]');
this.cascadingMenuContainer = page.locator('umb-cascading-menu-popover uui-scroll-container');
this.modalFormValidationMessage = this.sidebarModal.locator('umb-form-validation-message #messages');
}
async enterContentName(name) {
await (0, test_1.expect)(this.contentNameTxt).toBeVisible();
await this.contentNameTxt.clear();
await this.contentNameTxt.fill(name);
await (0, test_1.expect)(this.contentNameTxt).toHaveValue(name);
}
async clickSaveAndPublishButton() {
await (0, test_1.expect)(this.saveAndPublishBtn).toBeVisible();
await this.saveAndPublishBtn.click();
await this.page.waitForTimeout(500);
}
async isSuccessStateVisibleForSaveAndPublishButton(isVisible = true) {
const saveAndPublishBtn = this.workspaceAction.filter({ has: this.saveAndPublishBtn });
await (0, test_1.expect)(saveAndPublishBtn.locator(this.successState)).toBeVisible({ visible: isVisible, timeout: 10000 });
}
async clickPublishButton() {
await this.publishBtn.click();
await this.page.waitForTimeout(500);
}
async clickUnpublishButton() {
await this.unpublishBtn.click();
}
async clickReloadChildrenThreeDotsButton() {
await this.reloadChildrenThreeDotsBtn.click();
}
async clickActionsMenuAtRoot() {
await this.actionMenuForContentBtn.click({ force: true });
}
async goToContentWithName(contentName) {
const contentWithNameLocator = this.menuItemTree.getByText(contentName, { exact: true });
await (0, test_1.expect)(contentWithNameLocator).toBeVisible();
await contentWithNameLocator.click();
}
async clickActionsMenuForContent(name) {
await this.clickActionsMenuForName(name);
}
async openContentCaretButtonForName(name) {
const menuItem = this.menuItemTree.filter({ hasText: name }).last();
const isCaretButtonOpen = await menuItem.getAttribute('show-children');
if (isCaretButtonOpen === null) {
await this.clickCaretButtonForContentName(name);
}
}
async clickCaretButtonForContentName(name) {
await (0, test_1.expect)(this.menuItemTree.filter({ hasText: name }).last().locator('#caret-button').last()).toBeVisible();
await this.menuItemTree.filter({ hasText: name }).last().locator('#caret-button').last().click();
}
async waitForModalVisible() {
await this.openedModal.waitFor({ state: 'attached' });
}
async waitForModalHidden() {
await this.openedModal.waitFor({ state: 'hidden' });
}
async clickSaveButtonForContent() {
await (0, test_1.expect)(this.saveContentBtn).toBeVisible();
await this.saveContentBtn.click();
await this.page.waitForTimeout(500);
}
async enterTextstring(text) {
await (0, test_1.expect)(this.textstringTxt).toBeVisible();
await this.textstringTxt.clear();
await this.textstringTxt.fill(text);
}
async doesContentTreeHaveName(contentName) {
await (0, test_1.expect)(this.contentTree).toContainText(contentName);
}
async enterRichTextArea(value) {
await (0, test_1.expect)(this.richTextAreaTxt).toBeVisible();
await this.richTextAreaTxt.fill(value);
}
async enterTextArea(value) {
await (0, test_1.expect)(this.textAreaTxt).toBeVisible();
await this.page.waitForTimeout(200);
await this.textAreaTxt.clear();
await this.textAreaTxt.fill(value);
}
async clickConfirmToUnpublishButton() {
await this.confirmToUnpublishBtn.click();
}
async clickCreateDocumentBlueprintButton() {
await this.createDocumentBlueprintBtn.click();
}
// Info Tab
async clickInfoTab() {
await (0, test_1.expect)(this.infoTab).toBeVisible();
await this.infoTab.click();
}
async doesDocumentHaveLink(link) {
await (0, test_1.expect)(this.linkContent).toContainText(link);
}
async doesHistoryHaveText(text) {
await (0, test_1.expect)(this.historyItems).toHaveText(text);
}
async doesDocumentStateHaveText(text) {
await (0, test_1.expect)(this.documentState).toHaveText(text);
}
async doesCreatedDateHaveText(text) {
await (0, test_1.expect)(this.createdDate).toHaveText(text);
}
async doesIdHaveText(text) {
await (0, test_1.expect)(this.id).toHaveText(text);
}
async clickEditDocumentTypeButton() {
await this.editDocumentTypeBtn.click();
}
async clickAddTemplateButton() {
await this.addTemplateBtn.click();
}
async waitForContentToBeCreated() {
await this.waitForNetworkToBeIdle();
}
async waitForContentToBeDeleted() {
await this.waitForNetworkToBeIdle();
}
async waitForContentToBeRenamed() {
await this.waitForNetworkToBeIdle();
}
async waitForDomainToBeCreated() {
await this.waitForNetworkToBeIdle();
}
async waitForDomainToBeUpdated() {
await this.waitForNetworkToBeIdle();
}
async waitForDomainToBeDeleted() {
await this.waitForNetworkToBeIdle();
}
async waitForContentToBeTrashed() {
await this.waitForNetworkToBeIdle();
}
async clickDocumentTypeByName(documentTypeName) {
await this.page.locator('uui-ref-node-document-type[name="' + documentTypeName + '"]').click();
}
async clickTemplateByName(templateName) {
await this.page.locator('uui-ref-node[name="' + templateName + '"]').click();
}
async isDocumentTypeModalVisible(documentTypeName) {
await (0, test_1.expect)(this.documentTypeWorkspace.filter({ hasText: documentTypeName })).toBeVisible();
}
async isTemplateModalVisible(templateName) {
await (0, test_1.expect)(this.breadcrumbsTemplateModal.getByText(templateName)).toBeVisible();
}
async clickEditTemplateByName(templateName) {
await this.page.locator('uui-ref-node[name="' + templateName + '"]').getByLabel('Choose').click();
}
async changeTemplate(oldTemplate, newTemplate) {
await this.clickEditTemplateByName(oldTemplate);
await this.sidebarModal.getByLabel(newTemplate).click();
await this.clickChooseModalButton();
}
async isTemplateNameDisabled(templateName) {
await (0, test_1.expect)(this.sidebarModal.getByLabel(templateName)).toBeVisible();
await (0, test_1.expect)(this.sidebarModal.getByLabel(templateName)).toBeDisabled();
}
// Culture and Hostnames
async clickCultureAndHostnamesButton() {
await this.cultureAndHostnamesBtn.click();
}
async selectCultureLanguageOption(option) {
await (0, test_1.expect)(this.cultureLanguageDropdownBox).toBeVisible();
await this.cultureLanguageDropdownBox.click();
await (0, test_1.expect)(this.page.getByText(option, { exact: true })).toBeVisible();
await this.page.getByText(option, { exact: true }).click();
}
async selectDomainLanguageOption(option, index = 0) {
await this.domainLanguageDropdownBox.nth(index).click();
await this.domainComboBox.nth(index).getByText(option).click();
}
async clickAddNewDomainButton() {
await (0, test_1.expect)(this.addNewDomainBtn).toBeVisible();
await this.addNewDomainBtn.click();
}
async enterDomain(value, index = 0) {
await (0, test_1.expect)(this.domainTxt.nth(index)).toBeVisible();
await this.domainTxt.nth(index).clear();
await this.domainTxt.nth(index).fill(value);
await (0, test_1.expect)(this.domainTxt.nth(index)).toHaveValue(value);
}
async clickDeleteDomainButton() {
await this.deleteDomainBtn.first().click();
}
async clickSaveModalButton() {
await this.saveModalBtn.click();
await this.page.waitForTimeout(500);
}
async chooseDocumentType(documentTypeName) {
await this.documentTypeNode.filter({ hasText: documentTypeName }).click();
}
// Approved Color
async clickApprovedColorByValue(value) {
await this.page.locator('uui-color-swatch[value="#' + value + '"] #swatch').click();
}
// Checkbox list
async chooseCheckboxListOption(optionValue) {
await this.page.locator('uui-checkbox[value="' + optionValue + '"] svg').click();
}
// Content Picker
async addContentPicker(contentName) {
await this.clickChooseButton();
await this.sidebarModal.getByText(contentName).click();
await this.chooseModalBtn.click();
}
async isOpenButtonVisibleInContentPicker(contentPickerName, isVisible = true) {
return (0, test_1.expect)(this.page.getByLabel('Open ' + contentPickerName)).toBeVisible({ visible: isVisible });
}
async clickContentPickerOpenButton(contentPickerName) {
await this.page.getByLabel('Open ' + contentPickerName).click();
}
async isNodeOpenForContentPicker(contentPickerName) {
return (0, test_1.expect)(this.openedModal.getByText(contentPickerName)).toBeVisible();
}
async isContentNameVisible(contentName, isVisible = true) {
return (0, test_1.expect)(this.sidebarModal.getByText(contentName)).toBeVisible({ visible: isVisible });
}
async isContentInTreeVisible(name, isVisible = true) {
await (0, test_1.expect)(this.documentTreeItem.getByLabel(name, { exact: true })).toBeVisible({ visible: isVisible });
}
async isChildContentInTreeVisible(parentName, childName, isVisible = true) {
await (0, test_1.expect)(this.documentTreeItem.locator('[label="' + parentName + '"]').getByLabel(childName)).toBeVisible({ visible: isVisible });
}
async removeContentPicker(contentPickerName) {
const contentPickerLocator = this.page.locator('umb-entity-item-ref').filter({ has: this.page.locator('[name="' + contentPickerName + '"]') });
await contentPickerLocator.hover();
await contentPickerLocator.getByLabel('Remove').click();
await this.clickConfirmRemoveButton();
}
// Dropdown
async chooseDropdownOption(optionValues) {
await this.dropdown.selectOption(optionValues);
}
// Date Picker
async enterADate(date) {
await this.setADateTxt.fill(date);
}
// Media Picker
async clickChooseMediaPickerButton() {
await this.chooseMediaPickerBtn.click();
}
async clickChooseButtonAndSelectMediaWithName(mediaName) {
await this.clickChooseMediaPickerButton();
await this.selectMediaWithName(mediaName);
}
async removeMediaPickerByName(mediaPickerName) {
await this.page.locator('[name="' + mediaPickerName + '"] [label="Remove"] svg').click();
await this.clickConfirmRemoveButton();
}
async isMediaNameVisible(mediaName, isVisible = true) {
return (0, test_1.expect)(this.mediaCardItems.filter({ hasText: mediaName })).toBeVisible({ visible: isVisible });
}
async clickResetFocalPointButton() {
await this.resetFocalPointBtn.click();
}
async setFocalPoint(widthPercentage = 50, heightPercentage = 50) {
await this.page.waitForTimeout(1000);
const element = await this.page.locator('#image').boundingBox();
if (!element) {
throw new Error('Element not found');
}
const centerX = element.x + element.width / 2;
const centerY = element.y + element.height / 2;
const x = element.x + (element.width * widthPercentage) / 100;
const y = element.y + (element.height * heightPercentage) / 100;
await this.page.waitForTimeout(200);
await this.page.mouse.move(centerX, centerY, { steps: 5 });
await this.page.waitForTimeout(200);
await this.page.mouse.down();
await this.page.waitForTimeout(200);
await this.page.mouse.move(x, y);
await this.page.waitForTimeout(200);
await this.page.mouse.up();
}
// Member Picker
async clickChooseMemberPickerButton() {
await this.chooseMemberPickerBtn.click();
}
async selectMemberByName(memberName) {
await this.sidebarModal.getByText(memberName, { exact: true }).click();
}
async removeMemberPickerByName(memberName) {
const mediaPickerLocator = this.page.locator('umb-entity-item-ref').filter({ has: this.page.locator('[name="' + memberName + '"]') });
await mediaPickerLocator.hover();
await mediaPickerLocator.getByLabel('Remove').click();
await this.clickConfirmRemoveButton();
}
// Numeric
async enterNumeric(number) {
await this.numericTxt.clear();
await this.numericTxt.fill(number.toString());
}
// Radiobox
async chooseRadioboxOption(optionValue) {
await this.page.locator('uui-radio[value="' + optionValue + '"] #button').click();
}
// Tags
async clickPlusIconButton() {
await this.plusIconBtn.click();
}
async enterTag(tagName) {
await this.enterTagTxt.fill(tagName);
await this.enterTagTxt.press('Enter');
}
async removeTagByName(tagName) {
await (0, test_1.expect)(this.tagItems.filter({ hasText: tagName }).locator('svg')).toBeVisible();
await this.tagItems.filter({ hasText: tagName }).locator('svg').click();
}
// Multi URL Picker
async clickAddMultiURLPickerButton() {
await this.addMultiURLPickerBtn.click();
}
async selectLinkByName(linkName) {
await (0, test_1.expect)(this.sidebarModal.getByText(linkName, { exact: true })).toBeVisible();
await this.sidebarModal.getByText(linkName, { exact: true }).click();
}
async enterLink(value, toPress = false) {
await this.linkTxt.clear();
if (toPress) {
await this.linkTxt.press(value);
}
else {
await this.linkTxt.fill(value);
}
}
async enterAnchorOrQuerystring(value, toPress = false) {
await this.anchorQuerystringTxt.clear();
if (toPress) {
await this.anchorQuerystringTxt.press(value);
}
else {
await this.anchorQuerystringTxt.fill(value);
}
}
async enterLinkTitle(value, toPress = false) {
await this.linkTitleTxt.clear();
if (toPress) {
await this.linkTitleTxt.press(value);
}
else {
await this.linkTitleTxt.fill(value);
}
}
async removeUrlPickerByName(linkName) {
await this.page.locator('[name="' + linkName + '"]').getByLabel('Remove').click();
await this.clickConfirmRemoveButton();
}
async clickEditUrlPickerButtonByName(linkName) {
await this.page.locator('[name="' + linkName + '"]').getByLabel('Edit').click();
}
// Upload
async clickRemoveFilesButton() {
await (0, test_1.expect)(this.removeFilesBtn).toBeVisible();
await this.removeFilesBtn.click();
}
// True/false
async clickToggleButton() {
await (0, test_1.expect)(this.toggleBtn).toBeVisible();
await this.toggleBtn.click({ force: true });
}
async doesToggleHaveLabel(label) {
return await (0, test_1.expect)(this.toggleInput).toHaveText(label);
}
// Multiple Text String
async clickAddMultipleTextStringButton() {
await this.addMultipleTextStringBtn.click();
}
async enterMultipleTextStringValue(value) {
await this.multipleTextStringValueTxt.clear();
await this.multipleTextStringValueTxt.fill(value);
}
async addMultipleTextStringItem(value) {
await this.clickAddMultipleTextStringButton();
await this.enterMultipleTextStringValue(value);
}
// Code Editor
async enterCodeEditorValue(value) {
await this.codeEditorTxt.clear();
await this.codeEditorTxt.fill(value);
}
// Markdown Editor
async enterMarkdownEditorValue(value) {
await this.markdownTxt.clear();
await this.markdownTxt.fill(value);
}
// Slider
async changeSliderValue(value) {
await this.sliderInput.fill(value);
}
async isDocumentTypeNameVisible(contentName, isVisible = true) {
return (0, test_1.expect)(this.sidebarModal.getByText(contentName)).toBeVisible({ visible: isVisible });
}
async doesModalHaveText(text) {
return (0, test_1.expect)(this.sidebarModal).toContainText(text);
}
// Collection tab
async isTabNameVisible(tabName) {
return (0, test_1.expect)(this.tabItems.filter({ hasText: tabName })).toBeVisible();
}
async doesDocumentHaveName(name) {
return (0, test_1.expect)(this.enterAName).toHaveValue(name);
}
async doesDocumentTableColumnNameValuesMatch(expectedValues) {
await (0, test_1.expect)(this.documentListView).toBeVisible();
return expectedValues.forEach((text, index) => {
(0, test_1.expect)(this.documentTableColumnName.nth(index)).toHaveText(text);
});
}
async searchByKeywordInCollection(keyword) {
await this.searchTxt.clear();
await this.searchTxt.fill(keyword);
await this.searchTxt.press('Enter');
await this.page.waitForTimeout(500);
}
async clickSelectVariantButton() {
await (0, test_1.expect)(this.selectAVariantBtn).toBeVisible();
await this.selectAVariantBtn.click();
}
async clickVariantAddModeButtonForLanguageName(language) {
await this.variantAddModeBtn.getByText(language).click();
await this.page.waitForTimeout(500);
}
async clickSaveAndCloseButton() {
await this.saveAndCloseBtn.click();
await this.page.waitForTimeout(500);
}
// List View
async clickCreateContentWithName(name) {
await (0, test_1.expect)(this.page.getByLabel('Create ' + name)).toBeVisible();
await this.page.getByLabel('Create ' + name).click();
}
async enterNameInContainer(name) {
await (0, test_1.expect)(this.enterNameInContainerTxt).toBeVisible();
await this.enterNameInContainerTxt.clear();
await this.enterNameInContainerTxt.fill(name);
}
async goToContentInListViewWithName(contentName) {
await this.listView.getByLabel(contentName).click();
}
async doesListViewHaveNoItemsInList() {
await (0, test_1.expect)(this.listView.filter({ hasText: 'There are no items to show in the list.' })).toBeVisible();
}
async doesContentListHaveNoItemsInList() {
await (0, test_1.expect)(this.umbDocumentCollection.filter({ hasText: 'No items' })).toBeVisible();
}
async clickNameButtonInListView() {
await this.nameBtn.click();
}
async doesFirstItemInListViewHaveName(name) {
await (0, test_1.expect)(this.listViewTableRow.first()).toContainText(name);
}
async doesListViewContainCount(count) {
await (0, test_1.expect)(this.listViewTableRow).toHaveCount(count);
}
async selectContentWithNameInListView(name) {
const contentInListViewLocator = this.listViewTableRow.filter({ hasText: name });
await (0, test_1.expect)(contentInListViewLocator).toBeVisible();
await contentInListViewLocator.click();
}
async clickPublishSelectedListItems() {
await this.publishSelectedListItems.click();
}
async clickUnpublishSelectedListItems() {
await this.unpublishSelectedListItems.click();
}
async clickDuplicateToSelectedListItems() {
await (0, test_1.expect)(this.duplicateToSelectedListItems).toBeVisible();
// This force click is needed
await this.duplicateToSelectedListItems.click({ force: true });
}
async clickMoveToSelectedListItems() {
await (0, test_1.expect)(this.moveToSelectedListItems).toBeVisible();
// This force click is needed
await this.moveToSelectedListItems.click({ force: true });
}
async clickTrashSelectedListItems() {
await this.trashSelectedListItems.click();
}
async selectDocumentWithNameAtRoot(name) {
await this.openCaretButtonForName('Content');
const documentWithNameLocator = this.modalContent.getByLabel(name);
await (0, test_1.expect)(documentWithNameLocator).toBeVisible();
await documentWithNameLocator.click();
await this.clickChooseButton();
}
async clickTrashButton() {
await (0, test_1.expect)(this.trashBtn).toBeVisible();
await this.trashBtn.click();
}
async clickExactTrashButton() {
await this.exactTrashBtn.click();
}
async isDocumentListViewVisible(isVisible = true) {
await (0, test_1.expect)(this.documentListView).toBeVisible({ visible: isVisible });
}
async isDocumentGridViewVisible(isVisible = true) {
await (0, test_1.expect)(this.documentGridView).toBeVisible({ visible: isVisible });
}
async changeDocumentSectionLanguage(newLanguageName) {
await this.documentLanguageSelect.click();
const documentSectionLanguageLocator = this.documentLanguageSelectPopover.getByLabel(newLanguageName);
await (0, test_1.expect)(documentSectionLanguageLocator).toBeVisible();
// Force click is needed
await documentSectionLanguageLocator.click({ force: true });
}
async doesDocumentSectionHaveLanguageSelected(languageName) {
await (0, test_1.expect)(this.documentLanguageSelect).toHaveText(languageName);
}
async isDocumentReadOnly(isVisible = true) {
await (0, test_1.expect)(this.documentReadOnly).toBeVisible({ visible: isVisible });
}
async isDocumentNameInputEditable(isEditable = true) {
await (0, test_1.expect)(this.contentNameTxt).toBeVisible();
await (0, test_1.expect)(this.contentNameTxt).toBeEditable({ editable: isEditable });
}
async isActionsMenuForRecycleBinVisible(isVisible = true) {
await this.isActionsMenuForNameVisible('Recycle Bin', isVisible);
}
async isActionsMenuForRootVisible(isVisible = true) {
await this.isActionsMenuForNameVisible('Content', isVisible);
}
async clickEmptyRecycleBinButton() {
await this.recycleBinMenuItem.hover();
await (0, test_1.expect)(this.emptyRecycleBinBtn).toBeVisible();
// Force click is needed
await this.emptyRecycleBinBtn.click({ force: true });
}
async clickConfirmEmptyRecycleBinButton() {
await this.confirmEmptyRecycleBinBtn.click();
}
async isDocumentPropertyEditable(propertyName, isEditable = true) {
const propertyLocator = this.documentWorkspace.locator(this.property).filter({ hasText: propertyName }).locator('#input');
await (0, test_1.expect)(propertyLocator).toBeVisible();
await (0, test_1.expect)(propertyLocator).toBeEditable({ editable: isEditable });
}
async doesDocumentPropertyHaveValue(propertyName, value) {
const propertyLocator = this.documentWorkspace.locator(this.property).filter({ hasText: propertyName }).locator('#input');
await (0, test_1.expect)(propertyLocator).toHaveValue(value);
}
async clickContentTab() {
await this.splitView.getByRole('tab', { name: 'Content' }).click();
}
async isDocumentTreeEmpty() {
await (0, test_1.expect)(this.documentTreeItem).toHaveCount(0);
}
async doesDocumentWorkspaceContainName(name) {
await (0, test_1.expect)(this.documentWorkspaceEditor.locator('#input')).toHaveValue(name);
}
async doesDocumentWorkspaceHaveText(text) {
return (0, test_1.expect)(this.documentWorkspace).toContainText(text);
}
async enterDocumentBlueprintName(name) {
await this.documentBlueprintModalEnterNameTxt.clear();
await this.documentBlueprintModalEnterNameTxt.fill(name);
}
async clickSaveDocumentBlueprintButton() {
await this.documentBlueprintSaveBtn.click();
}
async clickDuplicateToButton() {
await this.duplicateToBtn.click();
}
async clickDuplicateButton() {
await this.duplicateBtn.click();
}
async clickMoveToButton() {
await this.moveToBtn.click();
}
async moveToContentWithName(parentNames, moveTo) {
for (const contentName of parentNames) {
await this.container.getByLabel('Expand child items for ' + contentName).click();
}
await this.container.getByLabel(moveTo).click();
await this.clickChooseContainerButton();
}
async isCaretButtonVisibleForContentName(contentName, isVisible = true) {
await (0, test_1.expect)(this.page.locator('[label="' + contentName + '"]').getByLabel('Expand child items for ')).toBeVisible({ visible: isVisible });
}
async reloadContentTree() {
await (0, test_1.expect)(this.contentTreeRefreshBtn).toBeVisible();
// Force click is needed
await this.contentTreeRefreshBtn.click({ force: true });
}
async clickSortChildrenButton() {
await (0, test_1.expect)(this.sortChildrenBtn).toBeVisible();
await this.sortChildrenBtn.click();
}
async clickRollbackButton() {
await (0, test_1.expect)(this.rollbackBtn).toBeVisible();
await this.rollbackBtn.click();
}
async clickRollbackContainerButton() {
await (0, test_1.expect)(this.rollbackContainerBtn).toBeVisible();
await this.rollbackContainerBtn.click();
}
async clickLatestRollBackItem() {
await (0, test_1.expect)(this.rollbackItem.last()).toBeVisible();
await this.rollbackItem.last().click();
}
async clickPublicAccessButton() {
await (0, test_1.expect)(this.publicAccessBtn).toBeVisible();
await this.publicAccessBtn.click();
}
async addGroupBasedPublicAccess(memberGroupName, documentName) {
await (0, test_1.expect)(this.groupBasedProtectionBtn).toBeVisible();
await this.groupBasedProtectionBtn.click();
await this.nextBtn.click();
await this.chooseMemberGroupBtn.click();
await this.page.getByLabel(memberGroupName).click();
await this.clickChooseModalButton();
await this.selectLoginPageDocument.click();
await this.container.getByLabel(documentName, { exact: true }).click();
await this.clickChooseModalButton();
await this.selectErrorPageDocument.click();
await this.container.getByLabel(documentName, { exact: true }).click();
await this.clickChooseModalButton();
await this.containerSaveBtn.click();
}
async sortChildrenDragAndDrop(dragFromSelector, dragToSelector, verticalOffset = 0, horizontalOffset = 0, steps = 5) {
await (0, test_1.expect)(dragFromSelector).toBeVisible();
await (0, test_1.expect)(dragToSelector).toBeVisible();
const targetLocation = await dragToSelector.boundingBox();
const elementCenterX = targetLocation.x + targetLocation.width / 2;
const elementCenterY = targetLocation.y + targetLocation.height / 2;
await dragFromSelector.hover();
await this.page.mouse.move(10, 10);
await dragFromSelector.hover();
await this.page.mouse.down();
await this.page.waitForTimeout(400);
await this.page.mouse.move(elementCenterX + horizontalOffset, elementCenterY + verticalOffset, { steps: steps });
await this.page.waitForTimeout(400);
// If we do not have this, the drag and drop will not work
await dragToSelector.hover();
await this.page.mouse.up();
}
async clickSortButton() {
await (0, test_1.expect)(this.sortBtn).toBeVisible();
await this.sortBtn.click();
}
async doesIndexDocumentInTreeContainName(parentName, childName, index) {
await (0, test_1.expect)(this.documentTreeItem.locator('[label="' + parentName + '"]').locator('umb-tree-item').nth(index).locator('#label')).toHaveText(childName);
}
async selectMemberGroup(memberGroupName) {
await (0, test_1.expect)(this.uuiCheckbox.getByLabel(memberGroupName)).toBeVisible();
await this.uuiCheckbox.getByLabel(memberGroupName).click();
}
async isPermissionInActionsMenuVisible(permissionName, isVisible = true) {
await (0, test_1.expect)(this.actionsMenu.getByRole('button', {
name: permissionName,
exact: true
})).toBeVisible({ visible: isVisible });
}
async clickDocumentLinkButton() {
await (0, test_1.expect)(this.linkToDocumentBtn).toBeVisible();
await this.linkToDocumentBtn.click();
}
async clickMediaLinkButton() {
await (0, test_1.expect)(this.linkToMediaBtn).toBeVisible();
await this.linkToMediaBtn.click();
}
async clickManualLinkButton() {
await (0, test_1.expect)(this.linkToManualBtn).toBeVisible();
await this.linkToManualBtn.click();
}
// Block Grid - Block List
async clickAddBlockElementButton() {
await (0, test_1.expect)(this.addBlockElementBtn).toBeVisible();
await this.addBlockElementBtn.click();
}
async clickAddBlockWithNameButton(name) {
await (0, test_1.expect)(this.page.getByLabel('Add ' + name)).toBeVisible();
await this.page.getByLabel('Add ' + name).click();
}
async clickCreateForModalWithHeadline(headline) {
await (0, test_1.expect)(this.page.locator('[headline="' + headline + '"]').getByLabel('Create')).toBeVisible();
await this.page.locator('[headline="' + headline + '"]').getByLabel('Create').click();
}
async isAddBlockElementButtonVisible(isVisible = true) {
await (0, test_1.expect)(this.addBlockElementBtn).toBeVisible({ visible: isVisible });
}
async isAddBlockElementButtonWithLabelVisible(blockName, label, isVisible = true) {
await (0, test_1.expect)(this.property.filter({ hasText: blockName }).locator(this.addBlockElementBtn).filter({ hasText: label })).toBeVisible({ visible: isVisible });
}
async doesFormValidationMessageContainText(text) {
await (0, test_1.expect)(this.formValidationMessage).toContainText(text);
}
async doesBlockElementHaveName(name) {
await (0, test_1.expect)(this.blockName).toContainText(name);
}
async clickAddBlockSettingsTabButton() {
await (0, test_1.expect)(this.addBlockSettingsTabBtn).toBeVisible();
await this.addBlockSettingsTabBtn.click();
}
async clickEditBlockGridBlockButton() {
await (0, test_1.expect)(this.blockGridEntry).toBeVisible();
await this.blockGridEntry.hover();
await (0, test_1.expect)(this.editBlockEntryBtn).toBeVisible();
await this.editBlockEntryBtn.click();
}
async clickDeleteBlockGridBlockButton() {
await (0, test_1.expect)(this.blockGridEntry).toBeVisible();
await this.blockGridEntry.hover();
await (0, test_1.expect)(this.deleteBlockEntryBtn).toBeVisible();
await this.deleteBlockEntryBtn.click();
}
async clickEditBlockListBlockButton() {
await (0, test_1.expect)(this.blockListEntry).toBeVisible();
await this.blockListEntry.hover();
await (0, test_1.expect)(this.editBlockEntryBtn).toBeVisible();
await this.editBlockEntryBtn.click();
}
async clickDeleteBlockListBlockButton() {
await (0, test_1.expect)(this.blockListEntry).toBeVisible();
await this.blockL