@o3r/testing
Version:
The module provides testing (e2e, unit test) utilities to help you build your own E2E pipeline integrating visual testing.
49 lines • 2.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.O3rSelectElement = void 0;
var tslib_1 = require("tslib");
var protractor_1 = require("protractor");
var element_1 = require("../element");
/**
* Implementation dedicated to Protractor.
* @deprecated Will be removed in v13, please use Playwright instead
*/
var O3rSelectElement = /** @class */ (function (_super) {
tslib_1.__extends(O3rSelectElement, _super);
function O3rSelectElement(sourceElement) {
return _super.call(this, sourceElement) || this;
}
/** @inheritdoc */
O3rSelectElement.prototype.selectByIndex = function (index, _timeout) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var options;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.click()];
case 1:
_a.sent();
options = this.sourceElement.all(protractor_1.By.tagName('option'));
return [2 /*return*/, new element_1.O3rElement(options.get(index)).click()];
}
});
});
};
/** @inheritdoc */
O3rSelectElement.prototype.selectByValue = function (value, _timeout) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var option;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.click()];
case 1:
_a.sent();
option = this.sourceElement.element(protractor_1.By.css("option[value='".concat(value, "']")));
return [2 /*return*/, new element_1.O3rElement(option).click()];
}
});
});
};
return O3rSelectElement;
}(element_1.O3rElement));
exports.O3rSelectElement = O3rSelectElement;
//# sourceMappingURL=select-element.js.map