@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
80 lines • 3.38 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PartialViewUiHelper = void 0;
const UiBaseLocators_1 = require("./UiBaseLocators");
class PartialViewUiHelper extends UiBaseLocators_1.UiBaseLocators {
newEmptyPartialViewBtn;
newPartialViewFromSnippetBtn;
partialViewTree;
partialViewUiLoader;
newFolderThreeDots;
constructor(page) {
super(page);
this.newEmptyPartialViewBtn = page.getByLabel('New empty partial view');
this.newPartialViewFromSnippetBtn = page.getByLabel('New partial view from snippet...');
this.partialViewTree = page.locator('umb-tree[alias="Umb.Tree.PartialView"]');
this.partialViewUiLoader = page.locator('uui-loader');
this.newFolderThreeDots = page.getByLabel('New Folder...');
}
async clickActionsMenuForPartialView(name) {
await this.clickActionsMenuForName(name);
}
async clickActionsMenuAtRoot() {
await this.clickActionsMenuForPartialView('Partial Views');
}
async clickRootFolderCaretButton() {
await this.openCaretButtonForName('Partial Views');
}
async waitForPartialViewToBeCreated() {
await this.waitForNetworkToBeIdle();
}
async waitForPartialViewToBeDeleted() {
await this.waitForNetworkToBeIdle();
}
async waitForPartialViewToBeRenamed() {
await this.waitForNetworkToBeIdle();
}
async clickNewEmptyPartialViewButton() {
await this.newEmptyPartialViewBtn.click();
}
async clickNewPartialViewFromSnippetButton() {
await this.newPartialViewFromSnippetBtn.click();
}
async enterPartialViewName(partialViewName) {
await this.click(this.enterAName);
await this.enterText(this.enterAName, partialViewName);
await this.hasValue(this.enterAName, partialViewName);
}
async enterPartialViewContent(partialViewContent) {
// The waits in this method is currently needed as the test will fail with expects
await this.waitUntilPartialViewLoaderIsNoLongerVisible();
await this.enterMonacoEditorValue(partialViewContent);
// We need this wait, to be sure that the partial view content is loaded.
await this.page.waitForTimeout(200);
}
async openPartialViewAtRoot(partialViewName) {
await this.reloadPartialViewTree();
await this.page.locator('uui-menu-item[label="' + partialViewName + '"]').click();
await this.isVisible(this.enterAName);
}
async createPartialViewFolder(folderName) {
await this.clickCreateOptionsActionMenuOption();
await this.newFolderThreeDots.click();
await this.enterFolderName(folderName);
await this.clickConfirmCreateFolderButton();
}
async reloadPartialViewTree() {
await this.reloadTree('Partial Views');
}
async waitUntilPartialViewLoaderIsNoLongerVisible() {
await this.isVisible(this.partialViewUiLoader, false);
}
async isPartialViewRootTreeItemVisible(partialView, isVisible = true, toReload = true) {
if (toReload) {
await this.reloadPartialViewTree();
}
return this.isVisible(this.partialViewTree.getByText(partialView, { exact: true }), isVisible);
}
}
exports.PartialViewUiHelper = PartialViewUiHelper;
//# sourceMappingURL=PartialViewUiHelper.js.map