UNPKG

@serenity-js/protractor

Version:

Adapter that integrates @serenity-js/web with Protractor, enabling Serenity/JS reporting and using the Screenplay Pattern to write end-to-end test scenarios

24 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unpromisedWebElement = unpromisedWebElement; /** * Under [certain conditions](https://github.com/angular/protractor/blob/4bc80d1a459542d883ea9200e4e1f48d265d0fda/lib/element.ts#L797), * Protractor `WebElement` implements a `then()` method, and under others it doesn't. * * This design makes it look like a "thenable" in some scenarios, but like a non-thenable in others. * * This function wraps `WebElement` in a `Proxy` object that ensures the wrapped element is always non-thenable. * * @param promiseLike */ function unpromisedWebElement(promiseLike) { return new Proxy(promiseLike, { has: (target, property) => property !== 'then', ownKeys: (target) => Reflect.ownKeys(target) .filter(property => property !== 'then'), get: (target, property, receiver) => (property in receiver) ? target[property] : undefined, }); } //# sourceMappingURL=unpromisedWebElement.js.map