Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: best-effort support for POMs when highlighting #378

Merged
merged 3 commits into from
Sep 20, 2023
Merged

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Sep 15, 2023

Fixes microsoft/playwright#27036

Adding a test was more involved than I thought. We already have some logic in place to connect to an existing "ReusableBrowser" but the issue is that waitForPage calls _newContextForReuse which will reset it, and I want to keep the old content.

export async function connectToSharedBrowser(vscode: VSCode) {
await expect.poll(() => vscode.extensions[0].browserServerWSForTest()).toBeTruthy();
const wsEndpoint = vscode.extensions[0].browserServerWSForTest();
return await chromium.connect(wsEndpoint, {
headers: { 'x-playwright-reuse-context': '1' }
});
}
export async function waitForPage(browser: Browser) {
let pages: Page[] = [];
await expect.poll(async () => {
const context = await (browser as any)._newContextForReuse();
pages = context.pages();
return pages.length;
}).toBeTruthy();
return pages[0];
}

I went a different route over CDP instead.

Copy link
Contributor

@dgozman dgozman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test for this.

export class DebugHighlight {
private _debugSessions = new Map<string, vscodeTypes.DebugSession>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: reason for moving it out was that the tests were not isolated before, the _debugSession struct leaked.

@mxschmitt mxschmitt merged commit cc4f075 into main Sep 20, 2023
6 checks passed
@mxschmitt mxschmitt deleted the highlight-poms branch September 20, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elements are not highlighted when using this.page [BUG]
2 participants