UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

142 lines 5.96 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.SchedulerEventWindow = exports.Scheduler = void 0; const ui_component_1 = require("./ui-component"); const window_1 = require("./window"); const datepicker_1 = require("./datepicker"); const const_1 = require("./const"); const selenium_1 = require("../selenium"); class Scheduler extends ui_component_1.UIComponent { constructor(browser, locator = const_1.SELECTORS.SCHEDULER, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } toolbar() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-scheduler-toolbar'); }); } calendarIcon() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(Scheduler.CALENDAR_ICON); }); } todayButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(".k-nav-today"); }); } getPrevButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(".k-nav-prev"); }); } getNextButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(".k-nav-next"); }); } currentNavText() { return __awaiter(this, void 0, void 0, function* () { const navButton = ".k-scheduler-toolbar button.k-nav-current > span.k-button-text"; return yield (yield this.findChild(navButton)).getText(); }); } switchToView(view) { return __awaiter(this, void 0, void 0, function* () { const newView = yield this.findChild(`button.k-view-${view}`); yield newView.click(); yield this.browser.wait(selenium_1.EC.hasClass(newView, 'k-selected'), { message: `Failed to select ${view} view.` }); yield this.waitUntilLoaded(); }); } getEvent(index) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`.k-scheduler-content > div.k-event:nth-of-type(${index})`); }); } getAgendaViewEvent(index) { return __awaiter(this, void 0, void 0, function* () { const task = '.k-scheduler-content .k-task'; return (yield this.findChildren(task))[index]; }); } getEventWindow() { return __awaiter(this, void 0, void 0, function* () { const window = new SchedulerEventWindow(this.browser, '.k-window'); yield this.browser.waitForAnimation('.k-window'); return window; }); } } exports.Scheduler = Scheduler; Scheduler.SELECTOR = const_1.SELECTORS.SCHEDULER; Scheduler.CALENDAR_ICON = ".k-scheduler-toolbar button.k-nav-current .k-svg-i-calendar"; class SchedulerEventWindow extends window_1.Window { constructor(browser, locator = SchedulerEventWindow.SELECTOR, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } getEventTitleField() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-window-content input[name="title"]'); }); } getEventStartPicker() { return __awaiter(this, void 0, void 0, function* () { return new datepicker_1.DatePicker(this.browser, '.k-window-content input[name="start"]', SchedulerEventWindow.SELECTOR); }); } getEventEndPicker() { return __awaiter(this, void 0, void 0, function* () { return new datepicker_1.DatePicker(this.browser, '.k-window-content input[name="end"]', SchedulerEventWindow.SELECTOR); }); } descriptionField() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-window-content textarea[name="description"]'); }); } saveButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-edit-buttons .k-scheduler-update'); }); } cancelButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-edit-buttons .k-scheduler-cancel'); }); } deleteButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-edit-buttons .k-scheduler-delete'); }); } isAllDayCheckbox() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-window-content input[name="isAllDay"]'); }); } timeZoneButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('div[data-container-for="timezone"] a'); }); } repeatButton(text) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`div[name="recurrenceRule"] [aria-label="Repeat${text}"]`); }); } } exports.SchedulerEventWindow = SchedulerEventWindow; SchedulerEventWindow.SELECTOR = const_1.SELECTORS.WINDOW; //# sourceMappingURL=scheduler.js.map