UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

1,027 lines 57.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UiBaseLocators = void 0; const test_1 = require("@playwright/test"); const ConstantHelper_1 = require("./ConstantHelper"); class UiBaseLocators { page; saveBtn; chooseBtn; submitBtn; createFolderBtn; breadcrumbBtn; confirmToDeleteBtn; deleteExactBtn; confirmCreateFolderBtn; insertBtn; modalCaretBtn; queryBuilderBtn; queryBuilderOrderedBy; queryBuilderCreateDate; folderNameTxt; textAreaInputArea; wherePropertyAliasBtn; whereOperatorBtn; whereConstrainValueTxt; orderByPropertyAliasBtn; ascendingBtn; queryBuilderShowCode; createThreeDotsBtn; newFolderThreeDotsBtn; renameThreeDotsBtn; newNameTxt; renameModalBtn; createBtn; successState; chooseModalBtn; addBtn; renameFolderThreeDotsBtn; renameFolderBtn; updateFolderBtn; filterChooseBtn; updateBtn; changeBtn; propertyNameTxt; selectPropertyEditorBtn; addGroupBtn; iAmDoneReorderingBtn; reorderBtn; compositionsBtn; addTabBtn; descriptionBtn; enterDescriptionTxt; mandatoryToggle; validation; regexTxt; regexMessageTxt; structureTabBtn; allowAtRootBtn; addPropertyBtn; typeToFilterSearchTxt; editorSettingsBtn; labelAboveBtn; unnamedTxt; deleteThreeDotsBtn; removeExactBtn; confirmBtn; disableBtn; confirmDisableBtn; enableBtn; confirmEnableBtn; iconBtn; aliasLockBtn; aliasNameTxt; deleteFolderThreeDotsBtn; createLink; insertValueBtn; insertPartialViewBtn; insertDictionaryItemBtn; chooseFieldDropDown; systemFieldsOption; chooseFieldValueDropDown; renameBtn; returnedItemsCount; chooseRootContentBtn; queryResults; reloadBtn; confirmToRemoveBtn; confirmToSubmitBtn; typeGroups; allowedChildNodesModal; addCollectionBtn; errorNotification; confirmRenameBtn; successNotification; leftArrowBtn; clickToUploadBtn; backOfficeHeader; failedStateButton; sidebarModal; enterAName; mediaCardItems; enterPropertyEditorDescriptionTxt; breadcrumbsTemplateModal; containerChooseBtn; documentTypeNode; groupLabel; containerSaveAndPublishBtn; confirmTrashBtn; recycleBinBtn; recycleBinMenuItemCaretBtn; recycleBinMenuItem; gridBtn; listBtn; viewBundleBtn; chooseDocumentInputBtn; chooseMediaInputBtn; container; createDocumentBlueprintBtn; actionBtn; mediaPickerModalSubmitBtn; deleteBtn; createModalBtn; mediaCaptionAltTextModalSubmitBtn; embeddedMediaModal; embeddedURLTxt; embeddedRetrieveBtn; embeddedMediaModalConfirmBtn; embeddedPreview; sectionSidebar; actionsMenuContainer; menuItem; property; currentUserAvatarBtn; newPasswordTxt; confirmPasswordTxt; currentPasswordTxt; createOptionActionListModal; createActionButtonCollection; createActionBtn; collectionTreeItemTableRow; folderBtn; reloadChildrenBtn; confirmActionModalEntityReferences; referenceHeadline; entityItemRef; validationMessage; successStateIcon; workspaceAction; entityAction; openEntityAction; caretBtn; workspaceActionMenuBtn; constructor(page) { this.page = page; this.saveBtn = page.getByLabel('Save', { exact: true }); this.submitBtn = page.getByLabel('Submit'); this.deleteExactBtn = page.getByRole('button', { name: 'Delete', exact: true }); this.confirmToDeleteBtn = page.locator('#confirm').getByLabel('Delete'); this.confirmCreateFolderBtn = page.locator('#confirm').getByLabel('Create Folder'); this.breadcrumbBtn = page.getByLabel('Breadcrumb'); this.createFolderBtn = page.getByLabel('Create folder'); this.insertBtn = page.locator('uui-box uui-button').filter({ hasText: 'Insert' }); this.sidebarModal = page.locator('uui-modal-sidebar'); this.modalCaretBtn = this.sidebarModal.locator('#caret-button'); this.enterAName = page.getByLabel('Enter a name...', { exact: true }); this.queryBuilderBtn = page.locator('#query-builder-button'); this.queryBuilderOrderedBy = page.locator('#property-alias-dropdown').getByLabel('Property alias'); this.queryBuilderCreateDate = page.locator('#property-alias-dropdown').getByText('CreateDate').locator(".."); this.folderNameTxt = page.getByLabel('Enter a folder name'); this.textAreaInputArea = page.locator('textarea.inputarea'); this.wherePropertyAliasBtn = page.locator('#property-alias-dropdown'); this.whereOperatorBtn = page.locator('#operator-dropdown'); this.whereConstrainValueTxt = page.getByLabel('constrain value'); this.orderByPropertyAliasBtn = page.locator('#sort-dropdown'); this.ascendingBtn = page.locator('[key="template_ascending"]'); this.queryBuilderShowCode = page.locator('umb-code-block'); this.createThreeDotsBtn = page.getByText('Create…', { exact: true }); this.chooseBtn = page.getByLabel('Choose', { exact: true }); this.containerChooseBtn = page.locator('#container').getByLabel('Choose'); this.containerSaveAndPublishBtn = page.locator('#container').getByLabel('Save and Publish'); this.newFolderThreeDotsBtn = page.getByLabel('New Folder…'); this.renameThreeDotsBtn = page.getByLabel('Rename…', { exact: true }); this.newNameTxt = page.getByRole('textbox', { name: 'Enter new name...' }); this.renameModalBtn = page.locator('umb-rename-modal').getByLabel('Rename'); this.createBtn = page.getByRole('button', { name: /^Create(…)?$/ }); this.actionsMenuContainer = page.locator('uui-scroll-container'); this.successState = page.locator('[state="success"]'); this.chooseModalBtn = this.sidebarModal.locator('[look="primary"]').getByLabel('Choose'); this.addBtn = page.getByRole('button', { name: 'Add', exact: true }); this.renameFolderThreeDotsBtn = page.getByRole('button', { name: 'Rename folder…' }); this.renameFolderBtn = page.getByLabel('Rename folder'); this.confirmRenameBtn = page.locator('#confirm').getByLabel('Rename'); this.updateFolderBtn = page.getByLabel('Update folder'); this.filterChooseBtn = page.locator('button').filter({ hasText: 'Choose' }); this.updateBtn = page.getByLabel('Update'); this.changeBtn = page.getByLabel('Change'); this.propertyNameTxt = page.locator('#name-input #input'); this.selectPropertyEditorBtn = page.getByLabel('Select Property Editor'); this.addGroupBtn = page.getByLabel('Add group', { exact: true }); this.iAmDoneReorderingBtn = page.getByLabel('I am done reordering'); this.reorderBtn = page.getByLabel('Reorder'); this.compositionsBtn = page.getByLabel('Compositions'); this.addTabBtn = page.getByLabel('Add tab'); this.descriptionBtn = page.getByLabel('Description'); this.enterDescriptionTxt = page.getByLabel('Enter a description...'); this.mandatoryToggle = page.locator('#mandatory #toggle'); this.validation = page.locator('#native'); this.regexTxt = page.locator('input[name="pattern"]'); this.regexMessageTxt = page.locator('textarea[name="pattern-message"]'); this.structureTabBtn = page.locator('uui-tab').filter({ hasText: 'Structure' }).locator('svg'); this.allowAtRootBtn = page.locator('label').filter({ hasText: 'Allow at root' }); this.addPropertyBtn = page.getByLabel('Add property', { exact: true }); this.typeToFilterSearchTxt = page.locator('[type="search"] #input'); this.editorSettingsBtn = page.getByLabel('Editor settings'); this.labelAboveBtn = page.locator('button').filter({ hasText: 'Label above' }); this.unnamedTxt = page.getByRole('textbox', { name: 'Unnamed' }); this.deleteThreeDotsBtn = page.getByLabel('Delete…'); this.removeExactBtn = page.getByLabel('Remove', { exact: true }); this.confirmBtn = page.getByLabel('Confirm'); this.disableBtn = page.getByLabel('Disable', { exact: true }); this.confirmDisableBtn = page.locator('#confirm').getByLabel('Disable'); this.confirmToSubmitBtn = page.locator('#confirm').getByLabel('Submit'); this.enableBtn = page.getByLabel('Enable'); this.confirmEnableBtn = page.locator('#confirm').getByLabel('Enable'); this.iconBtn = page.getByLabel('icon'); this.aliasLockBtn = page.locator('#name #lock'); this.aliasNameTxt = page.locator('#name').getByLabel('alias'); this.deleteFolderThreeDotsBtn = page.locator('#action-modal').getByLabel('Delete Folder...'); this.createLink = page.getByRole('link', { name: 'Create', exact: true }); this.insertValueBtn = page.locator('uui-button').filter({ has: page.locator('[key="template_insertPageField"]') }); this.insertPartialViewBtn = page.locator('uui-button').filter({ has: page.locator('[key="template_insertPartialView"]') }); this.insertDictionaryItemBtn = page.locator('uui-button').filter({ has: page.locator('[key="template_insertDictionaryItem"]') }); this.chooseFieldDropDown = page.locator('#preview #expand-symbol-wrapper'); this.systemFieldsOption = page.getByText('System fields'); this.chooseFieldValueDropDown = page.locator('#value #expand-symbol-wrapper'); this.renameBtn = page.getByRole('button', { name: /^Rename(…)?$/ }); this.returnedItemsCount = page.locator('#results-count'); this.chooseRootContentBtn = page.getByLabel('Choose root document'); this.queryResults = page.locator('.query-results'); this.reloadBtn = page.getByRole('button', { name: 'Reload', exact: true }); this.confirmToRemoveBtn = page.locator('#confirm').getByLabel('Remove'); this.typeGroups = page.locator('umb-content-type-design-editor-group'); this.allowedChildNodesModal = page.locator('umb-tree-picker-modal'); this.addCollectionBtn = page.locator('umb-input-content-type-collection-configuration #create-button'); this.errorNotification = page.locator('uui-toast-notification[open][color="danger"]'); this.successNotification = page.locator('uui-toast-notification[open][color="positive"]'); this.leftArrowBtn = page.locator('[name="icon-arrow-left"] svg'); this.clickToUploadBtn = page.locator('#splitViews').getByRole('button', { name: 'Click to upload' }); this.backOfficeHeader = page.locator('umb-backoffice-header'); this.failedStateButton = page.locator('uui-button[state="failed"]'); this.mediaCardItems = page.locator('uui-card-media'); this.enterPropertyEditorDescriptionTxt = this.sidebarModal.getByLabel('Enter a description...'); this.breadcrumbsTemplateModal = this.sidebarModal.locator('umb-template-workspace-editor uui-breadcrumbs'); this.documentTypeNode = page.locator('uui-ref-node-document-type'); this.groupLabel = page.getByLabel('Group', { exact: true }); this.confirmTrashBtn = page.locator('#confirm').getByLabel('Trash'); this.recycleBinBtn = page.getByLabel('Recycle Bin', { exact: true }); this.recycleBinMenuItem = page.locator('uui-menu-item[label="Recycle Bin"]'); this.recycleBinMenuItemCaretBtn = this.recycleBinMenuItem.locator('#caret-button'); this.gridBtn = page.getByLabel('Grid'); this.listBtn = page.getByLabel('List'); this.viewBundleBtn = page.locator('umb-collection-view-bundle uui-button svg'); this.createDocumentBlueprintBtn = page.getByLabel(/^Create Document Blueprint(…)?$/); this.chooseDocumentInputBtn = page.locator('umb-input-document').getByLabel('Choose'); this.chooseMediaInputBtn = page.locator('umb-input-media').getByLabel('Choose'); this.container = page.locator('#container'); this.actionBtn = page.getByTestId('workspace:action-menu-button'); this.mediaPickerModalSubmitBtn = page.locator('umb-media-picker-modal').getByLabel('Submit'); this.deleteBtn = page.getByRole('button', { name: /^Delete(…)?$/ }); this.createModalBtn = this.sidebarModal.getByLabel('Create', { exact: true }); this.mediaCaptionAltTextModalSubmitBtn = page.locator('umb-media-caption-alt-text-modal').getByLabel('Submit'); this.embeddedMediaModal = page.locator('umb-embedded-media-modal'); this.embeddedURLTxt = this.embeddedMediaModal.locator('[label="URL"] #input'); this.embeddedRetrieveBtn = this.embeddedMediaModal.locator('[label="Retrieve"]'); this.embeddedMediaModalConfirmBtn = this.embeddedMediaModal.getByLabel('Confirm'); this.embeddedPreview = this.embeddedMediaModal.locator('[label="Preview"]'); this.sectionSidebar = page.locator('umb-section-sidebar'); this.menuItem = page.locator('uui-menu-item'); this.property = page.locator('umb-property'); this.currentUserAvatarBtn = page.getByTestId('header-app:Umb.HeaderApp.CurrentUser').locator('uui-avatar'); this.currentPasswordTxt = page.locator('input[name="oldPassword"]'); this.newPasswordTxt = page.locator('input[name="newPassword"]'); this.confirmPasswordTxt = page.locator('input[name="confirmPassword"]'); this.createOptionActionListModal = page.locator('umb-entity-create-option-action-list-modal'); this.createActionButtonCollection = page.locator('umb-collection-create-action-button'); this.createActionBtn = this.createActionButtonCollection.locator('[label="Create"]'); this.collectionTreeItemTableRow = page.locator('umb-collection-workspace-view umb-table uui-table-row'); this.folderBtn = this.createOptionActionListModal.locator('[name="Folder"]'); this.reloadChildrenBtn = page.getByRole('button', { name: 'Reload children' }); this.confirmActionModalEntityReferences = page.locator('umb-confirm-action-modal-entity-references,umb-confirm-bulk-action-modal-entity-references'); this.referenceHeadline = this.confirmActionModalEntityReferences.locator('#reference-headline'); this.entityItemRef = this.confirmActionModalEntityReferences.locator('umb-entity-item-ref'); this.validationMessage = page.locator('umb-form-validation-message').locator('#messages'); this.successStateIcon = this.successState.locator('#state'); this.workspaceAction = page.locator('umb-workspace-action'); this.caretBtn = page.locator('#caret-button'); // Entity Action this.entityAction = page.locator('umb-entity-action-list umb-entity-action'); this.openEntityAction = page.locator('#action-modal[open]').locator(this.entityAction); // Workspace Entity Action this.workspaceActionMenuBtn = page.getByTestId('workspace:action-menu-button'); } async clickActionsMenuForNameInSectionSidebar(name) { await this.sectionSidebar.locator('[label="' + name + '"]').hover(); await this.sectionSidebar.locator('[label="' + name + '"] >> [label="Open actions menu"]').first().click(); } async clickActionsMenuForName(name) { await (0, test_1.expect)(this.page.locator('uui-menu-item[label="' + name + '"]').locator('#menu-item').first()).toBeVisible(); await this.page.locator('uui-menu-item[label="' + name + '"]').locator('#menu-item').first().hover({ force: true }); await this.page.locator('uui-menu-item[label="' + name + '"] #action-modal').first().click({ force: true }); } async isActionsMenuForNameVisible(name, isVisible = true) { await this.page.locator('uui-menu-item[label="' + name + '"]').click(); await (0, test_1.expect)(this.page.locator('uui-menu-item[label="' + name + '"] #action-modal').first()).toBeVisible({ visible: isVisible }); } async clickCaretButtonForName(name) { await this.isCaretButtonWithNameVisible(name); await this.page.locator('uui-menu-item[label="' + name + '"]').locator('#caret-button').first().click(); } async isCaretButtonWithNameVisible(name, isVisible = true) { await (0, test_1.expect)(this.page.locator('uui-menu-item[label="' + name + '"]').locator('#caret-button').first()).toBeVisible({ visible: isVisible }); } async clickCaretButton() { await this.page.locator('#caret-button').click(); } async openCaretButtonForName(name) { const menuItem = this.page.locator('uui-menu-item[label="' + name + '"]'); const isCaretButtonOpen = await menuItem.getAttribute('show-children'); if (isCaretButtonOpen === null) { await this.clickCaretButtonForName(name); } } async reloadTree(treeName) { // Waits until the tree item is visible await (0, test_1.expect)(this.page.getByLabel(treeName, { exact: true })).toBeVisible(); await this.page.waitForTimeout(500); await this.clickActionsMenuForName(treeName); await this.clickReloadChildrenActionMenuOption(); await this.openCaretButtonForName(treeName); } async clickReloadButton() { await (0, test_1.expect)(this.reloadBtn).toBeVisible(); await this.reloadBtn.click(); } async clickReloadChildrenButton() { await (0, test_1.expect)(this.reloadChildrenBtn).toBeVisible(); await this.reloadChildrenBtn.click({ force: true }); } async isSuccessStateVisibleForSaveButton(isVisible = true) { const regex = new RegExp(`^workspace-action:.*Save$`); const saveButtonLocator = this.page.getByTestId(regex); const saveBtn = this.workspaceAction.filter({ has: saveButtonLocator }); await (0, test_1.expect)(saveBtn.locator(this.successState)).toBeVisible({ visible: isVisible, timeout: 10000 }); } async clickSaveButton() { await (0, test_1.expect)(this.saveBtn).toBeVisible(); await this.saveBtn.click(); await this.page.waitForTimeout(500); } async waitForNetworkToBeIdle() { await this.page.waitForLoadState('networkidle'); } async clickChooseButton() { await (0, test_1.expect)(this.chooseBtn).toBeVisible(); await this.chooseBtn.click(); } async clickChooseContainerButton() { await this.containerChooseBtn.click(); } async clickFilterChooseButton() { await this.filterChooseBtn.click(); } async clickRenameFolderThreeDotsButton() { await this.renameFolderThreeDotsBtn.click(); } async clickRenameFolderButton() { await this.clickRenameButton(); } async clickConfirmRenameButton() { await this.confirmRenameBtn.click(); } async clickUpdateFolderButton() { await this.updateFolderBtn.click(); } async clickUpdateButton() { await this.updateBtn.click(); } async clickSubmitButton() { await (0, test_1.expect)(this.submitBtn).toBeVisible(); await this.submitBtn.click(); } async clickConfirmToSubmitButton() { await this.confirmToSubmitBtn.click(); } async clickChangeButton() { await this.changeBtn.click(); } async clickExactLinkWithName(name, toForce = false) { const exactLinkWithNameLocator = this.page.getByRole('link', { name: name, exact: true }); await (0, test_1.expect)(exactLinkWithNameLocator).toBeVisible(); await exactLinkWithNameLocator.click({ force: toForce }); } async enterAliasName(aliasName) { // Unlocks alias await this.aliasLockBtn.click(); await this.aliasNameTxt.clear(); await this.aliasNameTxt.fill(aliasName); } async updateIcon(iconName) { await (0, test_1.expect)(this.iconBtn).toBeVisible(); // Force click is needed await this.iconBtn.click({ force: true }); await this.searchForTypeToFilterValue(iconName); await this.clickLabelWithName(iconName, true, true); await this.clickSubmitButton(); } async clickTextButtonWithName(name) { await (0, test_1.expect)(this.page.getByText(name, { exact: true })).toBeVisible(); await this.page.getByText(name, { exact: true }).click(); } async clickSelectPropertyEditorButton() { await (0, test_1.expect)(this.selectPropertyEditorBtn).toBeVisible(); await this.selectPropertyEditorBtn.click(); } async clickCreateFolderButton() { await (0, test_1.expect)(this.createFolderBtn).toBeVisible(); await this.createFolderBtn.click(); await this.page.waitForTimeout(500); // Wait for the action to complete } async enterAPropertyName(name) { await (0, test_1.expect)(this.propertyNameTxt).toBeVisible(); await this.propertyNameTxt.fill(name); } async clickConfirmButton() { await (0, test_1.expect)(this.confirmBtn).toBeVisible(); await this.confirmBtn.click(); } async clickBreadcrumbButton() { await (0, test_1.expect)(this.breadcrumbBtn).toBeVisible(); await this.breadcrumbBtn.click(); } async clickInsertButton() { await (0, test_1.expect)(this.insertBtn).toBeVisible(); await this.insertBtn.click(); } async clickConfirmToDeleteButton() { await (0, test_1.expect)(this.confirmToDeleteBtn).toBeVisible(); await this.confirmToDeleteBtn.click(); await this.page.waitForTimeout(500); // Wait for the action to complete } async clickConfirmCreateFolderButton() { await (0, test_1.expect)(this.confirmCreateFolderBtn).toBeVisible(); await this.confirmCreateFolderBtn.click(); await this.page.waitForTimeout(500); // Wait for the action to complete } async clickRemoveExactButton() { await (0, test_1.expect)(this.removeExactBtn).toBeVisible(); await this.removeExactBtn.click(); } async clickRemoveButtonForName(name) { const removeButtonWithNameLocator = this.page.locator('[name="' + name + '"] [label="Remove"]'); await (0, test_1.expect)(removeButtonWithNameLocator).toBeVisible(); await removeButtonWithNameLocator.click(); } async clickTrashIconButtonForName(name) { const trashIconButtonWithNameLocator = this.page.locator('[name="' + name + '"] [name="icon-trash"]'); await (0, test_1.expect)(trashIconButtonWithNameLocator).toBeVisible(); await trashIconButtonWithNameLocator.click(); } async clickRemoveWithName(name) { const removeLabelWithNameLocator = this.page.locator('[label="Remove ' + name + '"]'); await (0, test_1.expect)(removeLabelWithNameLocator).toBeVisible(); await removeLabelWithNameLocator.click(); } async clickDisableButton() { await (0, test_1.expect)(this.disableBtn).toBeVisible(); await this.disableBtn.click(); } async clickConfirmDisableButton() { await (0, test_1.expect)(this.confirmDisableBtn).toBeVisible(); await this.confirmDisableBtn.click(); } async clickConfirmRemoveButton() { await (0, test_1.expect)(this.confirmToRemoveBtn).toBeVisible(); await this.confirmToRemoveBtn.click(); } async clickEnableButton() { await (0, test_1.expect)(this.enableBtn).toBeVisible(); await this.enableBtn.click(); } async clickConfirmEnableButton() { await (0, test_1.expect)(this.confirmEnableBtn).toBeVisible(); await this.confirmEnableBtn.click(); } async insertDictionaryItem(dictionaryName) { await this.clickInsertButton(); await (0, test_1.expect)(this.insertDictionaryItemBtn).toBeVisible(); await this.insertDictionaryItemBtn.click(); await (0, test_1.expect)(this.page.getByLabel(dictionaryName)).toBeVisible(); await this.page.getByLabel(dictionaryName).click(); await (0, test_1.expect)(this.chooseBtn).toBeVisible(); await this.chooseBtn.click(); } async addQueryBuilderWithOrderByStatement(propertyAlias, isAscending) { await (0, test_1.expect)(this.queryBuilderBtn).toBeVisible({ timeout: 10000 }); await this.queryBuilderBtn.click(); await (0, test_1.expect)(this.orderByPropertyAliasBtn).toBeVisible(); await this.orderByPropertyAliasBtn.click(); // Wait and choose property alias option await this.waitAndSelectQueryBuilderDropDownList(propertyAlias); await (0, test_1.expect)(this.orderByPropertyAliasBtn).toBeVisible(); await this.orderByPropertyAliasBtn.click(); // Click to ascending button if isAscending is false if (!isAscending) { await (0, test_1.expect)(this.ascendingBtn).toBeVisible(); await this.ascendingBtn.click(); } } async addQueryBuilderWithWhereStatement(propertyAlias, operator, constrainValue) { await (0, test_1.expect)(this.queryBuilderBtn).toBeVisible({ timeout: 10000 }); await this.queryBuilderBtn.click(); // Wait and choose property alias await (0, test_1.expect)(this.wherePropertyAliasBtn).toBeVisible(); await this.wherePropertyAliasBtn.click(); await this.waitAndSelectQueryBuilderDropDownList(propertyAlias); // Wait and choose operator await (0, test_1.expect)(this.whereOperatorBtn).toBeVisible(); await this.whereOperatorBtn.click(); await this.waitAndSelectQueryBuilderDropDownList(operator); // Wait and choose constrain value and press Enter await (0, test_1.expect)(this.whereConstrainValueTxt).toBeVisible(); await this.whereConstrainValueTxt.clear(); await this.whereConstrainValueTxt.fill(constrainValue); await this.whereConstrainValueTxt.press('Enter'); } async waitAndSelectQueryBuilderDropDownList(option) { const ddlOption = this.page.locator('[open]').locator('uui-combobox-list-option').filter({ hasText: option }).first(); await (0, test_1.expect)(ddlOption).toBeVisible({ timeout: 10000 }); await ddlOption.click(); } async createFolder(folderName) { await this.clickCreateActionMenuOption(); await this.clickNewFolderThreeDotsButton(); await this.enterFolderName(folderName); await this.clickConfirmCreateFolderButton(); } async deletePropertyEditor(propertyEditorName) { // We need to hover over the property to be able to see the delete button await this.page.locator('uui-button').filter({ hasText: propertyEditorName }).getByLabel('Editor settings').hover(); await this.deleteBtn.click(); } async enterFolderName(folderName) { await (0, test_1.expect)(this.folderNameTxt).toBeVisible(); await this.folderNameTxt.clear(); await this.folderNameTxt.fill(folderName); await (0, test_1.expect)(this.folderNameTxt).toHaveValue(folderName); } async isTextWithExactNameVisible(name, isVisible = true) { return (0, test_1.expect)(this.page.getByText(name, { exact: true })).toBeVisible({ visible: isVisible }); } async isQueryBuilderCodeShown(code) { await (0, test_1.expect)(this.queryBuilderShowCode).toBeVisible(); await this.queryBuilderShowCode.click(); await (0, test_1.expect)(this.queryBuilderShowCode).toContainText(code, { timeout: 10000 }); } async deleteFolder() { await this.clickDeleteActionMenuOption(); await this.clickConfirmToDeleteButton(); } async clickDeleteExactButton() { await (0, test_1.expect)(this.deleteExactBtn).toBeVisible(); await this.deleteExactBtn.click(); } async isTreeItemVisible(name, isVisible = true) { await (0, test_1.expect)(this.page.locator('umb-tree-item').locator('[label="' + name + '"]')).toBeVisible({ visible: isVisible }); } async doesTreeItemHaveTheCorrectIcon(name, icon) { return await (0, test_1.expect)(this.page.locator('umb-tree-item').filter({ hasText: name }).locator('umb-icon').locator('[name="' + icon + '"]')).toBeVisible(); } async goToSection(sectionName, checkSections = true) { if (checkSections) { for (let section in ConstantHelper_1.ConstantHelper.sections) { await (0, test_1.expect)(this.backOfficeHeader.getByRole('tab', { name: ConstantHelper_1.ConstantHelper.sections[section] })).toBeVisible({ timeout: 30000 }); } } await this.backOfficeHeader.getByRole('tab', { name: sectionName }).click(); } async goToSettingsTreeItem(settingsTreeItemName) { await this.goToSection(ConstantHelper_1.ConstantHelper.sections.settings); await (0, test_1.expect)(this.page.getByLabel(settingsTreeItemName, { exact: true })).toBeVisible(); await this.page.getByLabel(settingsTreeItemName, { exact: true }).click(); } async clickDataElement(elementName, options = null) { await this.page.click(`[data-element="${elementName}"]`, options); } async getDataElement(elementName) { return this.page.locator(`[data-element="${elementName}"]`); } async isButtonWithNameVisible(name) { await (0, test_1.expect)(this.page.getByRole('button', { name: name })).toBeVisible(); } async clickLabelWithName(name, isExact = true, toForce = false) { await (0, test_1.expect)(this.page.getByLabel(name, { exact: isExact })).toBeVisible(); await this.page.getByLabel(name, { exact: isExact }).click({ force: toForce }); } async clickButtonWithName(name, isExact = false) { const exactButtonWithNameLocator = this.page.getByRole('button', { name: name, exact: isExact }); await (0, test_1.expect)(exactButtonWithNameLocator).toBeVisible(); // Force click is needed await exactButtonWithNameLocator.click({ force: true }); } async isSuccessNotificationVisible(isVisible = true) { return await (0, test_1.expect)(this.successNotification.first()).toBeVisible({ visible: isVisible, timeout: 10000 }); } async doesSuccessNotificationsHaveCount(count) { return await (0, test_1.expect)(this.successNotification).toHaveCount(count); } async isErrorNotificationVisible(isVisible = true) { return await (0, test_1.expect)(this.errorNotification.first()).toBeVisible({ visible: isVisible }); } async isTextWithMessageVisible(message, isVisible = true) { return await (0, test_1.expect)(this.page.getByText(message)).toBeVisible({ visible: isVisible }); } async clickCreateThreeDotsButton() { await (0, test_1.expect)(this.createThreeDotsBtn).toBeVisible(); await this.createThreeDotsBtn.click(); } async clickCreateButton() { await (0, test_1.expect)(this.createBtn).toBeVisible(); await this.createBtn.click(); } async clickAddButton() { await (0, test_1.expect)(this.addBtn).toBeVisible(); await this.addBtn.click(); } ; async clickNewFolderThreeDotsButton() { await (0, test_1.expect)(this.newFolderThreeDotsBtn).toBeVisible(); await this.newFolderThreeDotsBtn.click(); } async clickEditorSettingsButton(index = 0) { await (0, test_1.expect)(this.editorSettingsBtn.nth(index)).toBeVisible(); return this.editorSettingsBtn.nth(index).click(); } async enterDescription(description) { await (0, test_1.expect)(this.enterDescriptionTxt).toBeVisible(); await this.enterDescriptionTxt.clear(); await this.enterDescriptionTxt.fill(description); } async doesDescriptionHaveValue(value, index = 0) { return await (0, test_1.expect)(this.descriptionBtn.nth(index)).toHaveValue(value); } async clickStructureTab() { await this.page.waitForTimeout(1000); await (0, test_1.expect)(this.structureTabBtn).toBeVisible(); await this.structureTabBtn.click(); } async clickAllowAtRootButton() { await (0, test_1.expect)(this.allowAtRootBtn).toBeVisible(); await this.allowAtRootBtn.click(); } async clickIAmDoneReorderingButton() { await (0, test_1.expect)(this.iAmDoneReorderingBtn).toBeVisible(); await this.iAmDoneReorderingBtn.click(); } async clickReorderButton() { await (0, test_1.expect)(this.reorderBtn).toBeVisible(); await this.reorderBtn.click(); } async clickLabelAboveButton() { await (0, test_1.expect)(this.labelAboveBtn).toBeVisible(); await this.labelAboveBtn.click(); } async clickMandatoryToggle() { await (0, test_1.expect)(this.mandatoryToggle).toBeVisible(); await this.mandatoryToggle.click(); } async selectValidationOption(option) { await (0, test_1.expect)(this.validation).toBeVisible(); await this.validation.selectOption(option); } async enterRegEx(regEx) { await (0, test_1.expect)(this.regexTxt).toBeVisible(); await this.regexTxt.fill(regEx); } async enterRegExMessage(regExMessage) { await (0, test_1.expect)(this.regexMessageTxt).toBeVisible(); await this.regexMessageTxt.fill(regExMessage); } async clickCompositionsButton() { await (0, test_1.expect)(this.compositionsBtn).toBeVisible(); await this.compositionsBtn.click(); } async clickAddTabButton() { await (0, test_1.expect)(this.addTabBtn).toBeVisible(); await this.addTabBtn.click(); } async enterTabName(tabName) { await (0, test_1.expect)(this.unnamedTxt).toBeVisible(); await this.page.waitForTimeout(400); await this.unnamedTxt.clear(); await this.unnamedTxt.fill(tabName); await (0, test_1.expect)(this.page.getByRole('textbox', { name: tabName })).toBeVisible(); } async searchForTypeToFilterValue(searchValue) { await (0, test_1.expect)(this.typeToFilterSearchTxt).toBeVisible(); await this.typeToFilterSearchTxt.fill(searchValue); } async addPropertyEditor(propertyEditorName, index = 0) { await (0, test_1.expect)(this.addPropertyBtn.nth(index)).toBeVisible(); await this.addPropertyBtn.nth(index).click(); await this.enterAPropertyName(propertyEditorName); await (0, test_1.expect)(this.propertyNameTxt).toHaveValue(propertyEditorName); await this.clickSelectPropertyEditorButton(); await this.searchForTypeToFilterValue(propertyEditorName); await this.page.getByText(propertyEditorName, { exact: true }).click(); await this.clickSubmitButton(); } async updatePropertyEditor(propertyEditorName) { await this.clickEditorSettingsButton(); await this.clickChangeButton(); await this.searchForTypeToFilterValue(propertyEditorName); await this.page.getByText(propertyEditorName, { exact: true }).click(); await this.enterAPropertyName(propertyEditorName); await this.clickSubmitButton(); } async enterPropertyEditorDescription(description) { await (0, test_1.expect)(this.enterPropertyEditorDescriptionTxt).toBeVisible(); await this.enterPropertyEditorDescriptionTxt.clear(); await this.enterPropertyEditorDescriptionTxt.fill(description); } async clickAddGroupButton() { await (0, test_1.expect)(this.addGroupBtn).toBeVisible(); await this.addGroupBtn.click(); } async clickChooseModalButton() { await (0, test_1.expect)(this.chooseModalBtn).toBeVisible(); await this.chooseModalBtn.click(); } async enterGroupName(groupName, index = 0) { const groupNameTxt = this.groupLabel.nth(index); await (0, test_1.expect)(groupNameTxt).toBeVisible(); await groupNameTxt.clear(); await groupNameTxt.fill(groupName); } async isGroupVisible(groupName, isVisible = true) { await (0, test_1.expect)(this.groupLabel.filter({ hasText: groupName })).toBeVisible({ visible: isVisible }); } async doesGroupHaveValue(value) { await (0, test_1.expect)(this.groupLabel).toBeVisible(); return await (0, test_1.expect)(this.groupLabel).toHaveValue(value); } async rename(newName) { await this.clickRenameActionMenuOption(); await (0, test_1.expect)(this.newNameTxt).toBeVisible(); await this.newNameTxt.click(); await this.newNameTxt.clear(); await this.newNameTxt.fill(newName); await this.renameModalBtn.click(); await this.page.waitForTimeout(500); } async isSuccessButtonWithTextVisible(text) { return await (0, test_1.expect)(this.successState.filter({ hasText: text })).toBeVisible(); } async dragAndDrop(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); await this.page.mouse.up(); } async getButtonWithName(name) { await (0, test_1.expect)(this.page.getByRole('button', { name: name })).toBeVisible(); return this.page.getByRole('button', { name: name }); } async clickCreateLink() { await (0, test_1.expect)(this.createLink).toBeVisible(); await this.createLink.click(); } async insertSystemFieldValue(fieldValue) { await this.clickInsertButton(); await (0, test_1.expect)(this.insertValueBtn).toBeVisible(); await this.insertValueBtn.click(); await (0, test_1.expect)(this.chooseFieldDropDown).toBeVisible(); await this.chooseFieldDropDown.click(); await (0, test_1.expect)(this.systemFieldsOption).toBeVisible(); await this.systemFieldsOption.click(); await (0, test_1.expect)(this.chooseFieldValueDropDown).toBeVisible(); await this.chooseFieldValueDropDown.click(); await (0, test_1.expect)(this.page.getByText(fieldValue)).toBeVisible(); await this.page.getByText(fieldValue).click(); await this.clickSubmitButton(); } async insertPartialView(partialViewName) { await this.clickInsertButton(); await (0, test_1.expect)(this.insertPartialViewBtn).toBeVisible(); await this.insertPartialViewBtn.click(); await (0, test_1.expect)(this.page.getByLabel(partialViewName)).toBeVisible(); await this.page.getByLabel(partialViewName).click(); await this.clickChooseButton(); } async deletePropertyEditorWithName(name) { // We need to hover over the Property Editor to make the delete button visible const propertyEditor = this.page.locator('umb-content-type-design-editor-property', { hasText: name }); await (0, test_1.expect)(propertyEditor).toBeVisible(); await propertyEditor.hover(); await (0, test_1.expect)(propertyEditor.getByLabel('Delete')).toBeVisible(); // Force click is needed await propertyEditor.getByLabel('Delete').click({ force: true }); await this.clickConfirmToDeleteButton(); } async clickRenameButton() { await (0, test_1.expect)(this.renameBtn).toBeVisible(); await this.renameBtn.click(); } async clickDeleteAndConfirmButton() { await this.clickDeleteActionMenuOption(); await this.clickConfirmToDeleteButton(); } async clickDeleteButton() { await (0, test_1.expect)(this.deleteBtn).toBeVisible(); await this.deleteBtn.click(); } async clickQueryBuilderButton() { await (0, test_1.expect)(this.queryBuilderBtn).toBeVisible(); await this.queryBuilderBtn.click(); await this.page.waitForTimeout(500); } async chooseRootContentInQueryBuilder(contentName) { await (0, test_1.expect)(this.chooseRootContentBtn).toBeVisible(); await this.chooseRootContentBtn.click(); await this.clickModalMenuItemWithName(contentName); await this.clickChooseButton(); } async reorderTwoGroups(firstGroupName, secondGroupName) { const firstGroup = this.page.getByTestId('group:' + firstGroupName); const secondGroup = this.page.getByTestId('group:' + secondGroupName); const firstGroupValue = await firstGroup.getByLabel('Group').inputValue(); const secondGroupValue = await secondGroup.getByLabel('Group').inputValue(); const dragToLocator = firstGroup.locator('[name="icon-grip"]').first(); const dragFromLocator = secondGroup.locator('[name="icon-grip"]').first(); await this.dragAndDrop(dragFromLocator, dragToLocator, 0, 0, 10); return { firstGroupValue, secondGroupValue }; } async clickAllowedChildNodesButton() { await (0, test_1.expect)(this.allowedChildNodesModal.locator(this.chooseBtn)).toBeVisible(); await this.allowedChildNodesModal.locator(this.chooseBtn).click(); } async clickAddCollectionButton() { await (0, test_1.expect)(this.addCollectionBtn).toBeVisible(); await this.addCollectionBtn.click(); } async doesReturnedItemsHaveCount(itemCount) { await (0, test_1.expect)(this.returnedItemsCount).toContainText(itemCount.toString() + ' published items returned'); } async doesQueryResultHaveContentName(contentName) { await (0, test_1.expect)(this.queryResults).toContainText(contentName); } async deleteGroup(groupName) { await this.page.waitForTimeout(1000); const groups = this.page.locator('umb-content-type-design-editor-group').all(); for (const group of await groups) { if (await group.getByLabel('Group', { exact: true }).inputValue() === groupName) { const headerActionsDeleteLocator = group.locator('[slot="header-actions"]').getByLabel('Delete'); await (0, test_1.expect)(headerActionsDeleteLocator).toBeVisible(); // Force click is needed await headerActionsDeleteLocator.click({ force: true }); return; } } } async clickRemoveTabWithName(name) { await (0, test_1.expect)(this.page.locator('uui-tab').filter({ hasText: name })).toBeVisible(); await this.page.locator('uui-tab').filter({ hasText: name }).hover(); const removeTabWithNameLocator = this.page.locator('uui-tab').filter({ hasText: name }).locator('[label="Remove"]'); await (0, test_1.expect)(removeTabWithNameLocator).toBeVisible(); await removeTabWithNameLocator.click(); } async clickLeftArrowButton() { await (0, test_1.expect)(this.leftArrowBtn).toBeVisible(); await this.leftArrowBtn.click(); } async clickToUploadButton() { await (0, test_1.expect)(this.clickToUploadBtn).toBeVisible(); await this.clickToUploadBtn.click(); } async uploadFile(filePath) { const [fileChooser] = await Promise.all([ this.page.waitForEvent('filechooser'), await this.clickToUploadButton(), ]); await fileChooser.setFiles(filePath); } getTabLocatorWithName(name) { return this.page.getByRole('tab', { name: name }); } getTextLocatorWithName(name) { return this.page.getByText(name, { exact: true }); } getLocatorWithDataMark(dataMark) { return this.page.getByTestId(dataMark); } ; async isFailedStateButtonVisible() { await (0, test_1.expect)(this.failedStateButton).toBeVisible(); } async clickContainerSaveAndPublishButton() { await (0, test_1.expect)(this.containerSaveAndPublishBtn).toBeVisible(); await this.containerSaveAndPublishBtn.click(); await this.page.waitForTimeout(500); } async clickConfirmTrashButton() { await (0, test_1.expect)(this.confirmTrashBtn).toBeVisible(); await this.confirmTrashBtn.click(); await this.page.waitForTimeout(500); } async reloadRecycleBin(containsItems = true) { await (0, test_1.expect)(this.recycleBinMenuItem).toBeVisible(); // If the Recycle Bin does not contain any items,0 the caret button should not be visible. and we should not try to click it if (!containsItems) { await this.clickReloadChildrenActionMenuOption(); await (0, test_1.expect)(this.recycleBinMenuItemCaretBtn).not.toBeVisible(); return; } await this.clickActionsMenuForName('Recycle Bin'); await this.clickReloadChildrenActionMenuOption(); await this.openCaretButtonForName('Recycle Bin'); } async clickRecycleBinButton() { await (0, test_1.expect)(this.recycleBinBtn).toBeVisible(); await this.recycleBinBtn.click(); } async isItemVisibleInRecycleBin(item, isVisible = true, isReload = true) { if (isReload) { await this.reloadRecycleBin(isVisible); } return await (0, test_1.expect)(this.page.locator('[label="Recycle Bin"] [label="' + item + '"]')).toBeVisible({ visible: isVisible }); } async changeToGridView() { await (0, test_1.expect)(this.viewBundleBtn).toBeVisible(); await this.viewBundleBtn.click(); await this.gridBtn.click(); } async changeToListView() { await (0, test_1.expect)(this.viewBundleBtn).toBeVisible(); await this.viewBundleBtn.click(); await this.listBtn.click(); } async isViewBundleButtonVisible(isVisible = true) { return (0, test_1.expect)(this.viewBundleBtn).toBeVisible({ visible: isVisible }); } async doesSuccessNotificationHaveText(text, isVisible = true, deleteNotification = false) { const response = await (0, test_1.expect)(this.successNotification.filter({ hasText: text })).toBeVisible({ visible: isVisible }); if (deleteNotification) { await this.successNotification.filter({ hasText: text }).getByLabel('close').click({ force: true }); } return response; } async doesErrorNotificationHaveText(text, isVisible = true, deleteNotification = false) { const response = await (0, test_1.expect)(this.errorNotification.filter({ hasText: text })).toBeVisible({ visible: isVisible }); if (deleteNotification) { await this.errorNotification.filter({ hasText: text }).locator('svg').click(); } return response; } async isSectionWithNameVisible(sectionName, isVisible = true) { await (0, test_1.expect)(this.page.getByRole('tab', { name: sectionName })).toBeVisible({ visible: isVisible }); } async clickMediaWithName(name) { await (0, test_1.expect)(this.mediaCardItems.filter({ hasText: name })).toBeVisible(); await this.mediaCardItems.filter({ hasText: name }).click(); } async clickChooseContentStartNodeButton() { await (0, test_1.expect)(this.chooseDocumentInputBtn).toBeVisible(); await this.chooseDocumentInputBtn.click(); } async clickChooseMediaStartNodeButton() { await (0, test_1.expect)(this.chooseMediaInputBtn).toBeVisible(); await this.chooseMediaInputBtn.click(); } async clickActionButton() { await (0, test_1.expect)(this.actionBtn).toBeVisible(); await this.actionBtn.click(); } async clickReferenceNodeLinkWithName(name) { await (0, test_1.expect)(this.page.locator('[name="' + name + '"] a#open-part')).toBeVisible(); await this.page.locator('[name="' + name + '"] a#open-part').click(); } async clickLinkWithName(name, isExact = false) { await (0, test_1.expect)(this.page.getByRole('link', { name: name, exact: isExact })).toBeVisible(); await this.page.getByRole('link', { name: name, exact: isExact }).click(); } async clickMediaPickerModalSubmitButton() { await (0, test_1.expect)(this.mediaPickerModalSubmitBtn).toBeVisible(); await this.mediaPickerModalSubmitBtn.click(); } async selectMediaWithName(mediaName) { await (0, test_1.expect)(this.mediaCardItems.filter({ hasText: mediaName })).toBeVisible(); await this.mediaCardItems.filter({ hasText: mediaName }).click({ position: { x: 0.5, y: 0.5 } }); } async clickCreateModalButton() { await (0, test_1.expect)(this.createModalBtn).toBeVisible(); await this.createModalBtn.click(); } async clickMediaCaptionAltTextModalSubmitButton() { await (0, test_1.expect)(this.mediaCaptionAltTextModalSubmitBtn).toBeVisible(); await this.mediaCaptionAltTextModalSubmitBtn.click(); } // Embed Modal async enterEmbeddedURL(value) { await (0, test_1.expect)(this.embeddedURLTxt).toBeVisible(); await this.embeddedURLTxt.clear(); await this.embeddedURLTxt.fill(value); } async clickEmbeddedRetrieveButton() { await (0, test_1.expect)(this.embeddedRetrieveBtn).toBeVisible(); await this.embeddedRetrieveBtn.click(); } async clickEmbeddedMediaModalConfirmButton(