UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

72 lines 3.19 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.PanelBar = void 0; const ui_component_1 = require("./ui-component"); const const_1 = require("./const"); const selenium_1 = require("../selenium"); class PanelBar extends ui_component_1.UIComponent { constructor(browser, locator = PanelBar.SELECTOR, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } getItems() { return __awaiter(this, void 0, void 0, function* () { return this.findChildren("li.k-panelbar-item span.k-link"); }); } getItemsCount() { return __awaiter(this, void 0, void 0, function* () { return (yield this.getItems()).length; }); } getItemByIndex(index) { return __awaiter(this, void 0, void 0, function* () { return (yield this.findChildren(`li.k-panelbar-item span.k-link`))[index - 1]; }); } getItemByTextLocator(text) { return selenium_1.By.xpath(`.//li[contains(@class,"k-panelbar-item")]//span[contains(@class,"k-link") and normalize-space()="${text}"]`); } getItemByText(text) { return __awaiter(this, void 0, void 0, function* () { const locator = this.getItemByTextLocator(text); return yield this.findChild(locator); }); } clickItemByIndex(index) { return __awaiter(this, void 0, void 0, function* () { const item = yield this.getItemByIndex(index); yield item.click(); }); } clickItemByText(text) { return __awaiter(this, void 0, void 0, function* () { const item = yield this.getItemByText(text); yield item.click(); }); } isItemExpandedByIndex(index) { return __awaiter(this, void 0, void 0, function* () { const toggle = yield this.browser.findChild(yield this.getItemByIndex(index), '.k-panelbar-toggle'); return (yield toggle.getAttribute('class')).includes('-i-chevron-up'); }); } isItemExpandedByText(text) { return __awaiter(this, void 0, void 0, function* () { const toggle = yield this.browser.findChild(yield this.getItemByText(text), '.k-panelbar-toggle'); return (yield toggle.getAttribute('class')).includes('-i-chevron-up'); }); } } exports.PanelBar = PanelBar; PanelBar.SELECTOR = const_1.SELECTORS.PANELBAR; //# sourceMappingURL=panelbar.js.map