UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

89 lines 4.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RelationTypeUiHelper = void 0; const test_1 = require("@playwright/test"); 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 (0, test_1.expect)(this.relationTypeCollection.getByText(name)).toBeVisible(); await this.relationTypeCollection.getByText(name).click(); } async clickRootFolderCaretButton() { await this.openCaretButtonForName("Relation Types"); } async clickActionsMenuAtRoot() { await this.clickActionsMenuForRelationType("Relation Types"); } async openRelationTypeByNameAtRoot(relationTypeName) { await this.clickRootFolderCaretButton(); await this.page.getByLabel(relationTypeName).click(); } async enterRelationTypeName(name) { await this.relationTypeNameTxt.clear(); await this.relationTypeNameTxt.fill(name); } async clickParentToChildRadioButton() { await this.parentToChildRadioBtn.click(); } async doesParentTypeContainValue(value) { await (0, test_1.expect)(this.relationTypeParentType).toContainText(value); } async doesChildTypeContainValue(value) { await (0, test_1.expect)(this.relationTypeChildType).toContainText(value); } async doesBidirectionalContainValue(value) { await (0, test_1.expect)(this.relationTypeBidirectional).toContainText(value); } async doesDependencyContainValue(value) { await (0, test_1.expect)(this.relationTypeDependency).toContainText(value); } async isRelationWithParentAndChildVisible(parent, child, isVisible = true) { await (0, test_1.expect)(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) })).toBeVisible({ visible: isVisible }); } async clickBidirectionalRadioButton() { await this.bidirectionalRadioBtn.click(); } async clickIsDependencyToggle() { await this.isDependencyToggle.click(); } async selectParentOption(option) { await this.parentDropDownBox.selectOption({ label: option }); } async selectChildOption(option) { await this.childDropDownBox.selectOption({ label: option }); } } exports.RelationTypeUiHelper = RelationTypeUiHelper; //# sourceMappingURL=RelationTypeUiHelper.js.map