Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/helpers/ContentUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class ContentUiHelper extends UiBaseLocators {
this.saveAndPublishBtn = page.getByLabel('Save And Publish');
this.publishBtn = page.getByLabel(/^Publish(…)?$/);
this.unpublishBtn = page.getByLabel(/^Unpublish(…)?$/);
this.actionMenuForContentBtn = page.locator('#header [label="Open actions menu"]');
this.actionMenuForContentBtn = page.locator('#header #action-modal');
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…'});
Expand Down Expand Up @@ -300,7 +300,7 @@ export class ContentUiHelper extends UiBaseLocators {
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.getByLabel('Open actions menu');
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');
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/CurrentUserProfileUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class CurrentUserProfileUiHelper extends UiBaseLocators {

constructor(page: Page) {
super(page);
this.changePasswordBtn = page.getByLabel('Change password');
this.changePasswordBtn = page.getByLabel('Change your password');
}

async clickChangePasswordButton() {
Expand Down
10 changes: 5 additions & 5 deletions lib/helpers/DataTypeUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class DataTypeUiHelper extends UiBaseLocators {
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="New Data Type"]');
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');

Expand All @@ -308,7 +308,7 @@ export class DataTypeUiHelper extends UiBaseLocators {
}

async clickActionsMenuForDataType(name: string) {
await this.clickActionsMenuForNameInSectionSidebar(name);
await this.clickActionsMenuForName(name);
}

async clickActionsMenuAtRoot() {
Expand All @@ -320,7 +320,7 @@ export class DataTypeUiHelper extends UiBaseLocators {
}

async createDataTypeFolder(folderName: string) {
await this.clickActionsMenuCreateButton();
await this.clickCreateActionMenuOption();
await this.clickFolderButton();
await this.enterFolderName(folderName);
await this.clickConfirmCreateFolderButton();
Expand Down Expand Up @@ -375,13 +375,13 @@ export class DataTypeUiHelper extends UiBaseLocators {
}

async moveDataTypeToFolder(folderName: string) {
await this.clickMoveToButton();
await this.clickMoveToActionMenuOption();
await this.sidebarModal.getByText(folderName, {exact: true}).click();
await this.chooseModalBtn.click();
}

async duplicateDataTypeToFolder(folderName: string) {
await this.clickDuplicateToButton();
await this.clickDuplicateToActionMenuOption();
await this.sidebarModal.getByText(folderName, {exact: true}).click();
await this.duplicateBtn.click();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/DictionaryUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class DictionaryUiHelper extends UiBaseLocators {
}

async deleteDictionary() {
await this.clickDeleteButton();
await this.clickDeleteActionMenuOption();
await this.confirmToDeleteBtn.click();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/MediaUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class MediaUiHelper extends UiBaseLocators {
this.bulkTrashBtn = page.locator('umb-entity-bulk-action uui-button').filter({hasText: 'Trash'});
this.bulkMoveToBtn = page.locator('umb-entity-bulk-action uui-button').filter({hasText: 'Move to'});
this.mediaHeader = page.getByRole('heading', {name: 'Media'});
this.mediaHeaderActionsMenu = page.locator('#header >> [label="Open actions menu"]');
this.mediaHeaderActionsMenu = page.locator('#header #action-modal');
this.emptyRecycleBinBtn = page.locator('[label="Empty Recycle Bin"]').locator('svg');
this.mediaTreeItem = page.locator('umb-media-tree-item');
this.mediaPopoverLayout = page.locator('umb-popover-layout');
Expand Down
7 changes: 7 additions & 0 deletions lib/helpers/MemberUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class MemberUiHelper extends UiBaseLocators {
private readonly changePasswordBtn: Locator;
private readonly membersMenu: Locator;
private readonly infoTab: Locator;
private readonly membersCreateBtn: Locator;

constructor(page: Page) {
super(page);
Expand All @@ -40,6 +41,7 @@ export class MemberUiHelper extends UiBaseLocators {
this.changePasswordBtn = page.getByLabel('Change password', {exact: true});
this.membersMenu = page.locator('umb-menu').getByLabel('Members', {exact: true});
this.infoTab = page.locator('uui-tab').filter({hasText: 'Info'}).locator('svg');
this.membersCreateBtn = page.locator('umb-create-member-collection-action').getByLabel('Create', {exact: true});
}

async clickMembersTab() {
Expand Down Expand Up @@ -153,4 +155,9 @@ export class MemberUiHelper extends UiBaseLocators {
await expect(this.infoTab).toBeVisible();
await this.infoTab.click();
}

async clickCreateMembersButton() {
await expect(this.membersCreateBtn).toBeVisible();
await this.membersCreateBtn.click();
}
}
2 changes: 1 addition & 1 deletion lib/helpers/PartialViewUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class PartialViewUiHelper extends UiBaseLocators {
}

async createPartialViewFolder(folderName: string) {
await this.clickActionsMenuCreateButton();
await this.clickCreateOptionsActionMenuOption();
await this.newFolderThreeDots.click();
await this.enterFolderName(folderName);
await this.clickConfirmCreateFolderButton();
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/ScriptUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ScriptUiHelper extends UiBaseLocators{
}

async createScriptFolder(folderName: string) {
await this.clickActionsMenuCreateButton();
await this.clickCreateOptionsActionMenuOption();
await this.newFolderThreeDots.click();
await this.enterFolderName(folderName);
await this.clickConfirmCreateFolderButton();
Expand All @@ -41,7 +41,7 @@ export class ScriptUiHelper extends UiBaseLocators{
async goToScript(scriptName: string) {
await this.goToSection(ConstantHelper.sections.settings);
await this.reloadScriptTree();
await this.page.getByLabel(scriptName).click();
await this.page.getByLabel(scriptName, {exact: true}).click();
}

async enterScriptName(scriptContent: string) {
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/StylesheetUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class StylesheetUiHelper extends UiBaseLocators{
}

async createStylesheetFolder(folderName: string) {
await this.clickActionsMenuCreateButton();
await this.clickCreateActionMenuOption();
await this.clickFolderButton();
await this.enterFolderName(folderName);
await this.clickConfirmCreateFolderButton();
Expand Down
126 changes: 104 additions & 22 deletions lib/helpers/UiBaseLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export class UiBaseLocators {
public readonly aliasNameTxt: Locator;
public readonly deleteFolderThreeDotsBtn: Locator;
public readonly createLink: Locator;
public readonly actionMenucreateBtn: Locator;
public readonly insertValueBtn: Locator;
public readonly insertPartialViewBtn: Locator;
public readonly insertDictionaryItemBtn: Locator;
Expand Down Expand Up @@ -144,6 +143,8 @@ export class UiBaseLocators {
public readonly entityItemRef: Locator;
public readonly validationMessage: Locator;
public readonly successStateIcon: Locator;
public readonly entityAction: Locator;
public readonly openEntityAction: Locator;

constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -179,7 +180,6 @@ export class UiBaseLocators {
this.renameModalBtn = page.locator('umb-rename-modal').getByLabel('Rename');
this.createBtn = page.getByRole('button', {name: /^Create(…)?$/});
this.actionsMenuContainer = page.locator('uui-scroll-container');
this.actionMenucreateBtn = this.actionsMenuContainer.getByRole('button', {name: /^Create(…)?$/});
this.successState = page.locator('[state="success"]');
this.chooseModalBtn = this.sidebarModal.locator('[look="primary"]').getByLabel('Choose');
this.addBtn = page.getByRole('button', {name: 'Add', exact: true});
Expand Down Expand Up @@ -288,22 +288,20 @@ export class UiBaseLocators {
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');
}

async clickActionsMenuForNameInSectionSidebar(name: string) {
await this.sectionSidebar.locator('[label="' + name + '"]').hover();
await this.sectionSidebar.locator('[label="' + name + '"] >> [label="Open actions menu"]').first().click();
// Entity Action
this.entityAction = page.locator('umb-entity-action-list umb-entity-action');
this.openEntityAction = page.locator('#action-modal[open]').locator(this.entityAction);
}

async clickActionsMenuForName(name: string) {
await expect(this.page.locator('[label="' + name + '"]')).toBeVisible();
await this.page.locator('[label="' + name + '"]').hover();
await this.page.locator('[label="' + name + '"] >> [label="Open actions menu"]').first().click();
await expect(this.page.locator('uui-menu-item[label="' + name + '"]')).toBeVisible();
await this.page.locator('uui-menu-item[label="' + name + '"]').hover();
await this.page.locator('uui-menu-item[label="' + name + '"] #action-modal').first().click();
}

async isActionsMenuForNameVisible(name: string, isVisible = true) {
await this.page.locator('[label="' + name + '"]').click();
await expect(this.page.locator('[label="' + name + '"] >> [label="Open actions menu"]')).toBeVisible({visible: isVisible});
await this.page.locator('uui-menu-item[label="' + name + '"]').click();
await expect(this.page.locator('uui-menu-item[label="' + name + '"] #action-modal').first()).toBeVisible({visible: isVisible});
}

async clickCaretButtonForName(name: string) {
Expand All @@ -324,7 +322,7 @@ export class UiBaseLocators {
await expect(this.page.getByLabel(treeName, {exact: true})).toBeVisible();
await this.page.waitForTimeout(500);
await this.clickActionsMenuForName(treeName);
await this.clickReloadChildrenButton();
await this.clickReloadChildrenActionMenuOption();

const menuItem = this.page.locator('uui-menu-item[label="' + treeName + '"]');
const isCaretButtonOpen = await menuItem.getAttribute('show-children');
Expand Down Expand Up @@ -550,7 +548,7 @@ export class UiBaseLocators {
}

async createFolder(folderName: string) {
await this.clickActionsMenuCreateButton();
await this.clickCreateActionMenuOption();
await this.clickNewFolderThreeDotsButton();
await this.enterFolderName(folderName);
await this.clickConfirmCreateFolderButton();
Expand Down Expand Up @@ -580,7 +578,7 @@ export class UiBaseLocators {
}

async deleteFolder() {
await this.clickDeleteButton();
await this.clickDeleteActionMenuOption();
await this.clickConfirmToDeleteButton();
}

Expand Down Expand Up @@ -660,11 +658,6 @@ export class UiBaseLocators {
await this.createBtn.click();
}

async clickActionsMenuCreateButton() {
await expect(this.actionMenucreateBtn).toBeVisible();
await this.actionMenucreateBtn.click();
}

async clickAddButton() {
await expect(this.addBtn).toBeVisible();
await this.addBtn.click();
Expand Down Expand Up @@ -801,12 +794,13 @@ export class UiBaseLocators {
}

async rename(newName: string) {
await this.clickRenameButton();
await this.clickRenameActionMenuOption();
await 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: string) {
Expand Down Expand Up @@ -877,7 +871,7 @@ export class UiBaseLocators {
}

async clickDeleteAndConfirmButton() {
await this.clickDeleteButton();
await this.clickDeleteActionMenuOption();
await this.clickConfirmToDeleteButton();
}

Expand Down Expand Up @@ -1206,4 +1200,92 @@ export class UiBaseLocators {
async isSuccessStateIconVisible() {
await expect(this.successStateIcon).toBeVisible();
}

// Entity Action
async clickEntityActionWithName(name: string) {
const regex = new RegExp(`^entity-action:.*${name}$`);
const entityActionLocator = this.openEntityAction.getByTestId(regex).first();
await expect(entityActionLocator).toBeVisible();
await entityActionLocator.click();
}

async clickCreateActionMenuOption() {
await this.clickEntityActionWithName('Create');
}

async clickTrashActionMenuOption() {
await this.clickEntityActionWithName('Trash');
}

async clickMoveToActionMenuOption() {
await this.clickEntityActionWithName('MoveTo');
}

async clickCreateBlueprintActionMenuOption() {
await this.clickEntityActionWithName('CreateBlueprint');
}

async clickDuplicateToActionMenuOption() {
await this.clickEntityActionWithName('DuplicateTo');
}

async clickPublishActionMenuOption() {
await this.clickEntityActionWithName('Publish');
}

async clickUnpublishActionMenuOption() {
await this.clickEntityActionWithName('Unpublish');
}

async clickRollbackActionMenuOption() {
await this.clickEntityActionWithName('Rollback');
}

async clickCultureAndHostnamesActionMenuOption() {
await this.clickEntityActionWithName('CultureAndHostnames');
}

async clickPublicAccessActionMenuOption() {
await this.clickEntityActionWithName('PublicAccess');
}

async clickSortChildrenActionMenuOption() {
await this.clickEntityActionWithName('SortChildrenOf');
}

async clickNotificationsActionMenuOption() {
await this.clickEntityActionWithName('Notifications');
}

async clickReloadChildrenActionMenuOption() {
await this.clickEntityActionWithName('ReloadChildrenOf');
}

async clickDeleteActionMenuOption() {
await this.clickEntityActionWithName('Delete');
}

async clickRestoreActionMenuOption() {
await this.clickEntityActionWithName('Restore');
}

async clickRenameActionMenuOption() {
await this.clickEntityActionWithName('Rename');
}

async clickCreateOptionsActionMenuOption() {
await this.clickEntityActionWithName('CreateOptions');
}

async clickExportActionMenuOption() {
await this.clickEntityActionWithName('Export');
}

async clickImportActionMenuOption() {
await this.clickEntityActionWithName('Import');
}

async clickUpdateActionMenuOption() {
await this.clickEntityActionWithName('Update');
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umbraco/playwright-testhelpers",
"version": "16.0.11",
"version": "16.0.12",
"description": "Test helpers for making playwright tests for Umbraco solutions",
"main": "dist/lib/index.js",
"files": [
Expand Down