UNPKG

systelab-components-test

Version:

Widgets to be use in the E2E Tests based in Protractor

78 lines (77 loc) 3.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var widget_1 = require("./widget"); var protractor_1 = require("protractor"); var ComboBox = /** @class */ (function (_super) { tslib_1.__extends(ComboBox, _super); function ComboBox() { return _super !== null && _super.apply(this, arguments) || this; } ComboBox.prototype.click = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.elem.click()]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; ComboBox.prototype.getOptions = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var content, rows, numberOfItems, i, text; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: content = []; rows = this.elem.all(protractor_1.by.css('.ag-cell-value')); return [4 /*yield*/, rows.count()]; case 1: numberOfItems = _a.sent(); i = 0; _a.label = 2; case 2: if (!(i < numberOfItems)) return [3 /*break*/, 5]; return [4 /*yield*/, rows.get(i).getText()]; case 3: text = _a.sent(); content.push(text); _a.label = 4; case 4: i++; return [3 /*break*/, 2]; case 5: return [2 /*return*/, content]; } }); }); }; ComboBox.prototype.selectOptionByNumber = function (i) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.elem.all(protractor_1.by.css("[role='row'][row-index='" + i + "']")).get(1).click()]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; ComboBox.prototype.selectOptionByText = function (text) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.elem.all(protractor_1.by.cssContainingText('.ag-cell-value', text)).click()]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; return ComboBox; }(widget_1.Widget)); exports.ComboBox = ComboBox;