feat: add element screenshot action for snapshots (#182)
This commit is contained in:
committed by
GitHub
parent
e7c7709b33
commit
6d4adfe5c6
@@ -176,6 +176,12 @@ export class Context {
|
||||
|
||||
type RunResult = {
|
||||
code: string[];
|
||||
images?: ImageContent[];
|
||||
};
|
||||
|
||||
type ImageContent = {
|
||||
data: string;
|
||||
mimeType: string;
|
||||
};
|
||||
|
||||
class Tab {
|
||||
@@ -243,8 +249,16 @@ ${runResult.code.join('\n')}
|
||||
result.push(this._snapshot.text({ hasFileChooser: !!this._fileChooser }));
|
||||
}
|
||||
|
||||
const images = runResult.images?.map(image => {
|
||||
return {
|
||||
type: 'image' as 'image',
|
||||
data: image.data,
|
||||
mimeType: image.mimeType,
|
||||
};
|
||||
}) ?? [];
|
||||
|
||||
return {
|
||||
content: [{
|
||||
content: [...images, {
|
||||
type: 'text',
|
||||
text: result.join('\n'),
|
||||
}],
|
||||
|
||||
Reference in New Issue
Block a user