UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

53 lines 2.78 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.DropDownList = void 0; const selenium_1 = require("../selenium"); const dropdown_1 = require("./dropdown"); const const_1 = require("./const"); class DropDownList extends dropdown_1.DropDown { constructor(browser, locator = DropDownList.SELECTOR, rootElement) { super(browser, locator, rootElement); } filter() { return __awaiter(this, void 0, void 0, function* () { return this.browser.findChild(yield this.popup(), selenium_1.By.css('.k-list-filter input')); }); } setFilter(text) { return __awaiter(this, void 0, void 0, function* () { const input = yield this.filter(); yield input.click(); yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return yield this.browser.hasFocus(input); }), { timeout: 3000, message: 'Failed to focus input.' }); yield this.browser.sendKey(text); }); } isFocused() { return __awaiter(this, void 0, void 0, function* () { const focused = yield this.browser.driver.switchTo().activeElement(); const isKeyboardFocused = (yield (yield this.root()).getId()) === (yield focused.getId()); const isVisuallyFocused = (yield (yield this.root()).getAttribute('class')).includes(const_1.STATES.FOCUSED); return isVisuallyFocused && isKeyboardFocused; }); } setMaliciousInputs(myInputElement, maliciousInputArray, expectationsArray) { const _super = Object.create(null, { setMaliciousInputs: { get: () => super.setMaliciousInputs } }); return __awaiter(this, void 0, void 0, function* () { const inputElement = myInputElement || (yield this.filter()); yield _super.setMaliciousInputs.call(this, inputElement, maliciousInputArray, expectationsArray); }); } } exports.DropDownList = DropDownList; DropDownList.SELECTOR = const_1.SELECTORS.DROPDOWN_LIST; //# sourceMappingURL=dropdownlist.js.map