@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 • 733 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProtractorErrorHandler = void 0;
class ProtractorErrorHandler {
handlers;
constructor(handlers = new Map()) {
this.handlers = handlers;
}
async executeIfHandled(error, action) {
if (!this.handlers.has(error.name)) {
throw error;
}
await this.handlers.get(error.name)(error);
return action();
}
setHandlerFor(errorType, handler) {
this.handlers.set(errorType, handler);
}
unsetHandlerFor(errorType) {
this.handlers.delete(errorType);
}
}
exports.ProtractorErrorHandler = ProtractorErrorHandler;
//# sourceMappingURL=ProtractorErrorHandler.js.map