UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

103 lines 4.92 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.FilterMenu = exports.FilterOperator = exports.FilterLogic = void 0; const selenium_1 = require("../selenium"); const ui_component_1 = require("./ui-component"); const dropdownlist_1 = require("./dropdownlist"); class FilterLogic { } exports.FilterLogic = FilterLogic; FilterLogic.And = "And"; FilterLogic.Or = "Or"; class FilterOperator { } exports.FilterOperator = FilterOperator; FilterOperator.EqualTo = "Is equal to"; FilterOperator.NotEqualTo = "Is not equal to"; FilterOperator.GreaterThanOrEqualTo = "Is greater than or equal to"; FilterOperator.GreaterThan = "Is greater than"; FilterOperator.LessThan = "Is less than"; FilterOperator.LessThanOrEqualTo = "Is less than or equal to"; FilterOperator.Contains = "Contains"; FilterOperator.DoesNotContain = "Does not contain"; FilterOperator.StartsWith = "Starts with"; FilterOperator.EndWith = "Ends with"; FilterOperator.IsNull = "Is null"; FilterOperator.IsNotNull = "Is not null"; FilterOperator.IsEmpty = "Is empty"; FilterOperator.IsNotEmpty = "Is not empty"; FilterOperator.HasValue = "Has value"; FilterOperator.HasNoValue = "Has no value"; class FilterMenu extends ui_component_1.UIComponent { constructor(browser, locator, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } setFirstFilter(dropDownItem, value) { return __awaiter(this, void 0, void 0, function* () { const dropdown = new dropdownlist_1.DropDownList(this.browser, "span[title='Operator']", yield this.root()); yield dropdown.selectItemByText(dropDownItem); if (value !== null) { const input = yield this.findChild('input[title="Value"]:not([style~="none;"])'); const inputHidden = yield this.findChild('input[title="Value"]:not([style~="block;"])'); yield this.browser.click(input); yield this.browser.hasFocus(inputHidden); yield this.browser.sendKey(value); } }); } setOperator(operator) { return __awaiter(this, void 0, void 0, function* () { const dropdown = new dropdownlist_1.DropDownList(this.browser, "span[title='Filters logic']", yield this.root()); yield dropdown.selectItemByText(operator); }); } setSecondFilter(dropDownItem, value) { return __awaiter(this, void 0, void 0, function* () { const dropdown = new dropdownlist_1.DropDownList(this.browser, "span[title='Additional operator']", yield this.root()); yield dropdown.selectItemByText(dropDownItem); if (value !== null) { const input = yield this.findChild('input[title="Additional value"]:not([style~="none;"])'); const inputHidden = yield this.findChild('input[title="Additional value"]:not([style~="block;"])'); yield this.browser.click(input); yield this.browser.hasFocus(inputHidden); yield this.browser.sendKey(value); } }); } setBoolFilter(value) { return __awaiter(this, void 0, void 0, function* () { const radio = value ? (yield this.findChildren('input[type="radio"]'))[0] : (yield this.findChildren('input[type="radio"]'))[1]; yield radio.click(); }); } applyFilter() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.findChild(".k-actions button[type='submit']")).click(); yield this.browser.wait(selenium_1.EC.notVisible(this.locator), { timeout: 5000, message: 'Failed to close popup on apply filter.' }); }); } clearFilter() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.findChild(".k-actions button[type='reset']")).click(); yield this.browser.wait(selenium_1.EC.notVisible(this.locator), { timeout: 5000, message: 'Failed to close popup on apply.' }); }); } } exports.FilterMenu = FilterMenu; //# sourceMappingURL=filtermenu.js.map