@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
98 lines • 4.42 kB
JavaScript
"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.Gantt = void 0;
const const_1 = require("./const");
const treelist_1 = require("./treelist");
const window_1 = require("./window");
const ui_component_1 = require("./ui-component");
const selenium_1 = require("../selenium");
class Gantt extends ui_component_1.UIComponent {
constructor(browser, locator = Gantt.SELECTOR, parentElement) {
super(browser, locator, parentElement);
this.parentElement = parentElement;
}
treeList() {
return __awaiter(this, void 0, void 0, function* () {
return new treelist_1.TreeList(this.browser, '.k-gantt-treelist', yield this.root());
});
}
addTaskButton() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild('button.k-gantt-create');
});
}
saveTaskButton() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild('button.k-gantt-update');
});
}
addTask() {
return __awaiter(this, void 0, void 0, function* () {
const addTaskButton = yield this.addTaskButton();
yield addTaskButton.click();
});
}
addTaskViaDropdown(index) {
return __awaiter(this, void 0, void 0, function* () {
yield this.browser.sleep(1000);
yield this.addTask();
yield this.browser.sleep(1000);
yield this.browser.wait(selenium_1.EC.isVisible('.k-animation-container'), { timeout: 3000, message: 'Failed to open add task dropdown.' });
yield this.browser.waitForAnimation('.k-animation-container li');
yield this.browser.click(`.k-animation-container li:nth-of-type(${index})`);
});
}
getViewButton(view) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(`button.k-view-${view}`);
});
}
switchToView(view) {
return __awaiter(this, void 0, void 0, function* () {
const newView = yield this.getViewButton(view);
yield newView.click();
});
}
getTask(index) {
return __awaiter(this, void 0, void 0, function* () {
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () {
const tasks = yield this.findChildren('.k-task-wrap div.k-task');
return tasks.length > index;
}), { pollTimeout: 50, timeout: 10000, message: `Failed find task with index ${index}` });
return (yield this.findChildren('.k-task-wrap div.k-task'))[index];
});
}
getTaskText(index) {
return __awaiter(this, void 0, void 0, function* () {
return yield (yield this.getTask(index)).getText();
});
}
openTask(index) {
return __awaiter(this, void 0, void 0, function* () {
const task = yield this.getTask(index);
yield this.browser.driver.actions({ async: false, bridge: true }).doubleClick(task).perform();
yield this.browser.wait(selenium_1.EC.isVisible('.k-window .k-popup-edit-form'), {
timeout: 5000, message: 'Failed to open popup editor.'
});
return new window_1.Window(this.browser, '.k-window .k-popup-edit-form');
});
}
getTimeLineHeaderText() {
return __awaiter(this, void 0, void 0, function* () {
const locator = '.k-gantt-timeline-pane tr:nth-of-type(1) td.k-header';
return yield (yield this.findChild(locator)).getText();
});
}
}
exports.Gantt = Gantt;
Gantt.SELECTOR = const_1.SELECTORS.GANTT;
//# sourceMappingURL=gantt.js.map