@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
71 lines • 2.95 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.MediaTypeUiHelper = void 0;
const UiBaseLocators_1 = require("./UiBaseLocators");
const test_1 = require("@playwright/test");
class MediaTypeUiHelper extends UiBaseLocators_1.UiBaseLocators {
newMediaTypeThreeDotsBtn;
mediaEditPropertyWorkspace;
mediaTypeBtn;
mediaTypesMenu;
mediaTypeTreeRoot;
constructor(page) {
super(page);
this.newMediaTypeThreeDotsBtn = page.getByLabel('New Media Type…');
this.mediaEditPropertyWorkspace = page.locator('umb-media-type-workspace-view-edit-property');
this.mediaTypeBtn = this.createOptionActionListModal.locator('[name="Media Type"]');
this.mediaTypesMenu = page.locator('#menu-item').getByRole('link', { name: 'Media Types' });
this.mediaTypeTreeRoot = page.locator('[alias="Umb.TreeItem.MediaType"]').locator('uui-menu-item[label="Media Types"]');
}
async clickActionsMenuForMediaType(name) {
await this.clickActionsMenuForName(name);
}
async clickActionsMenuAtRoot() {
await this.clickActionsMenuForMediaType("Media Types");
}
async clickRootFolderCaretButton() {
await this.openCaretButtonForName("Media Types");
}
async clickNewMediaTypeButton() {
await this.newMediaTypeThreeDotsBtn.click();
}
async isMediaTypeTreeItemVisible(name, isVisible = true) {
{
const hasShowChildren = await this.mediaTypeTreeRoot.getAttribute('show-children') !== null;
if (!hasShowChildren) {
await this.mediaTypeTreeRoot.locator(this.caretBtn).first().click();
}
await this.isTreeItemVisible(name, isVisible);
}
}
async waitForMediaTypeToBeCreated() {
await this.waitForNetworkToBeIdle();
}
async waitForMediaTypeToBeDeleted() {
await this.waitForNetworkToBeIdle();
}
async waitForMediaTypeToBeRenamed() {
await this.waitForNetworkToBeIdle();
}
async goToMediaType(mediaTypeName) {
await this.clickRootFolderCaretButton();
await this.clickLabelWithName(mediaTypeName);
}
async enterMediaTypeName(name) {
await this.enterAName.waitFor({ state: 'visible' });
await this.enterAName.fill(name);
}
async enterDescriptionForPropertyEditorWithName(propertyEditorName, description) {
await this.mediaEditPropertyWorkspace.filter({ hasText: propertyEditorName }).getByLabel('description').fill(description);
}
async clickMediaTypeButton() {
await (0, test_1.expect)(this.mediaTypeBtn).toBeVisible();
await this.mediaTypeBtn.click();
}
async clickMediaTypesMenu() {
await (0, test_1.expect)(this.mediaTypesMenu).toBeVisible();
await this.mediaTypesMenu.click();
}
}
exports.MediaTypeUiHelper = MediaTypeUiHelper;
//# sourceMappingURL=MediaTypeUiHelper.js.map
;