Skip to content

Commit

Permalink
fix(core): update creating jspath from history
Browse files Browse the repository at this point in the history
  • Loading branch information
blakebyrnes committed Mar 17, 2022
1 parent 0de6846 commit eeed064
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions core/lib/CommandFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export default class CommandFormatter {
command.resultNodeIds = result.nodePointer.iterableItems.map(x => x.id);
}
}
} else if (meta.resultType === 'Array' && result.length) {
if (result[0].nodePointerId) {
command.resultNodeIds = result.map(x => x.nodePointerId).filter(Boolean);
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion core/lib/JsPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ export class JsPath {
const path: IJsPath = [];
const history = this.getJsPathHistoryForNode(nodePointer.id);
for (const entry of history) {
path.push(...entry.jsPath);
const jsPath = entry.jsPath;
if (typeof jsPath[0] === 'number') {
path.push(...jsPath.slice(1))
} else {
path.push(...jsPath);
}
}
return path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default async function setScreensize(
if (viewport.width === 0 || viewport.height === 0) {
promises.push(
devtools.send('Page.getLayoutMetrics').then(x => {
// @ts-expect-error - chrome 98 add correctly sized cssVisualViewport.
const visualViewport: Protocol.Page.VisualViewport = x.cssVisualViewport ?? x.visualViewport;
viewport.height = visualViewport.clientHeight;
viewport.width = visualViewport.clientWidth;
Expand Down

0 comments on commit eeed064

Please sign in to comment.