Skip to content

Commit

Permalink
fix: best-effort support for POMs when highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Sep 15, 2023
1 parent 642c5c8 commit 2114bcd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/debugHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ async function locatorToHighlight(document: vscodeTypes.TextDocument, position:
});
// Translate locator expressions starting with "component." to be starting with "page.".
locatorExpression = locatorExpression?.replace(/^component\s*\./, `page.locator('#root').locator('internal:control=component').`);
// Translate 'this.page', or 'this._page' to 'page' to have best-effort support for POMs.
locatorExpression = locatorExpression?.replace(/this\._?page\s*\./, 'page.');
// Only consider locator expressions starting with "page." because we know the base for them (root).
// Other locators can be relative.
const match = locatorExpression?.match(/^page\s*\.([\s\S]*)/m);
Expand Down

0 comments on commit 2114bcd

Please sign in to comment.