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

[BUG] VSCode extension does not update testInfo object #19746

Closed
lucasbit opened this issue Dec 28, 2022 · 3 comments
Closed

[BUG] VSCode extension does not update testInfo object #19746

lucasbit opened this issue Dec 28, 2022 · 3 comments
Assignees
Labels

Comments

@lucasbit
Copy link

Context:

  • Playwright Version: 1.28.1
  • Operating System: [e.g. Windows 11
  • Node.js version: 18.12.1
  • Visual Studio Code version: 1.74.2
  • Playwright for VSCode extension version: 1.0.3
  • Browser: Chromium
  • Extra:

Code Snippet
image
image
image

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:

Describe the bug
I'm trying to implement visual comparison, but I have a lot of differences between headfull and headless testing with Chromium ( 12912 pixels (ratio 0.04 of all image pixels) are different) or perhaps that is not a lot off difference?
image

It works fine when testing only in headless mode. So my idea is that, I can read value of testInfo object and run visual checks only when browser is headless. But that solution does not work when running tests from the VSCode extension. And that a big issue as then I can't use your amazing locator selector and other cool features from VSCode extension.

Or perhaps there is another value in testInfo object I can check out if test run is triggered from terminal vs VSCode extension?

Add any other details about the problem here.

@dgozman
Copy link
Contributor

dgozman commented Dec 28, 2022

@lucasbit Instead of looking into testInfo.project.use.headless that reflects your config file and not the final value, examine the headless fixture:

test('my test', async ({ page, headless }) => {
  console.log(headless);
});

Let me know if that helps.

@lucasbit
Copy link
Author

@dgozman, thanks for quick replay, sadly your suggestion didn't work. I will paste my code snippet in case I'm doing something wrong(doubt it):
image
image

@dgozman dgozman self-assigned this Jan 3, 2023
@dgozman dgozman added v1.30 and removed triaging labels Jan 3, 2023
@dgozman
Copy link
Contributor

dgozman commented Jan 4, 2023

I can repro this.

Investigation notes: "reuse browser mode" in PlaywrightConnection forces headed browser, and this is not aligned with what the client requests, thus the discrepancy.

Proposed solution: pass --headed from the extension when running tests and make the client control whether the browser is headless. This will make "Show browser" checkbox not work for test files that explicitly call test.use({ headless: true }).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants