@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
66 lines • 3.55 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemberGroupUiHelper = void 0;
const UiBaseLocators_1 = require("./UiBaseLocators");
const ConstantHelper_1 = require("./ConstantHelper");
class MemberGroupUiHelper extends UiBaseLocators_1.UiBaseLocators {
memberGroupsTab;
memberGroupNameTxt;
memberGroupView;
activeMemberGroupsTab;
createMemberGroupBtn;
memberGroupsMenu;
membersSidebar;
memberGroupsSidebarBtn;
constructor(page) {
super(page);
this.memberGroupsTab = page.locator('uui-tab[label="Member Groups"]');
this.memberGroupNameTxt = page.locator('input#input');
this.memberGroupView = page.locator('umb-member-group-table-collection-view');
this.activeMemberGroupsTab = page.locator('uui-tab[label="Member Groups"][active]');
this.createMemberGroupBtn = page.getByTestId('collection-action:Umb.CollectionAction.MemberGroup.Create').getByLabel('Create', { exact: true });
this.memberGroupsMenu = page.locator('umb-menu').getByLabel('Member Groups', { exact: true });
this.membersSidebar = page.getByTestId('section-sidebar:Umb.SectionSidebarApp.Menu.MemberManagement');
this.memberGroupsSidebarBtn = this.membersSidebar.locator('uui-menu-item').filter({ hasText: 'Member Groups' });
}
async clickMemberGroupsTab() {
await this.waitForVisible(this.memberGroupsTab);
await this.page.waitForTimeout(ConstantHelper_1.ConstantHelper.wait.short);
await this.click(this.memberGroupsTab);
await this.waitForVisible(this.activeMemberGroupsTab);
}
async clickMemberGroupCreateButton() {
await this.click(this.createMemberGroupBtn);
}
async clickMemberGroupsSidebarButton() {
await this.click(this.memberGroupsSidebarBtn);
}
async enterMemberGroupName(name) {
await this.enterText(this.memberGroupNameTxt, name);
}
async clickMemberGroupLinkByName(memberGroupName) {
await this.click(this.page.getByRole('link', { name: memberGroupName }));
}
async isMemberGroupNameVisible(memberGroupName, isVisible = true) {
const memberGroupNameLocator = this.memberGroupView.filter({ hasText: memberGroupName });
return await this.isVisible(memberGroupNameLocator, isVisible, ConstantHelper_1.ConstantHelper.wait.short);
}
async clickMemberGroupsMenu() {
await this.click(this.memberGroupsMenu);
}
async goToMemberGroups() {
await this.goToSection(ConstantHelper_1.ConstantHelper.sections.members);
await this.clickMemberGroupsMenu();
}
async clickSaveButtonAndWaitForMemberGroupToBeCreated() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.memberGroup, this.clickSaveButton(), ConstantHelper_1.ConstantHelper.statusCodes.created);
}
async clickSaveButtonAndWaitForMemberGroupToBeUpdated() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.memberGroup, this.clickSaveButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
async clickConfirmToDeleteButtonAndWaitForMemberGroupToBeDeleted() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.memberGroup, this.clickConfirmToDeleteButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
}
exports.MemberGroupUiHelper = MemberGroupUiHelper;
//# sourceMappingURL=MemberGroupUiHelper.js.map