UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

87 lines 4.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RelationTypeUiHelper = void 0; const UiBaseLocators_1 = require("./UiBaseLocators"); class RelationTypeUiHelper extends UiBaseLocators_1.UiBaseLocators { relationTypeNameTxt; parentToChildRadioBtn; bidirectionalRadioBtn; isDependencyToggle; parentDropDownBox; childDropDownBox; relationTypeCollection; relationTypeWorkspace; relationTypeParentType; relationTypeChildType; relationTypeBidirectional; relationTypeDependency; relationsTableRow; constructor(page) { super(page); this.relationTypeNameTxt = page.locator('#name #input'); this.parentToChildRadioBtn = page.locator("uui-radio[label='Parent to child'] #button"); this.bidirectionalRadioBtn = page.locator("uui-radio[label='Bidirectional'] #button"); this.isDependencyToggle = page.locator("umb-property-layout[label='Is dependency'] #toggle"); this.parentDropDownBox = page.locator("umb-property-layout[label='Parent'] #native"); this.childDropDownBox = page.locator("umb-property-layout[label='Child'] #native"); this.relationTypeCollection = page.locator('umb-relation-type-table-collection-view'); this.relationTypeWorkspace = page.locator('umb-relation-type-detail-workspace-view'); this.relationTypeParentType = this.relationTypeWorkspace.locator('[label="Parent Type"]').locator('[slot="editor"]'); this.relationTypeChildType = this.relationTypeWorkspace.locator('[label="Child Type"]').locator('[slot="editor"]'); this.relationTypeBidirectional = this.relationTypeWorkspace.locator('[label="Bidirectional"]').locator('[slot="editor"]'); this.relationTypeDependency = this.relationTypeWorkspace.locator('[label="Dependency"]').locator('[slot="editor"]'); this.relationsTableRow = this.relationTypeWorkspace.locator('umb-table').locator('uui-table-row'); } async clickActionsMenuForRelationType(name) { await this.clickActionsMenuForName(name); } async goToRelationTypeWithName(name) { await this.click(this.relationTypeCollection.getByText(name)); await this.waitUntilUiLoaderIsNoLongerVisible(); } async clickRootFolderCaretButton() { await this.openCaretButtonForName("Relation Types"); } async clickActionsMenuAtRoot() { await this.clickActionsMenuForRelationType("Relation Types"); } async openRelationTypeByNameAtRoot(relationTypeName) { await this.clickRootFolderCaretButton(); await this.click(this.page.getByLabel(relationTypeName)); } async enterRelationTypeName(name) { await this.enterText(this.relationTypeNameTxt, name); } async clickParentToChildRadioButton() { await this.click(this.parentToChildRadioBtn); } async doesParentTypeContainValue(value) { await this.containsText(this.relationTypeParentType, value); } async doesChildTypeContainValue(value) { await this.containsText(this.relationTypeChildType, value); } async doesBidirectionalContainValue(value) { await this.containsText(this.relationTypeBidirectional, value); } async doesDependencyContainValue(value) { await this.containsText(this.relationTypeDependency, value); } async isRelationWithParentAndChildVisible(parent, child, isVisible = true) { await this.isVisible(this.relationsTableRow.filter({ has: this.page.locator('uui-table-cell').first().getByText(parent) }).filter({ has: this.page.locator('uui-table-cell').nth(1).getByText(child) }), isVisible); } async clickBidirectionalRadioButton() { await this.click(this.bidirectionalRadioBtn); } async clickIsDependencyToggle() { await this.click(this.isDependencyToggle); } async selectParentOption(option) { await this.selectByText(this.parentDropDownBox, option); } async selectChildOption(option) { await this.selectByText(this.childDropDownBox, option); } } exports.RelationTypeUiHelper = RelationTypeUiHelper; //# sourceMappingURL=RelationTypeUiHelper.js.map