@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
97 lines • 4.16 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.Grid = void 0;
const const_1 = require("./const");
const selenium_1 = require("../selenium");
const table_1 = require("./table");
const pager_1 = require("./pager");
class Grid extends table_1.Table {
constructor(browser, locator = Grid.SELECTOR, parentElement) {
super(browser, locator, parentElement);
this.parentElement = parentElement;
}
pager() {
return __awaiter(this, void 0, void 0, function* () {
return new pager_1.Pager(this.browser, pager_1.Pager.SELECTOR, yield this.root());
});
}
groupRows() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.browser.findChildren(yield this.root(), "tbody > tr.k-grouping-row");
});
}
groupRowsCount() {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.groupRows()).length;
});
}
groupingHeader() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild('.k-grouping-header');
});
}
groupHeaderByIndex(index) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(`.k-grouping-header .k-chip-list > .k-chip:nth-of-type(${index})`);
});
}
groupByColumn(title) {
return __awaiter(this, void 0, void 0, function* () {
const header = yield this.headerByText(title);
yield this.browser.dragTo(header, yield this.groupingHeader());
});
}
ungroupdByColumn(title) {
return __awaiter(this, void 0, void 0, function* () {
const groupHeader = selenium_1.By.xpath(`.//*[contains(@class, "k-chip-list")]/*[contains(@class, 'k-chip') and .="${title}"]//*[contains(@class, "k-chip-remove-action")]`);
yield (yield this.findChild(groupHeader)).click();
});
}
masterRows() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.browser.findChildren(yield this.root(), "tbody > tr.k-master-row", { waitForChild: false });
});
}
masterRowsCount() {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.masterRows()).length;
});
}
masterRow(index) {
return __awaiter(this, void 0, void 0, function* () {
yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield this.masterRowsCount()) > index; }), { message: `Rows cound is less than ${index}.` });
return (yield this.masterRows())[index - 1];
});
}
focusedElement() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(".k-focus");
});
}
loader() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(Grid.LOADER);
});
}
isEmpty() {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.findChildren(".k-grid-norecords", { waitForChild: false })).length === 1;
});
}
}
exports.Grid = Grid;
Grid.SELECTOR = const_1.SELECTORS.GRID;
Grid.LOADER = ".k-loader-container";
Grid.SORT_ASC_ICON = ".k-svg-i-sort-asc-small";
Grid.SORT_DESC_ICON = ".k-svg-i-sort-desc-small";
Grid.SORT_ORDER = ".k-sort-order";
//# sourceMappingURL=grid.js.map