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

Lighthouse Reports Showing Mobile Layout Despite Desktop Configuration File #100

Open
iamAfrontendDev opened this issue Aug 11, 2024 · 7 comments

Comments

@iamAfrontendDev
Copy link

Lighthouse by defaults to the mobile layout. I am passing the lighthouseDesktopConfig file, located at lighthouse/core/config/lr-desktop-config from the node_modules to configure the tests for the desktop layout. However, the reports are still reflecting the mobile layout. Even with the desktop configuration being passed.
Screenshot 2024-08-10 232130
Screenshot 2024-08-10 232432
Screenshot 2024-08-10 232504
on file specified, the issue persists.

@qakos
Copy link

qakos commented Oct 17, 2024

and I have the same situation

@qakos
Copy link

qakos commented Oct 17, 2024

is any solution to solve this problem?

@vito-techietalent
Copy link

@qakos I've used the following opts in a similar scenario and seems to work:

await playAudit({
  opts: {
    formFactor: "desktop",
    screenEmulation: { disabled: true },
  },

@qakos
Copy link

qakos commented Oct 18, 2024

@vito-techietalent thank you for your solution. For now in report showing tablet version of page, but still not desktop. Which version of playwright-lighthouse do you use?

@qakos
Copy link

qakos commented Oct 18, 2024

I added 'opts' settings in my code. As I understand, for lighthouse my page opened in a viewport width less than 1024px, despite the fact that in the playwright settings of the project, the viewport 1920x1080 is specified. But in playwright ui-mode page opened with viewport as I need.

@vito-techietalent
Copy link

@qakos
I'm using latest: 4.0.0

Regarding screen size, on the chrome.launch({ .... line you may have to add the args to define the screen size, since it's probably being taken from there instead of the config.
Now, I imagine, it's going to the default, so try adding:

await playwright.chromium.launch({
  args: ["--remote-debugging-port=9222", "--window-size=1920,1080"],
});

Source https://stackoverflow.com/questions/77278023/how-to-maximize-the-window-size-in-playwright

@qakos
Copy link

qakos commented Oct 21, 2024

@vito-techietalent Thank you! This solution helped me to solve my problem!

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

No branches or pull requests

3 participants