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

devtools: fix import of devices #5369

Merged
merged 2 commits into from May 6, 2020
Merged

devtools: fix import of devices #5369

merged 2 commits into from May 6, 2020

Conversation

erwinheitzman
Copy link
Member

Proposed changes

Fixes #5368

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Reviewers: @webdriverio/project-committers

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

I am curious if one of the test should have failed in cases this import fails.

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Ahh, there we go. I guess the actual problem was that Puppeteer updated with a breaking change which users picked up automatically.

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label May 6, 2020
@christian-bromann christian-bromann merged commit 43c7f4e into webdriverio:master May 6, 2020
@erwinheitzman erwinheitzman deleted the devtools-fix-import-devices branch May 7, 2020 07:33
contolini added a commit to cfpb/design-system that referenced this pull request May 11, 2020
contolini added a commit to cfpb/design-system that referenced this pull request May 11, 2020
contolini added a commit to cfpb/design-system that referenced this pull request May 11, 2020
contolini added a commit to cfpb/design-system that referenced this pull request May 11, 2020
contolini added a commit to cfpb/design-system that referenced this pull request May 11, 2020
@vitalyiegorov
Copy link

Same errors occurs with devtools: 6.1.11 and puppeteer-core: 3.0.2 as it has no exported field devicesMap, now everything is exported directly from var _DeviceDescriptors = require("puppeteer-core/DeviceDescriptors");

To make devtools launcher.js work this npm script fix can be applied:
"fix:devtools": "sed -e \"s/_DeviceDescriptors.devicesMap/_DeviceDescriptors/g\" -i.bak ./node_modules/devtools/build/launcher.js",

@lg-kialo
Copy link

Can confirm what @vitalyiegorov noted, this change breaks our test suite

@christian-bromann
Copy link
Member

@vitalyiegorov @lg-kialo I can't reproduce the issue. Would you mind to clean up node_modules and package-lock.json and re-install all your capabilities? I just ran a fresh install with the devtools package and had no issues running this script:

const DevTools = require('devtools').default

;(async() => {
    const client = await DevTools.newSession({
        capabilities: { browserName: 'chrome' }
    })

    await client.navigateTo('https://www.google.com/ncr')
    console.log(await client.getTitle())

    await client.deleteSession()
})()

@lg-kialo
Copy link

lg-kialo commented May 19, 2020

I did that and it fixed it, not sure what the issue was. Could be that puppeteer was on an older version. Thanks!

@vitalyiegorov
Copy link

vitalyiegorov commented May 19, 2020

@christian-bromann Tried, but the issue is still here,

I have investigated the versions of the packages and it resolves to puppeteer-core:3.0.2 which exports the whole object from the module.

If you will take a look at the master version of puppeteer-core it has the same behavior, so I guess you should update the import of devicesMap to
import * as devicesMap from 'puppeteer-core/DeviceDescriptors' and it will fix the issue

@christian-bromann
Copy link
Member

@vitalyiegorov please update your packages, your puppeteer-core version should be at 3.1.0.

@christian-bromann christian-bromann added backport-requested PRs with this label are considered to be applied to the last maintained version and removed backport-requested PRs with this label are considered to be applied to the last maintained version labels May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Bug Fix 🐛 PRs that contain bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update of puppeteer-core breaks the launcher
4 participants