Skip to content

Commit

Permalink
correct return signature of afterSpec; add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cacieprins committed May 23, 2024
1 parent 96d0519 commit 8378e9d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/server/lib/cloud/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ export default {
},

updateInstanceArtifacts (options: UpdateInstanceArtifactsOptions, body: UpdateInstanceArtifactsPayload) {
debug('PUT %s %O', recordRoutes.instanceArtifacts(options.instanceId), body)

return retryWithBackoff((attemptIndex) => {
return rp.put({
url: recordRoutes.instanceArtifacts(options.instanceId),
Expand Down
5 changes: 4 additions & 1 deletion packages/server/lib/cloud/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export class ProtocolManager implements ProtocolManagerShape {

debug({ startTime })
try {
const durations = await this.invokeAsync('afterSpec', { isEssential: true })
const ret = await this.invokeAsync('afterSpec', { isEssential: true })
const durations = ret?.durations

const afterSpecTotal = (performance.now() + performance.timeOrigin) - startTime

Expand All @@ -187,6 +188,8 @@ export class ProtocolManager implements ProtocolManagerShape {
...(durations ? durations : {}),
}

debug('Persisting after spec durations in state: %O', this._afterSpecDurations)

return undefined
} catch (e) {
// rethrow; this is try/catch so we can 'finally' ascertain duration
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface AppCaptureProtocolCommon {
beforeTest(test: Record<string, any>): Promise<void>
preAfterTest(test: Record<string, any>, options: Record<string, any>): Promise<void>
afterTest(test: Record<string, any>): Promise<void>
afterSpec (): Promise<AfterSpecDurations | undefined>
afterSpec (): Promise<{ durations: AfterSpecDurations } | undefined>
connectToBrowser (cdpClient: CDPClient): Promise<void>
pageLoading (input: any): void
resetTest (testId: string): void
Expand Down

0 comments on commit 8378e9d

Please sign in to comment.