UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

147 lines 6.6 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Filter = void 0; const const_1 = require("./const"); const dropdownlist_1 = require("./dropdownlist"); const numerictextbox_1 = require("./numerictextbox"); const textbox_1 = require("./textbox"); const ui_component_1 = require("./ui-component"); class Filter extends ui_component_1.UIComponent { constructor(browser, locator = Filter.SELECTOR, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } mainToolbar() { return __awaiter(this, void 0, void 0, function* () { const locator = '.k-filter-group-main .k-filter-toolbar'; return yield this.findChild(locator); }); } mainOperatorAnd() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(Filter.MAIN_OPERATOR_AND); }); } mainOperatorOr() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(Filter.MAIN_OPERATOR_OR); }); } switchMainOperatorToAnd() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.mainOperatorAnd()).click(); }); } switchMainOperatorToOr() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.mainOperatorOr()).click(); }); } toolbar() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { const locator = `.k-filter-lines li:nth-of-type(${rowIndex}) .k-filter-toolbar`; return yield this.findChild(locator); }); } andOperatorByRow() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { const locator = `.k-filter-lines li:nth-of-type(${rowIndex}) .k-filter-toolbar .k-button-group .k-button:nth-of-type(1)`; return yield this.findChild(locator); }); } orOperatorByRow() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { const locator = `.k-filter-lines li:nth-of-type(${rowIndex}) .k-filter-toolbar .k-button-group .k-button:nth-of-type(2)`; return yield this.findChild(locator); }); } switchOperatorToAnd() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { yield (yield this.andOperatorByRow(rowIndex)).click(); }); } switchOperatorToOr() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { yield (yield this.orOperatorByRow(rowIndex)).click(); }); } addExpression() { return __awaiter(this, void 0, void 0, function* () { const locator = '.k-filter-group-main .k-filter-toolbar .k-button[title="Add Expression"]'; yield (yield this.findChild(locator)).click(); }); } removeExpression() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { const locator = `.k-filter-lines li:nth-of-type(${rowIndex}) .k-filter-toolbar .k-button[aria-label="Close"]`; yield (yield this.findChild(locator)).click(); }); } getDropDown() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1, title) { return new dropdownlist_1.DropDownList(this.browser, `.k-dropdownlist[title="${title}"]`, yield this.toolbar(rowIndex)); }); } getNumericTextBox() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { return new numerictextbox_1.NumericTextBox(this.browser, '.k-numerictextbox', yield this.toolbar(rowIndex)); }); } getTextBox() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { return new textbox_1.TextBox(this.browser, '.k-textbox', yield this.toolbar(rowIndex)); }); } getCheckbox() { return __awaiter(this, arguments, void 0, function* (rowIndex = 1) { return yield this.browser.findChild(yield this.toolbar(rowIndex), const_1.SELECTORS.CHECKBOX); }); } getPreviewField() { return __awaiter(this, arguments, void 0, function* (index = 1) { const locator = '.k-filter-preview .k-filter-preview-field'; const element = (yield this.findChildren(locator))[index - 1]; return yield element.getText(); }); } getPreviewCriteria() { return __awaiter(this, arguments, void 0, function* (index = 1) { const locator = '.k-filter-preview .k-filter-preview-criteria'; const element = (yield this.findChildren(locator))[index - 1]; return yield element.getText(); }); } getPreviewValue() { return __awaiter(this, arguments, void 0, function* (index = 1) { const locator = '.k-filter-preview .k-filter-preview-value'; const element = (yield this.findChildren(locator))[index - 1]; return yield element.getText(); }); } getPreviewOperator() { return __awaiter(this, arguments, void 0, function* (index = 1) { const locator = '.k-filter-preview .k-filter-preview-operator'; const element = (yield this.findChildren(locator))[index - 1]; return yield element.getText(); }); } apply() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.findChild('.k-filter-apply')).click(); }); } } exports.Filter = Filter; Filter.SELECTOR = const_1.SELECTORS.FILTER; Filter.MAIN_OPERATOR_AND = '.k-filter-group-main .k-filter-toolbar .k-button-group .k-button:nth-of-type(1)'; Filter.MAIN_OPERATOR_OR = '.k-filter-group-main .k-filter-toolbar .k-button-group .k-button:nth-of-type(2)'; //# sourceMappingURL=filter.js.map