Skip to content

Commit

Permalink
devtools: fix import of devices (#5369)
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinheitzman authored May 6, 2020
1 parent 0ab30c3 commit 43c7f4e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/devtools/src/launcher.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { launch as launchChromeBrowser } from 'chrome-launcher'
import puppeteer from 'puppeteer-core'
import DEVICES from 'puppeteer-core/DeviceDescriptors'
import { devicesMap } from 'puppeteer-core/DeviceDescriptors'
import logger from '@wdio/logger'

import browserFinder from './finder'
Expand All @@ -12,7 +12,7 @@ import {

const log = logger('devtools')

const DEVICE_NAMES = Object.values(DEVICES).map((device) => device.name)
const DEVICE_NAMES = Object.values(devicesMap).map((device) => device.name)

/**
* launches Chrome and returns a Puppeteer browser instance
Expand All @@ -25,7 +25,8 @@ async function launchChrome (capabilities) {
const ignoreDefaultArgs = capabilities.ignoreDefaultArgs

if (typeof mobileEmulation.deviceName === 'string') {
const deviceProperties = Object.values(DEVICES).find(device => device.name === mobileEmulation.deviceName)
const deviceProperties = Object.values(devicesMap).find(device => device.name === mobileEmulation.deviceName)

if (!deviceProperties) {
throw new Error(`Unknown device name "${mobileEmulation.deviceName}", available: ${DEVICE_NAMES.join(', ')}`)
}
Expand Down

0 comments on commit 43c7f4e

Please sign in to comment.