UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

73 lines 3.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StylesheetUiHelper = void 0; const test_1 = require("@playwright/test"); const UiBaseLocators_1 = require("./UiBaseLocators"); const ConstantHelper_1 = require("./ConstantHelper"); class StylesheetUiHelper extends UiBaseLocators_1.UiBaseLocators { newStylesheetBtn; stylesheetNameTxt; stylesheetTree; constructor(page) { super(page); this.stylesheetNameTxt = page.locator('umb-stylesheet-workspace-editor').locator('#nameInput #input'); this.newStylesheetBtn = this.createOptionActionListModal.locator('[name="New Stylesheet"]'); this.stylesheetTree = page.locator('umb-tree[alias="Umb.Tree.Stylesheet"]'); } async clickActionsMenuForStylesheet(name) { await this.clickActionsMenuForName(name); } async createStylesheetFolder(folderName) { await this.clickCreateActionMenuOption(); await this.clickFolderButton(); await this.enterFolderName(folderName); await this.clickConfirmCreateFolderButton(); } async clickActionsMenuAtRoot() { await this.clickActionsMenuForStylesheet('Stylesheets'); } async clickRootFolderCaretButton() { await this.openCaretButtonForName('Stylesheets'); } async clickNewStylesheetButton() { await this.newStylesheetBtn.click(); } async waitForStylesheetToBeCreated() { await this.waitForNetworkToBeIdle(); } async waitForStylesheetToBeDeleted() { await this.waitForNetworkToBeIdle(); } async waitForStylesheetToBeRenamed() { await this.waitForNetworkToBeIdle(); } async enterStylesheetName(stylesheetName) { await (0, test_1.expect)(this.stylesheetNameTxt).toBeVisible(); await this.stylesheetNameTxt.clear(); await this.stylesheetNameTxt.fill(stylesheetName); } async enterStylesheetContent(stylesheetContent) { await this.textAreaInputArea.clear(); await this.textAreaInputArea.fill(stylesheetContent); } async openStylesheetByNameAtRoot(stylesheetName) { await this.reloadStylesheetTree(); await this.page.getByLabel(stylesheetName, { exact: true }).click(); } async reloadStylesheetTree() { await this.reloadTree('Stylesheets'); } async isStylesheetRootTreeItemVisible(stylesheetName, isVisible = true, toReload = true) { if (toReload) { await this.reloadStylesheetTree(); } return (0, test_1.expect)(this.stylesheetTree.getByText(stylesheetName, { exact: true })).toBeVisible({ visible: isVisible }); } async goToStylesheet(stylesheetName) { await this.goToSection(ConstantHelper_1.ConstantHelper.sections.settings); await this.reloadStylesheetTree(); await this.page.getByLabel(stylesheetName, { exact: true }).click(); } } exports.StylesheetUiHelper = StylesheetUiHelper; //# sourceMappingURL=StylesheetUiHelper.js.map