| 299 | } |
| 300 | |
| 301 | function writeFailureArtifacts( |
| 302 | context: WebSmokeContext, |
| 303 | step: string, |
| 304 | args: string[], |
| 305 | result: CliJsonResult, |
| 306 | message: string, |
| 307 | assertionDetail?: string, |
| 308 | ): void { |
| 309 | writeFileSync(path.join(context.artifactDir, 'failed-step.txt'), message); |
| 310 | writeFileSync( |
| 311 | path.join(context.artifactDir, 'failed-step.json'), |
| 312 | JSON.stringify( |
| 313 | { step, command: `agent-device ${args.join(' ')}`, assertionDetail, result }, |
| 314 | null, |
| 315 | 2, |
| 316 | ), |
| 317 | ); |
| 318 | writeFileSync( |
| 319 | path.join(context.artifactDir, 'step-history.json'), |
| 320 | JSON.stringify(context.stepHistory, null, 2), |
| 321 | ); |
| 322 | if (context.lastSnapshot) { |
| 323 | writeFileSync( |
| 324 | path.join(context.artifactDir, 'last-snapshot.json'), |
| 325 | JSON.stringify(context.lastSnapshot, null, 2), |
| 326 | ); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | function formatLastSnapshotContext(context: WebSmokeContext): string { |
| 331 | const nodes = context.lastSnapshot?.data?.nodes; |