UNPKG

systelab-components-test

Version:

Widgets to be use in the E2E Tests based in Protractor

77 lines (76 loc) 3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var protractor_1 = require("protractor"); var Widget = /** @class */ (function () { function Widget(elem) { this.elem = elem; } Widget.prototype.getElement = function () { return this.elem; }; Widget.prototype.isPresent = 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.isPresent()]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; Widget.prototype.isDisplayed = 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.isDisplayed()]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; Widget.prototype.isEnabled = 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.isEnabled()]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; Widget.prototype.isDisabled = 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.isEnabled() .then(function (enabled) { return !enabled; })]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; Widget.prototype.byId = function (id) { return this.elem.element(protractor_1.by.id((id))); }; Widget.prototype.byTagName = function (id) { return this.elem.element(protractor_1.by.tagName((id))); }; Widget.prototype.byCSS = function (id) { return this.elem.element(protractor_1.by.css((id))); }; Widget.prototype.waitToBePresent = 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*/, protractor_1.browser.wait(protractor_1.ExpectedConditions.presenceOf(this.elem))]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; return Widget; }()); exports.Widget = Widget;