@umbraco/playwright-testhelpers
Version:
Test helpers for making playwright tests for Umbraco solutions
107 lines • 4.57 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentTypeUiHelper = void 0;
const UiBaseLocators_1 = require("./UiBaseLocators");
class DocumentTypeUiHelper extends UiBaseLocators_1.UiBaseLocators {
newDocumentTypeBtn;
sharedAcrossCulturesToggle;
documentTypeSettingsTabBtn;
documentTypeTemplatesTabBtn;
varyBySegmentsBtn;
varyByCultureBtn;
createDocumentTypeBtn;
createDocumentTypeWithTemplateBtn;
createElementTypeBtn;
createDocumentFolderBtn;
preventCleanupBtn;
setAsDefaultBtn;
tabGroup;
documentTypesMenu;
constructor(page) {
super(page);
this.newDocumentTypeBtn = page.getByLabel('New Document Type…');
this.sharedAcrossCulturesToggle = page.locator('label').filter({ hasText: 'Shared across cultures' }).locator('#toggle');
this.tabGroup = page.getByTestId('workspace:view-links');
this.documentTypeSettingsTabBtn = this.tabGroup.locator('[data-mark*="Settings"]');
this.documentTypeTemplatesTabBtn = this.tabGroup.locator('[data-mark*="Templates"]');
this.varyBySegmentsBtn = page.getByText('Vary by segment', { exact: true });
this.varyByCultureBtn = page.getByText('Vary by culture', { exact: true });
this.createDocumentTypeBtn = page.locator('umb-ref-item').getByText('Document Type', { exact: true });
this.createDocumentTypeWithTemplateBtn = page.locator('umb-ref-item').getByText('Document Type with Template', { exact: true });
this.createElementTypeBtn = page.locator('umb-ref-item').getByText('Element Type', { exact: true });
this.createDocumentFolderBtn = page.locator('umb-ref-item').getByText('Folder', { exact: true });
this.preventCleanupBtn = page.getByText('Prevent clean up');
this.setAsDefaultBtn = page.getByText('Set as default');
this.documentTypesMenu = page.locator('#menu-item').getByRole('link', { name: 'Document Types' });
}
async clickActionsMenuForDocumentType(name) {
await this.clickActionsMenuForName(name);
}
async clickActionsMenuAtRoot() {
await this.clickActionsMenuForDocumentType("Document Types");
}
async clickRootFolderCaretButton() {
await this.openCaretButtonForName('Document Types');
}
async clickNewDocumentTypeButton() {
await this.click(this.newDocumentTypeBtn);
}
async clickSharedAcrossCulturesToggle() {
await this.click(this.sharedAcrossCulturesToggle);
}
async clickDocumentTypeSettingsTab() {
await this.click(this.documentTypeSettingsTabBtn);
}
async clickDocumentTypeTemplatesTab() {
await this.click(this.documentTypeTemplatesTabBtn);
}
async clickVaryBySegmentsButton() {
await this.click(this.varyBySegmentsBtn);
}
async clickVaryByCultureButton() {
await this.click(this.varyByCultureBtn);
}
async clickPreventCleanupButton() {
await this.click(this.preventCleanupBtn);
}
async goToDocumentType(documentTypeName) {
await this.clickRootFolderCaretButton();
await this.clickLabelWithName(documentTypeName);
}
async waitForDocumentTypeToBeCreated() {
await this.waitForNetworkToBeIdle();
}
async waitForDocumentTypeToBeDeleted() {
await this.waitForNetworkToBeIdle();
}
async waitForDocumentTypeToBeRenamed() {
await this.waitForNetworkToBeIdle();
}
async enterDocumentTypeName(documentTypeName) {
await this.enterText(this.enterAName, documentTypeName);
await this.hasValue(this.enterAName, documentTypeName);
}
async clickCreateDocumentTypeButton() {
await this.click(this.createDocumentTypeBtn);
}
async clickCreateDocumentTypeWithTemplateButton() {
await this.click(this.createDocumentTypeWithTemplateBtn);
}
async clickCreateElementTypeButton() {
await this.click(this.createElementTypeBtn);
}
async clickCreateDocumentFolderButton() {
await this.click(this.createDocumentFolderBtn);
}
async isDocumentTreeItemVisible(name, isVisible = true) {
await this.isVisible(this.page.locator('umb-tree-item').locator('[label="' + name + '"]'), isVisible);
}
async clickSetAsDefaultButton() {
await this.click(this.setAsDefaultBtn);
}
async clickDocumentTypesMenu() {
await this.click(this.documentTypesMenu);
}
}
exports.DocumentTypeUiHelper = DocumentTypeUiHelper;
//# sourceMappingURL=DocumentTypeUiHelper.js.map