Skip to content

Commit 3775c2d

Browse files
authored
feat(web-integration): dump pageContext for aiAssert (#835)
* feat(web-integration): add pageContext for aiAssert * fix(web-integration): screenshot name
1 parent 50203ed commit 3775c2d

File tree

1 file changed

+15
-3
lines changed
  • packages/web-integration/src/common

1 file changed

+15
-3
lines changed

packages/web-integration/src/common/tasks.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export class PageTaskExecutor {
234234
type: 'screenshot',
235235
ts: shotTime,
236236
screenshot: pageContext.screenshotBase64,
237-
timing: 'before locate',
237+
timing: 'before Insight',
238238
};
239239
task.recorder = [recordItem];
240240

@@ -348,7 +348,18 @@ export class PageTaskExecutor {
348348
insightDump = dump;
349349
};
350350
this.insight.onceDumpUpdatedFn = dumpCollector;
351-
const startTime = Date.now();
351+
const shotTime = Date.now();
352+
const pageContext = await this.insight.contextRetrieverFn('assert');
353+
task.pageContext = pageContext;
354+
355+
const recordItem: ExecutionRecorderItem = {
356+
type: 'screenshot',
357+
ts: shotTime,
358+
screenshot: pageContext.screenshotBase64,
359+
timing: 'before Insight',
360+
};
361+
task.recorder = [recordItem];
362+
352363
const assertion = await this.insight.assert(
353364
assertPlan.param.assertion,
354365
);
@@ -369,6 +380,7 @@ export class PageTaskExecutor {
369380

370381
return {
371382
output: assertion,
383+
pageContext,
372384
log: {
373385
dump: insightDump,
374386
},
@@ -673,7 +685,7 @@ export class PageTaskExecutor {
673685
type: 'screenshot',
674686
ts: shotTime,
675687
screenshot: pageContext.screenshotBase64,
676-
timing: 'before planning',
688+
timing: 'before Planning',
677689
};
678690

679691
executorContext.task.recorder = [recordItem];

0 commit comments

Comments
 (0)