UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

68 lines 2.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MediaTypeUiHelper = void 0; const UiBaseLocators_1 = require("./UiBaseLocators"); 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.waitForVisible(this.enterAName); await this.enterText(this.enterAName, name); } async enterDescriptionForPropertyEditorWithName(propertyEditorName, description) { await this.enterText(this.mediaEditPropertyWorkspace.filter({ hasText: propertyEditorName }).getByLabel('description'), description); } async clickMediaTypeButton() { await this.click(this.mediaTypeBtn); } async clickMediaTypesMenu() { await this.click(this.mediaTypesMenu); } } exports.MediaTypeUiHelper = MediaTypeUiHelper; //# sourceMappingURL=MediaTypeUiHelper.js.map