Conversation
src/helpers.ts
Outdated
| args: APIHooksArgs | ||
| ) { | ||
| const promises = callbacks.map(cb => cb(args)); | ||
| return await Promise.all(promises); |
There was a problem hiding this comment.
| return await Promise.all(promises); | |
| return await Promise.allSettled(promises); |
Accounting for unrelated rejections
src/dsl/api-journey.ts
Outdated
| }; | ||
| export type APIJourneyCallback = (options: APIJourneyCallbackOpts) => void; | ||
|
|
||
| export class APIJourney { |
There was a problem hiding this comment.
Ideally I would like us to have a base Journey class that both BrowserJourney and APIJourney extends from and the runner should be a single entity that decides how to run each of them. I am not in favor of having multiple runners.
|
|
||
| export type APIJourneyEndResult = JourneyStartResult & | ||
| APIJourneyResult & { | ||
| browserDelay: number; |
There was a problem hiding this comment.
browserDelay is not appropriate for apijourneys?
| async #startJourney(journey: Journey, options: RunOptions) { | ||
| journey._startTime = monotonicTimeInSeconds(); | ||
| this.#driver = await Gatherer.setupDriver(options); | ||
| this.#driver = await Gatherer.setupDriver(options, journey.type); |
There was a problem hiding this comment.
This feels a bit weird , Maybe a better way would be to check if there are defined browser journeys and then launch the browser context etc based on that.
|
|
||
| export class APIJourney extends Journey { | ||
| #cb: APIJourneyCallback; | ||
| #driver?: Driver | APIDriver; |
There was a problem hiding this comment.
can it have a Driver at any point?
| ); | ||
| } | ||
|
|
||
| async _interceptRequest(method, url, options: any) { |
There was a problem hiding this comment.
This needs some careful review as we need some extensive tests for cached, aborted, intercepted requests etc, Will do a detailed review later on when we have tests etc.
| instance = new BrowserConsole(this.driver); | ||
| break; | ||
|
|
||
| if ('context' in this.driver) { |
There was a problem hiding this comment.
Plugin Manager should be transparent to the underlying journey that was run whether its browser/api based. There will be always a chance when browser/api based journeys coexisting. I would handle these and make them respective plugins transparent.
multi step api runner
can be tested with