@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
997 lines • 46.4 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataTypeUiHelper = void 0;
const test_1 = require("@playwright/test");
const UiBaseLocators_1 = require("./UiBaseLocators");
const ConstantHelper_1 = require("./ConstantHelper");
class DataTypeUiHelper extends UiBaseLocators_1.UiBaseLocators {
moveToBtn;
duplicateToBtn;
newDataTypeBtn;
dataTypeNameTxt;
createDataTypeFolderBtn;
updateDataTypeFolderBtn;
includeLabelsToggle;
addColorBtn;
colorValueTxt;
offsetTimeToggle;
dateFormatTxt;
pageSizeTxt;
ascendingRadioBtn;
descendingRadioBtn;
chooseColumnsDisplayedBtn;
workspaceViewName;
orderByDropDownBox;
showWorkspaceViewFirstToggle;
editInInfiniteEditorToggle;
aliasTxt;
widthTxt;
heightTxt;
minimumTxt;
maximumTxt;
stepSizeTxt;
optionTxt;
addOptionBtn;
maximumAllowedCharsTxt;
numberOfRowsTxt;
minHeightTxt;
maxHeightTxt;
acceptedFileExtensionsTxt;
addAcceptedFileExtensionsBtn;
minimumNumberOfItemsTxt;
maximumNumberOfItemsTxt;
ignoreUserStartNodesToggle;
overlaySizeDropDownBox;
hideAnchorQueryStringInputToggle;
pickMultipleItemsToggle;
enableFocalPointToggle;
amountLowValueTxt;
amountHighValueTxt;
toolbarCheckboxes;
addStylesheetBtn;
dimensionsWidthTxt;
dimensionsHeightTxt;
maxImageSizeTxt;
hideLabelToggle;
defineTagGroupTxt;
showOpenButtonToggle;
enableMultipleChoiceToggle;
addOptionsBtn;
presetValueToggle;
showToggleLabelsToggle;
labelOnTxt;
labelOffTxt;
labelTxt;
chooseAcceptedTypesBtn;
chooseWithPlusBtn;
storageTypeDropDownBox;
allowDecimalsToggle;
chooseLayoutsBtn;
columnsDisplayedItems;
layoutsItems;
inlineRadioBtn;
duplicateBtn;
addWithPlusBtn;
selectAPropertyEditorBtn;
typeToFilterTxt;
chooseStartNodeBtn;
addBlockBtn;
minAmountTxt;
maxAmountTxt;
singleBlockModeBtn;
liveEditingModeBtn;
inlineEditingModeBtn;
propertyEditorWidthTxt;
labelTextTxt;
overlaySizeOption;
chooseContentModelBtn;
chooseSettingsModelBtn;
contentModelNode;
settingsModelNode;
removeExactContentModelNodeBtn;
removeExactSettingsModelNodeBtn;
openBtn;
backgroundColorBtn;
backgroundColorTxt;
chooseCustomStylesheetBtn;
iconColorBtn;
iconColorTxt;
stylesheetRemoveBtn;
hideContentEditorBlockGridBtn;
hideContentEditorBlockListBtn;
customStylesheetLabel;
documentTypeWorkspace;
editorWidthTxt;
createButtonLabelTxt;
gridColumnsTxt;
showResizeOptionsBtn;
columnSpanOptions;
areasTabBtn;
availableRowSpansLowValueTxt;
availableRowSpansHighValueTxt;
areaGridColumnsTxt;
addAreaBtn;
blockAreaConfig;
aliasAliasTxt;
blockGridAreaWorkspaceSubmitBtn;
createLabelTxt;
minAllowedTxt;
maxAllowedTxt;
addSpecifiedAllowanceBtn;
advancedTabBtn;
allowBlockAtRootToggle;
allowInAreasToggle;
chooseThumbnailAlias;
expandChildItemsForMediaBtn;
tiptapToolbarConfiguration;
addGroupToolbarBtn;
addRowToolbarBtn;
tiptapExtensionsConfiguration;
propertyEditor;
selectIconBtn;
newFolderBtn;
dataTypeBtn;
dataTypesMenu;
propertyEditorConfig;
propertyEditorConfigItems;
tiptapStatusbarConfiguration;
blockThumbnailImage;
dataTypeTreeRoot;
createCropBtn;
editCropBtn;
propertyCrops;
addTimeZoneBtn;
timeZoneDropDown;
dataSourceChooseBtn;
constructor(page) {
super(page);
this.moveToBtn = this.actionsMenuContainer.getByLabel('Move to');
this.duplicateToBtn = this.actionsMenuContainer.getByLabel(/^Duplicate to(…)?$/);
this.newDataTypeBtn = page.getByRole('link', { name: 'Data Type', exact: true });
this.dataTypeNameTxt = page.locator('umb-data-type-workspace-editor #nameInput #input');
this.createDataTypeFolderBtn = page.getByLabel('Create folder');
this.newFolderBtn = page.locator('[name="Folder"]');
this.updateDataTypeFolderBtn = page.getByLabel('Update folder');
this.ignoreUserStartNodesToggle = page.getByTestId('property:ignoreUserStartNodes').locator('#toggle');
this.duplicateBtn = this.sidebarModal.getByLabel('Duplicate', { exact: true });
this.selectAPropertyEditorBtn = page.getByLabel('Select a property editor');
this.typeToFilterTxt = page.locator('#filter #input');
// Approved Color
this.includeLabelsToggle = page.locator('#toggle');
this.addColorBtn = page.getByLabel('Add');
this.colorValueTxt = page.getByPlaceholder('Value').getByRole('textbox');
// Date Picker
this.offsetTimeToggle = page.locator('umb-property[label="Offset time"] #toggle');
this.dateFormatTxt = page.getByTestId('property:format').locator('#input');
// List View
this.pageSizeTxt = page.getByTestId('property:pageSize').locator('#input');
this.ascendingRadioBtn = page.locator('uui-radio[label="Ascending [a-z]"] #button');
this.descendingRadioBtn = page.locator('uui-radio[label="Descending [z-a]"] #button');
this.chooseColumnsDisplayedBtn = page.getByTestId('property:includeProperties').getByLabel('Choose');
this.columnsDisplayedItems = page.getByTestId('property:includeProperties').locator('.layout-item');
this.workspaceViewName = page.getByTestId('property:tabName').locator('#input');
this.showWorkspaceViewFirstToggle = page.getByTestId('property:showContentFirst').locator('#toggle');
this.editInInfiniteEditorToggle = page.locator('umb-property[label="Edit in Infinite Editor"] #toggle');
this.orderByDropDownBox = page.getByTestId('property:orderBy').locator('select');
this.chooseLayoutsBtn = page.getByTestId('property:layouts').getByLabel('Choose');
this.layoutsItems = page.getByTestId('property:layouts').locator('.layout-item');
// Image Cropper
this.labelTxt = page.getByLabel('Label', { exact: true });
this.aliasTxt = page.getByLabel('Alias', { exact: true });
this.widthTxt = page.getByLabel('Width', { exact: true });
this.heightTxt = page.getByLabel('Height', { exact: true });
this.propertyCrops = page.getByTestId('property:crops');
this.createCropBtn = this.propertyCrops.getByRole('button', { name: 'Create' });
this.editCropBtn = this.propertyCrops.getByRole('button', { name: 'Edit' });
// Numeric
this.minimumTxt = page.getByTestId('property:min').locator('#input');
this.maximumTxt = page.getByTestId('property:max').locator('#input');
this.stepSizeTxt = page.getByTestId('property:step').locator('#input');
this.allowDecimalsToggle = page.locator('umb-property[label="Allow decimals"] #toggle');
// Radiobox
this.optionTxt = page.getByTestId('property:items').locator('#input');
this.addOptionBtn = page.getByTestId('property:items').getByLabel('Add', { exact: true });
// Textarea - Textstring
this.maximumAllowedCharsTxt = page.getByTestId('property:maxChars').locator('#input');
this.numberOfRowsTxt = page.getByTestId('property:rows').locator('#input');
this.minHeightTxt = page.getByTestId('property:minHeight').locator('#input');
this.maxHeightTxt = page.getByTestId('property:maxHeight').locator('#input');
// Upload
this.acceptedFileExtensionsTxt = page.getByTestId('property:fileExtensions').locator('#input');
this.addAcceptedFileExtensionsBtn = page.getByTestId('property:fileExtensions').getByLabel('Add', { exact: true });
// Multi URL Picker
this.minimumNumberOfItemsTxt = page.getByTestId('property:minNumber').locator('#input');
this.maximumNumberOfItemsTxt = page.getByTestId('property:maxNumber').locator('#input');
this.overlaySizeDropDownBox = page.getByTestId('property:overlaySize').locator('select');
this.hideAnchorQueryStringInputToggle = page.getByTestId('property:hideAnchor').locator('#toggle');
// Media Picker
this.pickMultipleItemsToggle = page.getByTestId('property:multiple').locator('#toggle');
this.enableFocalPointToggle = page.getByTestId('property:enableLocalFocalPoint').locator('#toggle');
this.amountLowValueTxt = page.getByTestId('property:validationLimit').getByLabel('Low value');
this.amountHighValueTxt = page.getByTestId('property:validationLimit').getByLabel('High value');
this.chooseAcceptedTypesBtn = page.getByTestId('property:filter').getByLabel('Choose');
this.chooseWithPlusBtn = page.locator('#btn-add').filter({ hasText: 'Choose' });
this.chooseStartNodeBtn = page.getByTestId('property:startNodeId').locator('#btn-add');
// Rich Editor
this.toolbarCheckboxes = page.getByTestId('property:toolbar').locator('uui-checkbox');
this.addStylesheetBtn = page.getByTestId('property:stylesheets').getByLabel('Add stylesheet');
this.dimensionsWidthTxt = page.getByTestId('property:dimensions').getByLabel('Width');
this.dimensionsHeightTxt = page.getByTestId('property:dimensions').getByLabel('Height');
this.maxImageSizeTxt = page.getByTestId('property:maxImageSize').locator('#input');
this.hideLabelToggle = page.getByTestId('property:hideLabel').locator('#toggle');
this.inlineRadioBtn = page.getByTestId('property:mode').locator('uui-radio[value="Inline"]');
this.addWithPlusBtn = page.getByTestId('property:blocks').locator('#add-button');
// Tags
this.defineTagGroupTxt = page.getByTestId('property:group').locator('#input');
this.storageTypeDropDownBox = page.locator('#native');
// Content Picker
this.showOpenButtonToggle = page.getByTestId('property:showOpenButton').locator('#toggle');
// Dropdown
this.enableMultipleChoiceToggle = page.getByTestId('property:multiple').locator('#toggle');
this.addOptionsBtn = page.getByTestId('property:items').getByLabel('Add', { exact: true });
// True/false
this.presetValueToggle = page.getByTestId('property:default').locator('#toggle');
this.showToggleLabelsToggle = page.getByTestId('property:showLabels').locator('#toggle');
this.labelOnTxt = page.getByTestId('property:labelOn').locator('#input');
this.labelOffTxt = page.getByTestId('property:labelOff').locator('#input');
// Block List Editor and Block Grid Editor
this.addBlockBtn = page.locator('umb-input-block-type #blocks').getByLabel('open');
this.minAmountTxt = page.getByLabel('Low value');
this.maxAmountTxt = page.getByLabel('High value');
this.singleBlockModeBtn = this.page.locator('umb-property-layout').filter({ hasText: 'Single block mode' }).locator('#toggle');
this.liveEditingModeBtn = this.page.locator('umb-property-layout').filter({ hasText: 'Live editing' }).locator('#toggle');
this.inlineEditingModeBtn = this.page.locator('umb-property-layout').filter({ hasText: 'Inline editing' }).locator('#toggle');
this.propertyEditorWidthTxt = this.page.locator('umb-property-layout').filter({ hasText: 'Property editor width' }).locator('#input');
this.labelTextTxt = this.page.locator('[label="Label"]').locator('#input');
this.overlaySizeOption = this.page.locator('[label="Overlay editor size"]').locator('#native');
this.chooseContentModelBtn = this.page.locator('[alias="contentElementTypeKey"]').getByLabel('Choose');
this.chooseSettingsModelBtn = this.page.locator('[alias="settingsElementTypeKey"]').getByLabel('Choose');
this.contentModelNode = this.page.locator('[alias="contentElementTypeKey"]').locator('uui-ref-node-document-type');
this.settingsModelNode = this.page.locator('[alias="settingsElementTypeKey"]').locator('uui-ref-node-document-type');
this.removeExactContentModelNodeBtn = this.page.locator('[alias="contentElementTypeKey"]').getByLabel('Remove', { exact: true });
this.removeExactSettingsModelNodeBtn = this.page.locator('[alias="settingsElementTypeKey"]').getByLabel('Remove', { exact: true });
this.openBtn = this.page.getByLabel('Open', { exact: true });
this.backgroundColorBtn = this.page.locator('umb-property-layout').filter({ hasText: 'Background color' }).getByLabel('Eye dropper');
this.backgroundColorTxt = this.page.locator('[label="Background color"]').locator('[label="Eye dropper"]').locator('#input');
this.iconColorBtn = this.page.locator('umb-property-layout').filter({ hasText: 'Icon color' }).getByLabel('Eye dropper');
this.iconColorTxt = this.page.locator('[label="Icon color"]').locator('[label="Eye dropper"]').locator('#input');
this.stylesheetRemoveBtn = this.page.locator('uui-ref-node').getByLabel('Remove', { exact: true });
this.hideContentEditorBlockListBtn = this.page.locator('[alias="forceHideContentEditorInOverlay"]').locator('#toggle');
this.hideContentEditorBlockGridBtn = this.page.locator('[alias="hideContentEditor"]').locator('#toggle');
this.customStylesheetLabel = this.page.locator('[label="Custom stylesheet"]');
this.chooseThumbnailAlias = this.page.locator('[alias="thumbnail"]').getByLabel('Choose');
this.documentTypeWorkspace = this.page.locator('umb-document-type-workspace-editor');
this.editorWidthTxt = this.page.locator('umb-property-layout').filter({ hasText: 'Editor width' }).locator('#input');
this.createButtonLabelTxt = this.page.locator('umb-property-layout').filter({ hasText: 'Create button label' }).locator('#input');
this.gridColumnsTxt = this.page.locator('umb-property-layout').filter({ hasText: 'Grid columns' }).locator('#input');
this.showResizeOptionsBtn = this.page.getByLabel('Show resize options');
this.columnSpanOptions = this.page.locator('[alias="columnSpanOptions"]');
this.areasTabBtn = this.page.getByRole('tab', { name: 'Areas' });
this.availableRowSpansLowValueTxt = this.page.locator('[label="Available row spans"]').getByLabel('Low value');
this.availableRowSpansHighValueTxt = this.page.locator('[label="Available row spans"]').getByLabel('High value');
this.areaGridColumnsTxt = this.page.locator('[alias="areaGridColumns"]').locator('#input');
this.addAreaBtn = this.page.getByLabel('Add area');
this.blockAreaConfig = this.page.locator('umb-block-area-config-entry');
this.aliasAliasTxt = this.page.locator('[alias="alias"]').locator('#input');
this.blockGridAreaWorkspaceSubmitBtn = this.page.locator('umb-block-grid-area-type-workspace-editor').getByLabel('Submit');
this.createLabelTxt = this.page.locator('[alias="createLabel"]').locator('#input');
this.minAllowedTxt = this.page.locator('#container').getByLabel('Low value');
this.maxAllowedTxt = this.page.locator('#container').getByLabel('High value');
this.addSpecifiedAllowanceBtn = this.page.locator('[alias="specifiedAllowance"]').getByLabel('Add');
this.advancedTabBtn = this.page.getByRole('tab', { name: 'Advanced' });
this.allowBlockAtRootToggle = this.page.getByTestId('property:allowAtRoot').locator('#toggle');
this.allowInAreasToggle = this.page.getByTestId('property:allowInAreas').locator('#toggle');
this.expandChildItemsForMediaBtn = this.page.getByLabel('Expand child items for media', { exact: true });
this.chooseCustomStylesheetBtn = this.page.locator('[label="Custom stylesheet"]').getByLabel('Choose');
// Tiptap
this.tiptapToolbarConfiguration = this.page.locator('umb-property-editor-ui-tiptap-toolbar-configuration');
this.addGroupToolbarBtn = this.tiptapToolbarConfiguration.locator('uui-button').filter({ hasText: 'Add group' });
this.addRowToolbarBtn = this.tiptapToolbarConfiguration.locator('uui-button').filter({ hasText: 'Add row' });
this.tiptapExtensionsConfiguration = this.page.locator('umb-property-editor-ui-tiptap-extensions-configuration');
this.propertyEditor = this.page.locator('umb-ref-property-editor-ui');
this.selectIconBtn = page.getByLabel('Select icon');
this.dataTypeBtn = this.createOptionActionListModal.locator('[name="Data Type"]');
this.dataTypesMenu = page.locator('#menu-item').getByRole('link', { name: 'Data Types' });
this.tiptapStatusbarConfiguration = this.page.locator('umb-property-editor-ui-tiptap-statusbar-configuration');
// Settings
this.propertyEditorConfig = page.locator('umb-property-editor-config');
this.propertyEditorConfigItems = this.propertyEditorConfig.locator('umb-property');
this.blockThumbnailImage = page.locator('uui-card-block-type').locator('img');
this.dataTypeTreeRoot = page.locator('[alias="Umb.TreeItem.DataType"]').locator('uui-menu-item[label="Data Types"]');
// Date Time with Time Zone Picker
this.addTimeZoneBtn = page.locator('#add-time-zone [name="icon-add"] svg');
this.timeZoneDropDown = page.locator('umb-input-time-zone-picker uui-combobox');
// Entity Picker Source
this.dataSourceChooseBtn = page.locator('[label="Data Source"]').locator(this.chooseBtn);
}
async clickActionsMenuForDataType(name) {
await this.clickActionsMenuForName(name);
}
async clickActionsMenuAtRoot() {
await this.clickActionsMenuForDataType('Data Types');
}
async clickRootFolderCaretButton() {
await this.openCaretButtonForName('Data Types');
}
async createDataTypeFolder(folderName) {
await this.clickCreateActionMenuOption();
await this.clickFolderButton();
await this.enterFolderName(folderName);
await this.clickConfirmCreateFolderButton();
}
async createDataTypeFolderAndWaitForDataTypeToBeCreated(folderName) {
await this.clickCreateActionMenuOption();
await this.clickFolderButton();
await this.enterFolderName(folderName);
return await this.clickConfirmCreateFolderButtonAndWaitForDataTypeToBeCreated();
}
async goToDataType(dataTypeName) {
await this.clickRootFolderCaretButton();
await this.click(this.sectionSidebar.getByLabel(dataTypeName, { exact: true }));
}
async clickMoveToButton() {
await this.click(this.moveToBtn);
}
async clickDuplicateToButton() {
await this.click(this.duplicateToBtn);
}
async isDataTypeTreeItemVisible(name, isVisible = true) {
const hasShowChildren = await this.dataTypeTreeRoot.getAttribute('show-children') !== null;
if (!hasShowChildren) {
await this.click(this.dataTypeTreeRoot.locator(this.caretBtn).first());
}
await this.isTreeItemVisible(name, isVisible);
}
async clickNewDataTypeButton() {
await this.click(this.newDataTypeBtn);
}
async clickNewDataTypeFolderButton() {
await this.click(this.newFolderBtn);
}
async enterDataTypeName(name) {
await this.click(this.dataTypeNameTxt);
await this.enterText(this.dataTypeNameTxt, name);
}
async clickCreateFolderButton() {
await this.click(this.createDataTypeFolderBtn);
await this.page.waitForTimeout(ConstantHelper_1.ConstantHelper.wait.short);
}
async clickUpdateFolderButton() {
await this.click(this.updateDataTypeFolderBtn);
}
async deleteDataType(name) {
await this.clickActionsMenuForDataType(name);
await this.clickDeleteAndConfirmButton();
}
async deleteDataTypeAndWaitForDataTypeToBeDeleted(name) {
await this.clickActionsMenuForDataType(name);
return await this.clickDeleteAndConfirmButtonAndWaitForDataTypeToBeDeleted();
}
async deleteDataTypeFolder(folderName) {
await this.clickActionsMenuForDataType(folderName);
await this.deleteFolder();
}
async deleteDataTypeFolderAndWaitForDataTypeToBeDeleted(folderName) {
await this.clickActionsMenuForDataType(folderName);
await this.clickDeleteActionMenuOption();
return await this.clickConfirmToDeleteButtonAndWaitForDataTypeToBeDeleted();
}
async moveDataTypeToFolder(folderName) {
await this.clickMoveToActionMenuOption();
await this.click(this.sidebarModal.getByText(folderName, { exact: true }));
await this.click(this.chooseModalBtn);
}
async duplicateDataTypeToFolder(folderName) {
await this.clickDuplicateToActionMenuOption();
await this.click(this.sidebarModal.getByText(folderName, { exact: true }));
await this.click(this.duplicateBtn);
}
async addMediaStartNode(mediaName) {
await this.click(this.mediaCardItems.filter({ hasText: mediaName }));
await this.clickChooseModalButton();
}
async addContentStartNode(contentName) {
await this.clickTextButtonWithName(contentName);
await this.click(this.chooseModalBtn);
}
async clickSelectAPropertyEditorButton() {
await this.click(this.selectAPropertyEditorBtn);
}
async selectAPropertyEditor(propertyName, filterKeyword) {
await this.typeToFilterTxt.fill(filterKeyword ? filterKeyword : propertyName);
await this.clickTextButtonWithName(propertyName);
}
// Approved Color
async clickIncludeLabelsToggle() {
await this.click(this.includeLabelsToggle);
}
async removeColorByValue(value) {
await this.click(this.page.locator(`[value="${value}"] uui-button svg`));
await this.click(this.confirmToDeleteBtn);
}
async addColor(value) {
await this.click(this.addColorBtn);
await this.enterText(this.colorValueTxt, value);
}
// Label
async changeValueType(valueType) {
await this.selectByText(this.page.getByLabel('Select a value type'), valueType);
}
// Date Picker
async clickOffsetTimeToggle() {
await this.click(this.offsetTimeToggle);
}
async enterDateFormatValue(value) {
await this.enterText(this.dateFormatTxt, value);
}
// List View
async enterPageSizeValue(value) {
await this.enterText(this.pageSizeTxt, value);
}
async chooseOrderDirection(isAscending) {
if (isAscending) {
await this.click(this.ascendingRadioBtn);
}
else {
await this.click(this.descendingRadioBtn);
}
}
async addColumnDisplayed(contentType, contentName, propertyAlias) {
await this.click(this.chooseColumnsDisplayedBtn);
await this.clickTextButtonWithName(contentType);
await this.clickTextButtonWithName(contentName);
await this.clickChooseContainerButton();
await this.clickTextButtonWithName(propertyAlias);
}
async removeColumnDisplayed(propertyAlias) {
await this.click(this.columnsDisplayedItems.filter({ has: this.page.getByText(propertyAlias, { exact: true }) }).getByText('Remove'));
}
async addLayouts(layoutName) {
await this.click(this.chooseLayoutsBtn);
await this.click(this.page.locator(`[name="${layoutName}"]`));
}
async removeLayouts(layoutAlias) {
await this.click(this.layoutsItems.filter({ has: this.page.getByText(layoutAlias, { exact: true }) }).getByText('Remove'));
}
async chooseOrderByValue(value) {
await this.selectByText(this.orderByDropDownBox, value);
}
async enterWorkspaceViewName(name) {
await this.enterText(this.workspaceViewName, name);
}
async clickShowContentWorkspaceViewFirstToggle() {
await this.click(this.showWorkspaceViewFirstToggle);
}
async clickEditInInfiniteEditorToggle() {
await this.click(this.editInInfiniteEditorToggle);
}
async clickBulkActionPermissionsToggleByValue(value) {
await this.click(this.page.locator(`uui-toggle[label='${value}'] #toggle`));
}
async clickSelectIconButton() {
// Force click is needed
await this.click(this.selectIconBtn, { force: true });
}
async chooseWorkspaceViewIconByValue(value) {
await this.click(this.page.locator(`[label="${value}"] svg`));
await this.click(this.submitBtn);
}
// Image Cropper
async enterCropValues(label, alias, width, height) {
await this.enterText(this.labelTxt, label);
await this.enterText(this.aliasTxt, alias);
await this.enterText(this.widthTxt, width);
await this.enterText(this.heightTxt, height);
}
async clickCreateCropButton() {
await this.click(this.createCropBtn);
}
async clickEditCropButton() {
await this.click(this.editCropBtn);
}
async editCropByAlias(alias) {
await this.click(this.page.locator('.crop').filter({ has: this.page.getByText(alias) }).getByText('Edit'));
}
async removeCropByAlias(alias) {
await this.click(this.page.locator('.crop').filter({ has: this.page.getByText(alias) }).getByText('Remove'));
}
// Numeric
async enterMinimumValue(value) {
await this.enterText(this.minimumTxt, value);
}
async enterMaximumValue(value) {
await this.enterText(this.maximumTxt, value);
}
async enterStepSizeValue(value) {
await this.enterText(this.stepSizeTxt, value);
}
async clickAllowDecimalsToggle() {
await this.click(this.allowDecimalsToggle);
}
// Radiobox
async removeOptionByName(name) {
await this.click(this.page.locator(`uui-button[label='Remove ${name}'] svg`));
await this.click(this.confirmToDeleteBtn);
}
async enterOptionName(name) {
await this.enterText(this.optionTxt.last(), name);
}
async clickAddOptionButton() {
await this.click(this.addOptionBtn);
}
// Textarea - Textstring
async enterMaximumAllowedCharactersValue(value) {
await this.enterText(this.maximumAllowedCharsTxt, value);
}
async enterNumberOfRowsValue(value) {
await this.enterText(this.numberOfRowsTxt, value);
}
async enterMaxHeightValue(value) {
await this.enterText(this.maxHeightTxt, value);
}
async enterMinHeightValue(value) {
await this.enterText(this.minHeightTxt, value);
}
// Upload
async enterAcceptedFileExtensions(value) {
await this.enterText(this.acceptedFileExtensionsTxt.last(), value);
}
async removeAcceptedFileExtensionsByValue(value) {
await this.click(this.page.locator(`uui-button[label='Remove ${value}'] svg`));
await this.click(this.confirmToDeleteBtn);
}
async clickAddAcceptedFileExtensionsButton() {
await this.click(this.addAcceptedFileExtensionsBtn);
}
// Multi URL Picker
async enterMinimumNumberOfItemsValue(value) {
await this.enterText(this.minimumNumberOfItemsTxt, value);
}
async enterMaximumNumberOfItemsValue(value) {
await this.enterText(this.maximumNumberOfItemsTxt, value);
}
async clickIgnoreUserStartNodesToggle() {
await this.click(this.ignoreUserStartNodesToggle);
}
async chooseOverlaySizeByValue(value) {
await this.selectByValue(this.overlaySizeDropDownBox, value);
}
async clickHideAnchorQueryStringInputToggle() {
await this.click(this.hideAnchorQueryStringInputToggle);
}
// Media Picker
async clickPickMultipleItemsToggle() {
await this.click(this.pickMultipleItemsToggle);
}
async clickEnableFocalPointToggle() {
await this.click(this.enableFocalPointToggle);
}
async enterAmountValue(lowValue, highValue) {
await this.enterText(this.amountLowValueTxt, lowValue);
await this.enterText(this.amountHighValueTxt, highValue);
}
async addAcceptedType(mediaTypeName) {
await this.click(this.chooseAcceptedTypesBtn);
await this.clickTextButtonWithName(mediaTypeName);
await this.click(this.chooseModalBtn);
}
async removeAcceptedType(mediaTypeName) {
await this.click(this.page.locator(`uui-ref-node-document-type[name="${mediaTypeName}"]`).getByLabel('Remove'));
await this.click(this.confirmToRemoveBtn);
}
async removeMediaStartNode(mediaName) {
await this.click(this.page.locator(`uui-card-media[name="${mediaName}"]`).locator('[label="Remove"]'));
await this.click(this.confirmToRemoveBtn);
}
async clickChooseStartNodeButton() {
await this.click(this.chooseStartNodeBtn);
}
// Richtext Editor
async clickToolbarOptionByValue(values) {
for (var index in values) {
await this.click(this.toolbarCheckboxes.filter({ has: this.page.getByLabel(values[index]) }).locator('#ticker svg'));
}
}
async addStylesheet(stylesheetName) {
await this.click(this.addStylesheetBtn);
await this.click(this.page.getByLabel(stylesheetName));
await this.click(this.chooseModalBtn);
}
async enterDimensionsValue(width, height) {
await this.enterText(this.dimensionsWidthTxt, width);
await this.enterText(this.dimensionsHeightTxt, height);
}
async enterMaximumSizeForImages(value) {
await this.enterText(this.maxImageSizeTxt, value);
}
async clickHideLabelToggle() {
await this.click(this.hideLabelToggle);
}
async clickInlineRadioButton() {
await this.click(this.inlineRadioBtn);
}
async clickChooseWithPlusButton() {
await this.click(this.chooseWithPlusBtn);
}
async addImageUploadFolder(mediaFolderName) {
await this.clickChooseWithPlusButton();
await this.selectMediaWithName(mediaFolderName);
await this.clickChooseModalButton();
}
async clickAddWithPlusButton() {
await this.click(this.addWithPlusBtn);
}
async addAvailableBlocks(blockName) {
await this.clickAddWithPlusButton();
await this.clickTextButtonWithName(blockName);
await this.clickChooseModalButton();
await this.clickSubmitButton();
}
// Tags
async enterDefineTagGroupValue(value) {
await this.enterText(this.defineTagGroupTxt, value);
}
async selectStorageTypeOption(option) {
await this.selectByText(this.storageTypeDropDownBox, option);
}
// Content Picker
async clickShowOpenButtonToggle() {
await this.click(this.showOpenButtonToggle);
}
async removeContentStartNode(contentName) {
const startNodeLocator = this.entityItem.filter({ has: this.page.locator(`[name="${contentName}"]`) });
await this.hoverAndClick(startNodeLocator, startNodeLocator.getByLabel('Remove'));
await this.clickConfirmRemoveButton();
}
// Dropdown
async clickEnableMultipleChoiceToggle() {
await this.click(this.enableMultipleChoiceToggle);
}
async clickAddOptionsButton() {
await this.click(this.addOptionsBtn);
}
// True/false
async clickPresetValueToggle() {
await this.click(this.presetValueToggle);
}
async clickShowToggleLabelsToggle() {
await this.click(this.showToggleLabelsToggle);
}
async enterLabelOnValue(value) {
await this.enterText(this.labelOnTxt, value);
}
async enterLabelOffValue(value) {
await this.enterText(this.labelOffTxt, value);
}
// Block List Editor
async clickAddBlockButton(index = 0) {
await this.click(this.addBlockBtn.nth(index));
}
async clickRemoveBlockWithName(name) {
const blockWithNameLocator = this.page.locator('umb-block-type-card', { hasText: name });
// The force click is necessary.
await this.click(blockWithNameLocator.getByLabel('Remove block'), { force: true });
}
async enterMinAmount(value) {
await this.enterText(this.minAmountTxt, value);
}
async enterMaxAmount(value) {
await this.enterText(this.maxAmountTxt, value);
}
async doesAmountContainErrorMessageWithText(errorMessage) {
await this.isVisible(this.page.getByText(errorMessage));
}
async clickSingleBlockMode() {
await this.click(this.singleBlockModeBtn);
}
async clickLiveEditingMode() {
await this.click(this.liveEditingModeBtn);
}
async clickInlineEditingMode() {
await this.click(this.inlineEditingModeBtn);
}
async enterPropertyEditorWidth(width) {
await this.enterText(this.propertyEditorWidthTxt, width);
}
async goToBlockWithName(name) {
await this.click(this.page.getByRole('link', { name: name }));
}
async enterBlockLabelText(label) {
await this.removeBlockLabelText();
await this.labelTextTxt.fill(label);
}
async removeBlockLabelText() {
await this.waitForVisible(this.labelTextTxt);
await this.labelTextTxt.clear();
}
async clickAllowInRootForBlock() {
await this.click(this.allowBlockAtRootToggle);
}
async clickAllowInAreasForBlock() {
await this.click(this.allowInAreasToggle);
}
async updateBlockOverlaySize(size) {
await this.selectByValue(this.overlaySizeOption, size);
}
async addBlockContentModel(elementName) {
await this.click(this.chooseContentModelBtn);
await this.clickButtonWithName(elementName);
await this.clickChooseButton();
}
async addBlockSettingsModel(elementName) {
await this.click(this.chooseSettingsModelBtn, { timeout: ConstantHelper_1.ConstantHelper.timeout.long });
await this.clickModalMenuItemWithName(elementName);
await this.clickChooseModalButton();
}
async removeBlockContentModel() {
await this.hoverAndClick(this.contentModelNode, this.removeExactContentModelNodeBtn);
}
async removeBlockSettingsModel() {
await this.hoverAndClick(this.settingsModelNode, this.removeExactSettingsModelNodeBtn);
}
async openBlockContentModel() {
await this.hoverAndClick(this.contentModelNode, this.openBtn);
}
async openBlockSettingsModel() {
await this.hoverAndClick(this.settingsModelNode, this.openBtn);
}
async isElementWorkspaceOpenInBlock(elementTypeName) {
await this.isVisible(this.documentTypeWorkspace.filter({ hasText: elementTypeName }));
}
async selectBlockBackgroundColor(color) {
await this.click(this.backgroundColorBtn);
await this.enterText(this.backgroundColorTxt, color);
}
async selectBlockIconColor(color) {
await this.click(this.iconColorBtn);
await this.enterText(this.iconColorTxt, color);
}
async clickExpandChildItemsForMediaButton() {
await this.click(this.expandChildItemsForMediaBtn);
}
async clickRemoveCustomStylesheetWithName(name) {
await this.click(this.customStylesheetLabel.locator(`[name="${name}"]`));
await this.click(this.stylesheetRemoveBtn);
await this.clickConfirmRemoveButton();
}
async clickBlockGridHideContentEditorButton() {
await this.click(this.hideContentEditorBlockGridBtn);
}
async chooseBlockCustomStylesheetWithName(name) {
await this.click(this.chooseCustomStylesheetBtn);
await this.openCaretButtonForName('wwwroot');
await this.openCaretButtonForName('css');
await this.clickLabelWithName(name, true);
await this.clickChooseModalButton();
}
async chooseBlockThumbnailWithPath(mediaPath) {
const mediaItems = mediaPath.split('/media/')[1].split('/');
await this.click(this.chooseThumbnailAlias);
await this.openCaretButtonForName('wwwroot', true);
await this.clickExpandChildItemsForMediaButton();
for (let i = 0; i < mediaItems.length; i++) {
if (i === mediaItems.length - 1) {
await this.clickLabelWithName(mediaItems[i], true);
}
else {
await this.click(this.sidebarModal.locator(`uui-menu-item[label="${mediaItems[i]}"] #caret-button`));
}
}
await this.clickChooseModalButton();
}
async clickBlockListHideContentEditorButton() {
await this.click(this.hideContentEditorBlockListBtn);
}
async enterEditorWidth(value) {
await this.enterText(this.editorWidthTxt, value);
}
async enterCreateButtonLabel(value) {
await this.enterText(this.createButtonLabelTxt, value);
}
async enterGridColumns(value) {
await this.waitForVisible(this.gridColumnsTxt);
await this.gridColumnsTxt.clear();
if (value === undefined) {
return;
}
await this.gridColumnsTxt.fill(value.toString());
}
async clickShowResizeOptions() {
await this.click(this.showResizeOptionsBtn);
}
async clickAvailableColumnSpans(columnSpans) {
for (let index in columnSpans) {
await this.click(this.columnSpanOptions.getByLabel(columnSpans[index].toString(), { exact: true }));
}
}
async goToBlockAreasTab() {
await this.click(this.areasTabBtn);
}
async enterMinRowSpan(value) {
await this.waitForVisible(this.availableRowSpansLowValueTxt);
await this.availableRowSpansLowValueTxt.clear();
if (value === undefined) {
return;
}
await this.availableRowSpansLowValueTxt.fill(value.toString());
}
async enterMaxRowSpan(value) {
await this.waitForVisible(this.availableRowSpansHighValueTxt);
await this.availableRowSpansHighValueTxt.clear();
if (value === undefined) {
return;
}
await this.availableRowSpansHighValueTxt.fill(value.toString());
}
async enterGridColumnsForArea(value) {
await this.waitForVisible(this.areaGridColumnsTxt);
await this.areaGridColumnsTxt.clear();
if (value === undefined) {
return;
}
await this.areaGridColumnsTxt.fill(value.toString());
}
async addAreaButton() {
await this.click(this.addAreaBtn);
}
async goToAreaByAlias(alias) {
const editAreaWithAliasLocator = this.blockAreaConfig.filter({ hasText: alias }).getByLabel('edit');
// Force click is needed
await this.click(editAreaWithAliasLocator, { force: true });
}
async clickRemoveAreaByAlias(alias) {
const removeAreaWithAliasLocator = this.blockAreaConfig.filter({ hasText: alias }).getByLabel('delete');
// Force click is needed
await this.click(removeAreaWithAliasLocator, { force: true });
await this.clickConfirmToDeleteButton();
}
async enterAreaAlias(alias) {
await this.enterText(this.aliasAliasTxt, alias);
}
async clickAreaSubmitButton() {
await this.click(this.blockGridAreaWorkspaceSubmitBtn);
await this.page.waitForTimeout(ConstantHelper_1.ConstantHelper.wait.short);
}
async enterCreateButtonLabelInArea(value) {
await this.waitForVisible(this.createLabelTxt.nth(1));
await this.createLabelTxt.nth(1).clear();
if (value === undefined) {
return;
}
await this.createLabelTxt.nth(1).fill(value);
}
async enterMinAllowedInArea(value) {
await this.waitForVisible(this.minAllowedTxt);
await this.minAllowedTxt.clear();
if (value === undefined) {
return;
}
await this.minAllowedTxt.fill(value.toString());
}
async enterMaxAllowedInArea(value) {
await this.waitForVisible(this.maxAllowedTxt);
await this.maxAllowedTxt.clear();
if (value === undefined) {
return;
}
await this.maxAllowedTxt.fill(value.toString());
}
async clickAddSpecifiedAllowanceButton() {
await this.click(this.addSpecifiedAllowanceBtn);
}
async goToBlockAdvancedTab() {
await this.click(this.advancedTabBtn);
}
async getLinkWithName(name) {
await this.isVisible(this.page.getByRole('link', { name: name }));
return this.page.getByRole('link', { name: name });
}
async getAddButtonInGroupWithName(name) {
await this.isVisible(this.page.locator('.group').filter({ hasText: name }).locator('#add-button'));
return this.page.locator('.group').filter({ hasText: name }).locator('#add-button');
}
async clickRemoveStylesheetButton(stylesheetName) {
const removeButton = this.entityItem.filter({ hasText: stylesheetName }).getByLabel('Remove');
await this.click(removeButton);
}
// TipTap
async deleteToolbarGroup(groupIndex, rowIndex = 0) {
const groupButton = this.tiptapToolbarConfiguration.locator('.row').nth(rowIndex).locator('.group').nth(groupIndex);
await this.hover(groupButton);
const actionsInGroup = groupButton.locator('.items').locator('uui-button');
const actionsCount = await actionsInGroup.count();
for (let i = 0; i < actionsCount; i++) {
await this.click(actionsInGroup.first());
}
await this.click(groupButton.locator('[label="Remove group"]'));
}
async deleteToolbarRow(rowIndex) {
const rowButton = this.tiptapToolbarConfiguration.locator('.row').nth(rowIndex);
await this.hoverAndClick(rowButton, rowButton.locator('[label="Remove row"]'));
}
async clickAddRowToolbarButton() {
await this.click(this.addRowToolbarBtn);
}
async clickAddGroupToolbarButton() {
await this.click(this.addGroupToolbarBtn);
}
async clickExtensionItemWithName(name) {
await this.click(this.tiptapExtensionsConfiguration.locator(`uui-checkbox[label="${name}"]`));
}
async doesPropertyEditorHaveUiAlias(uiAlias) {
await this.hasAttribute(this.propertyEditor, 'alias', uiAlias);
}
async doesPropertyEditorHaveName(name) {
await this.hasAttribute(this.propertyEditor, 'name', name);
}
async doesPropertyEditorHaveAlias(alias) {
await this.hasAttribute(this.propertyEditor, 'property-editor-schema-alias', alias);
}
async clickDataTypeButton() {
await this.click(this.dataTypeBtn);
}
async clickDataTypesMenu() {
await this.click(this.dataTypesMenu);
}
async doesSettingHaveValue(settings) {
for (let index = 0; index < Object.keys(settings).length; index++) {
const [label, description] = settings[index];
await (0, test_1.expect)(this.propertyEditorConfigItems.nth(index).locator('#headerColumn #label')).toHaveText(label);
if (description !== '')
await (0, test_1.expect)(this.propertyEditorConfigItems.nth(index).locator('#description')).toHaveText(description);
}
}
async doesSettingItemsHaveCount(settings) {
await this.hasCount(this.propertyEditorConfigItems, Object.keys(settings).length);
}
async doesSettingsContainText(text) {
await this.containsText(this.propertyEditorConfig, text);
}
async clickStatusbarItemInToolboxWithName(name) {
const statusbarItemLocator = this.tiptapStatusbarConfiguration.locator('#toolbox uui-button').filter({ hasText: name });
await this.click(statusbarItemLocator);
}
async clickStatusbarItemWithName(name) {
const statusbarItemLocator = this.tiptapStatusbarConfiguration.locator('#statusbar uui-button').filter({ hasText: name });
await this.click(statusbarItemLocator);
}
async isExtensionItemChecked(itemName, isChecked = true) {
await (0, test_1.expect)(this.tiptapExtensionsConfiguration.locator(`uui-checkbox[label="${itemName}"] input`)).toBeChecked({ checked: isChecked });
}
async doesBlockHaveThumbnailImage(thumbnailImageUrl) {
await this.hasAttribute(this.blockThumbnailImage, 'src', thumbnailImageUrl);
}
async addTimeZones(timeZones) {
for (let i = 0; i < timeZones.length; i++) {
await this.click(this.timeZoneDropDown);
await this.click(this.timeZoneDropDown.getByText(timeZones[i]));
await this.click(this.addTimeZoneBtn);
}
}
async clickChooseDataSourceButton() {
await this.click(this.dataSourceChooseBtn);
}
async clickChooseThumbnailButton() {
await this.click(this.chooseThumbnailAlias);
}
async clickSaveButtonAndWaitForDataTypeToBeCreated() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.dataType, this.clickSaveButton(), ConstantHelper_1.ConstantHelper.statusCodes.created);
}
async clickSaveButtonAndWaitForDataTypeToBeUpdated() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.dataType, this.clickSaveButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
async clickConfirmToDeleteButtonAndWaitForDataTypeToBeDeleted() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.dataType, this.clickConfirmToDeleteButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
async clickDeleteAndConfirmButtonAndWaitForDataTypeToBeDeleted() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.dataType, this.clickDeleteAndConfirmButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
async clickConfirmCreateFolderButtonAndWaitForDataTypeToBeCreated() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.dataTypeFolder, this.clickConfirmCreateFolderButton(), ConstantHelper_1.ConstantHelper.statusCodes.created);
}
async clickConfirmRenameButtonAndWaitForDataTypeToBeRenamed() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.dataTypeFolder, this.clickConfirmRenameButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
}
exports.DataTypeUiHelper = DataTypeUiHelper;
//# sourceMappingURL=DataTypeUiHelper.js.map