UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

67 lines 3.01 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.DateTimePicker = void 0; const ui_component_1 = require("./ui-component"); const selenium_1 = require("../selenium"); const const_1 = require("./const"); class DateTimePicker extends ui_component_1.UIComponent { constructor(browser, locator = DateTimePicker.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'); }); } inputValue() { return __awaiter(this, void 0, void 0, function* () { return yield (yield this.input()).getAttribute('value'); }); } dateButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-button:nth-of-type(1)'); }); } timeButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-button:nth-of-type(2)'); }); } type(text_1) { return __awaiter(this, arguments, void 0, function* (text, { typeFromBeginning = true, clear = false } = {}) { const input = yield this.input(); if (typeFromBeginning) { const rect = yield input.getRect(); yield this.browser.driver.actions({ async: false, bridge: true }) .move({ origin: input, x: 3 - rect.width / 2, y: 3 - rect.height / 2 }) .click() .perform(); } else { yield input.click(); } yield this.browser.wait(selenium_1.EC.hasFocus(input), { timeout: 3000, message: 'Failed to focus input.' }); if (clear) { yield this.browser.sendControlKeyCombination('a'); yield this.browser.sleep(10); yield this.browser.sendKey(selenium_1.Key.BACK_SPACE); yield this.browser.sleep(10); } yield this.browser.sendKey(text); }); } } exports.DateTimePicker = DateTimePicker; DateTimePicker.SELECTOR = const_1.SELECTORS.DATETIMEPICKER; //# sourceMappingURL=datetimepicker.js.map