@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
62 lines • 3.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentBlueprintUiHelper = void 0;
const UiBaseLocators_1 = require("./UiBaseLocators");
const ConstantHelper_1 = require("./ConstantHelper");
class DocumentBlueprintUiHelper extends UiBaseLocators_1.UiBaseLocators {
documentBlueprintTree;
documentBlueprintNameTxt;
deleteMenu;
constructor(page) {
super(page);
this.documentBlueprintTree = page.locator('umb-tree[alias="Umb.Tree.DocumentBlueprint"]');
this.documentBlueprintNameTxt = page.locator('#name-input #input');
this.deleteMenu = page.locator('umb-section-sidebar #menu-item').getByLabel('Delete');
}
async clickActionsMenuForDocumentBlueprints(name) {
await this.clickActionsMenuForName(name);
}
async clickActionsMenuAtRoot() {
await this.clickActionsMenuForDocumentBlueprints('Document Blueprints');
}
async clickRootFolderCaretButton() {
await this.openCaretButtonForName('Document Blueprints');
}
async clickSaveButtonAndWaitForDocumentBlueprintToBeCreated() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.documentBlueprint, this.clickSaveButton(), ConstantHelper_1.ConstantHelper.statusCodes.created);
}
async clickSaveButtonAndWaitForDocumentBlueprintToBeUpdated() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.documentBlueprint, this.clickSaveButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
async reloadDocumentBlueprintsTree() {
await this.reloadTree('Document Blueprints');
}
async goToDocumentBlueprint(blueprintName) {
await this.goToSection(ConstantHelper_1.ConstantHelper.sections.settings);
await this.reloadDocumentBlueprintsTree();
await this.click(this.page.getByLabel(blueprintName, { exact: true }));
}
async isDocumentBlueprintRootTreeItemVisible(blueprintName, isVisible = true, toReload = true) {
if (toReload) {
await this.reloadDocumentBlueprintsTree();
}
await this.isVisible(this.documentBlueprintTree.getByText(blueprintName, { exact: true }), isVisible);
}
async clickCreateDocumentBlueprintButton() {
await this.click(this.createDocumentBlueprintBtn);
}
async clickCreateNewDocumentBlueprintButton() {
await this.click(this.createNewDocumentBlueprintBtn);
}
async enterDocumentBlueprintName(blueprintName) {
await this.enterText(this.documentBlueprintNameTxt, blueprintName);
}
async clickDeleteMenuButton() {
await this.click(this.deleteMenu);
}
async clickConfirmToDeleteButtonAndWaitForDocumentBlueprintToBeDeleted() {
return await this.waitForResponseAfterExecutingPromise(ConstantHelper_1.ConstantHelper.apiEndpoints.documentBlueprint, this.clickConfirmToDeleteButton(), ConstantHelper_1.ConstantHelper.statusCodes.ok);
}
}
exports.DocumentBlueprintUiHelper = DocumentBlueprintUiHelper;
//# sourceMappingURL=DocumentBlueprintUiHelper.js.map