@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
69 lines • 2.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StylesheetUiHelper = void 0;
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 this.enterText(this.stylesheetNameTxt, stylesheetName);
}
async enterStylesheetContent(stylesheetContent) {
await this.enterMonacoEditorValue(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 this.isVisible(this.stylesheetTree.getByText(stylesheetName, { exact: true }), 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