UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

78 lines 3.35 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.TextBox = void 0; const selenium_1 = require("../selenium"); const const_1 = require("./const"); const ui_component_1 = require("./ui-component"); class TextBox extends ui_component_1.UIComponent { constructor(browser, locator = TextBox.SELECTOR, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } input() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild("input.k-input-inner"); }); } clearValue() { return __awaiter(this, void 0, void 0, function* () { yield (yield this.root()).click(); yield this.browser.sleep(25); yield this.browser.sendControlKeyCombination("a"); yield this.browser.sleep(25); yield this.browser.sendKey(selenium_1.Key.BACK_SPACE); yield this.browser.sleep(25); }); } setValue(value_1) { return __awaiter(this, arguments, void 0, function* (value, { clear = true } = {}) { if (clear) { yield this.clearValue(); } else { yield (yield this.root()).click(); yield this.browser.sleep(25); } yield this.browser.sendKey(value); yield this.browser.sleep(25); }); } getValue() { return __awaiter(this, void 0, void 0, function* () { return yield (yield this.input()).getAttribute("value"); }); } getSelectionStart() { return __awaiter(this, void 0, void 0, function* () { const input = yield this.input(); return parseInt(yield this.browser.getProperty(input, "selectionStart")); }); } getSelectionEnd() { return __awaiter(this, void 0, void 0, function* () { const input = yield this.input(); return parseInt(yield this.browser.getProperty(input, "selectionEnd")); }); } 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.input()); yield _super.setMaliciousInputs.call(this, inputElement, maliciousInputArray, expectationsArray); }); } } exports.TextBox = TextBox; TextBox.SELECTOR = const_1.SELECTORS.TEXTBOX; //# sourceMappingURL=textbox.js.map