UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

57 lines 2.74 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.NumericTextBox = void 0; const const_1 = require("./const"); const selenium_1 = require("../selenium"); const input_1 = require("./input"); class NumericTextBox extends input_1.Input { constructor(browser, locator = NumericTextBox.SELECTOR, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } setValue(value_1) { return __awaiter(this, arguments, void 0, function* (value, { clear = true } = {}) { const input = yield this.input(); yield input.click(); yield this.browser.wait(selenium_1.EC.hasFocus(yield this.input()), { timeout: 3000, message: 'Failed to focus input.' }); if (clear) { yield this.browser.sleep(20); yield this.browser.sendKey(selenium_1.Key.HOME); yield this.browser.sleep(20); for (let i = 0; i < (yield this.getValue()).length + 4; i++) { yield this.browser.sendKey(selenium_1.Key.DELETE); yield this.browser.sleep(10); } } yield this.browser.sendKey(value); }); } increaseValue() { return __awaiter(this, void 0, void 0, function* () { const jquery = ".k-link-increase"; const aspNetCore = ".k-spinner-increase"; const increaseButton = yield this.findChild(`${jquery},${aspNetCore}`); yield increaseButton.click(); }); } decreaseValue() { return __awaiter(this, void 0, void 0, function* () { const jquery = ".k-link-decrease"; const aspNetCore = ".k-spinner-decrease"; const decreaseButton = yield this.findChild(`${jquery},${aspNetCore}`); yield decreaseButton.click(); }); } } exports.NumericTextBox = NumericTextBox; NumericTextBox.SELECTOR = const_1.SELECTORS.NUMERICTEXTBOX; //# sourceMappingURL=numerictextbox.js.map