@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
150 lines • 7.1 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.Timeline = void 0;
const selenium_1 = require("../selenium");
const const_1 = require("./const");
const ui_component_1 = require("./ui-component");
class Timeline extends ui_component_1.UIComponent {
constructor(browser, locator = Timeline.SELECTOR, parentElement) {
super(browser, locator, parentElement);
this.parentElement = parentElement;
}
getTimeLineScrollableWrap() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(".k-timeline-scrollable-wrap");
});
}
getFlag(index) {
return __awaiter(this, void 0, void 0, function* () {
return yield (yield this.findChildren(".k-timeline-flag"))[index].getText();
});
}
getEvent(index) {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.findChildren(".k-timeline-event"))[index];
});
}
getEventDate(index) {
return __awaiter(this, void 0, void 0, function* () {
const event = yield this.getEvent(index);
return yield (yield this.browser.findChild(event, ".k-timeline-date")).getText();
});
}
getTimelineCard(index) {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.findChildren(".k-timeline-card"))[index];
});
}
getCard(index) {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.findChildren(".k-timeline-card .k-card"))[index];
});
}
getCardInner(index) {
return __awaiter(this, void 0, void 0, function* () {
const card = yield this.getTimelineCard(index);
return yield this.browser.findChild(card, ".k-card-inner");
});
}
getHeader(index) {
return __awaiter(this, void 0, void 0, function* () {
const card = yield this.getTimelineCard(index);
return yield this.browser.findChild(card, ".k-card-inner .k-card-header");
});
}
getBody(index) {
return __awaiter(this, void 0, void 0, function* () {
const card = yield this.getTimelineCard(index);
return yield this.browser.findChild(card, ".k-card-inner .k-card-body");
});
}
getHeaderTitle(index) {
return __awaiter(this, void 0, void 0, function* () {
const card = yield this.getTimelineCard(index);
const tile = yield this.browser.findChild(card, ".k-card-inner .k-card-header .k-event-title");
return yield tile.getText();
});
}
getHeaderTitleHorizontal(index) {
return __awaiter(this, void 0, void 0, function* () {
const card = yield this.getTimelineCard(index);
const title = yield this.browser.findChild(card, ".k-card-inner .k-card-header .k-card-title");
return yield title.getText();
});
}
getTrackItemHorizontal(index) {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.findChildren(".k-timeline-track-item"))[index];
});
}
getTrackItemHorizontalCircle(index) {
return __awaiter(this, void 0, void 0, function* () {
const item = yield this.getTrackItemHorizontal(index);
return yield this.browser.findChild(item, ".k-timeline-circle");
});
}
getTrackItemHorizontalDate(index) {
return __awaiter(this, void 0, void 0, function* () {
const item = yield this.getTrackItemHorizontal(index);
return yield (yield this.browser.findChild(item, ".k-timeline-date")).getText();
});
}
getHeaderSubTitleHorizontal(index) {
return __awaiter(this, void 0, void 0, function* () {
const card = yield this.getTimelineCard(index);
const subTitle = yield this.browser.findChild(card, ".k-card-inner .k-card-header .k-card-subtitle");
return yield subTitle.getText();
});
}
waitForFocusedCard(index) {
return __awaiter(this, void 0, void 0, function* () {
yield this.browser.wait(selenium_1.EC.hasFocus(yield this.getCard(index)), { timeout: 3000, message: `Failed to focus ${index} card` });
});
}
getBodyContent(index) {
return __awaiter(this, void 0, void 0, function* () {
const card = yield this.getTimelineCard(index);
const bodyContent = yield this.browser.findChild(card, ".k-card-inner .k-card-body p");
return yield bodyContent.getText();
});
}
isExpanded(index) {
return __awaiter(this, void 0, void 0, function* () {
const css = yield (yield this.getTimelineCard(index)).getAttribute("class");
let state;
if (css.includes("k-collapsed")) {
state = false;
}
else {
state = true;
}
return state;
});
}
checkExpandedState(index) {
return __awaiter(this, void 0, void 0, function* () {
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield this.isExpanded(index)) === true; }));
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield (yield this.getBody(index)).isDisplayed()) === true; }));
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield (yield (yield this.getBody(index)).findElement(selenium_1.By.css("img"))).isDisplayed()) === true; }));
});
}
checkCollapsedState(index) {
return __awaiter(this, void 0, void 0, function* () {
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield this.isExpanded(index)) === false; }));
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield (yield this.getBody(index)).isDisplayed()) === false; }));
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield (yield (yield this.getBody(index)).findElement(selenium_1.By.css("img"))).isDisplayed()) === false; }));
});
}
}
exports.Timeline = Timeline;
Timeline.SELECTOR = const_1.SELECTORS.TIMELINE;
//# sourceMappingURL=timeline.js.map