Skip to content

Commit bb1a270

Browse files
committed
feat(replay): show nodes running execJsPath
1 parent 5490317 commit bb1a270

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

core/lib/CommandFormatter.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ICommandMeta from '@secret-agent/core-interfaces/ICommandMeta';
2-
import { IInteractionGroup } from '@secret-agent/core-interfaces/IInteractions';
2+
import { IInteractionGroup, IInteractionGroups } from '@secret-agent/core-interfaces/IInteractions';
33
import { getKeyboardKey } from '@secret-agent/core-interfaces/IKeyboardLayoutUS';
44
import getAttachedStateFnName from '@secret-agent/core-interfaces/getAttachedStateFnName';
55
import ICommandWithResult from '../interfaces/ICommandWithResult';
@@ -127,6 +127,21 @@ export default class CommandFormatter {
127127
}
128128
}
129129

130+
if (!command.resultNodeIds && command.name === 'execJsPath') {
131+
const [jsPath] = JSON.parse(command.args);
132+
if (typeof jsPath[0] === 'number') command.resultNodeIds = [jsPath[0]];
133+
}
134+
135+
if (!command.resultNodeIds && command.name === 'interact') {
136+
const args = JSON.parse(command.args);
137+
const mouseInteraction = args.find((x: IInteractionGroup) => {
138+
return x.length && x[0].mousePosition && x[0].mousePosition.length === 1;
139+
});
140+
if (mouseInteraction) {
141+
command.resultNodeIds = mouseInteraction.mousePosition;
142+
}
143+
}
144+
130145
// we have shell objects occasionally coming back. hide from ui
131146
if (meta.args?.includes(getAttachedStateFnName)) {
132147
command.result = undefined;

0 commit comments

Comments
 (0)