@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
78 lines • 3.75 kB
JavaScript
;
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.DateRangePicker = void 0;
const ui_component_1 = require("./ui-component");
const selenium_1 = require("../selenium");
const const_1 = require("./const");
class DateRangePicker extends ui_component_1.UIComponent {
constructor(browser, locator = DateRangePicker.SELECTOR, parentElement) {
super(browser, locator, parentElement);
this.parentElement = parentElement;
}
startInput() {
return __awaiter(this, void 0, void 0, function* () {
const jquery = '.k-input-inner[data-input="start"]';
const angular = '.k-input-inner[id*=start]';
const blazor = '.k-floating-label-container:nth-of-type(1) .k-dateinput .k-input-inner';
return yield this.findChild(`${jquery},${angular},${blazor}`);
});
}
endInput() {
return __awaiter(this, void 0, void 0, function* () {
const jquery = '.k-input-inner[data-input="end"]';
const angular = '.k-input-inner[id*=end]';
const blazor = '.k-floating-label-container:nth-of-type(2) .k-dateinput .k-input-inner';
return yield this.findChild(`${jquery},${angular},${blazor}`);
});
}
startInputValue() {
return __awaiter(this, void 0, void 0, function* () {
return yield (yield this.startInput()).getAttribute('value');
});
}
endInputValue() {
return __awaiter(this, void 0, void 0, function* () {
return yield (yield this.endInput()).getAttribute('value');
});
}
typeInStartInput(text_1) {
return __awaiter(this, arguments, void 0, function* (text, { typeFromBeginning = false } = {}) {
const input = yield this.startInput();
yield this.type(input, text, { typeFromBeginning: typeFromBeginning });
});
}
typeInEndInput(text_1) {
return __awaiter(this, arguments, void 0, function* (text, { typeFromBeginning = false } = {}) {
const input = yield this.endInput();
yield this.type(input, text, { typeFromBeginning: typeFromBeginning });
});
}
type(input_1, text_1) {
return __awaiter(this, arguments, void 0, function* (input, text, { typeFromBeginning = false } = {}) {
if (typeFromBeginning) {
const rect = yield input.getRect();
yield this.browser.driver.actions({ async: false, bridge: true })
.move({ origin: input, x: 5 - rect.width / 2, y: 5 - 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.' });
yield this.browser.sendKey(text);
});
}
}
exports.DateRangePicker = DateRangePicker;
DateRangePicker.SELECTOR = const_1.SELECTORS.DATERANGEPICKER;
//# sourceMappingURL=daterangepicker.js.map