webdriverio: browser.enablePerformanceAudits is not a function
This issue is breaking our nightly performance and build step tests, any help to resolve would be greatly appreciated:
Using dev tools back end and dev-tools service performance methods no longer are working.
I think it may be a puppeteer update that is breaking the service?
@wdio/devtools-service: Couldn’t connect to chrome: Error: Protocol error (Page.setInterceptFileChooserDialog): Cannot enable file chooser interception
Environment (please complete the following information):
- WebdriverIO version: [5.18.6]
- Mode: [Standalone mode or WDIO Testrunner] Testrunner
- If WDIO Testrunner, running sync/async: [e.g. sync/async] sync
- Node.js version: [e.g. 8.11.2] 12.3
- NPM version: [e.g. 5.8.0]
- Browser name and version: [e.g. Chrome 68] chrome 79
- Platform name and version: [e.g. Windows 10] OSX or Linux
- Additional wdio packages used (if applicable): “@wdio/cli”: “^5.18.6”, “@wdio/devtools-service”: “^5.16.16”, “@wdio/local-runner”: “^5.18.6”, “@wdio/logger”: “^5.16.10”, “@wdio/mocha-framework”: “^5.18.6”, “@wdio/sync”: “^5.18.6”, “chai”: “^4.2.0”, “commander”: “^4.1.0”, “devtools”: “^5.18.6”, “dogapi”: “^2.8.3”, “fs-extra”: “^8.1.0”, “lodash”: “^4.17.15”, “wdio-json-reporter”: “^1.3.1”, “webdriverio”: “^5.18.6” Config of WebdriverIO An example of how you configured WebdriverIO config
Describe the bug A clear and concise description of what the bug is.
Can no longer enable perfromance audits
To Reproduce Steps to reproduce the behavior: add devtools to services array in config: services: [‘devtools’]; automationProtocol: ‘devtools’;
run the sample test
describe('JSON.org page', () => {
before(() => {
browser.enablePerformanceAudits()
})
it('should load within performance budget', () => {
browser.url('http://json.org')
let metrics = browser.getMetrics()
assert.ok(metrics.speedIndex < 1500) // check that speedIndex is below 1.5ms
let score = browser.getPerformanceScore() // get Lighthouse Performance score
assert.ok(score >= .99) // Lighthouse Performance score is at 99% or higher
$('=Esperanto').click()
metrics = browser.getMetrics()
assert.ok(metrics.speedIndex < 1500)
score = browser.getPerformanceScore()
assert.ok(score >= .99)
})
after(() => {
browser.disablePerformanceAudits()
})
})
Expected behavior
Performance audit should complete and succeed as per the sample test in the service ^ Log
2020-01-30T00:46:07.289Z INFO @wdio/local-runner: Run worker command: run
2020-01-30T00:46:07.389Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
2020-01-30T00:46:08.013Z DEBUG @wdio/local-runner:utils: init remote session
2020-01-30T00:46:08.017Z INFO webdriverio: Initiate new session using the devtools protocol
2020-01-30T00:46:08.076Z INFO devtools: Launch Chrome with flags: --disable-extensions --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-sync --metrics-recording-only --disable-default-apps --mute-audio --no-first-run --disable-hang-monitor --disable-prompt-on-repost --disable-client-side-phishing-detection --password-store=basic --use-mock-keychain --disable-component-extensions-with-background-pages --disable-breakpad --disable-dev-shm-usage --disable-ipc-flooding-protection --disable-renderer-backgrounding --enable-features=NetworkService,NetworkServiceInProcess --disable-features=site-per-process,TranslateUI,BlinkGenPropertyTrees --window-position=0,0 --window-size=1200,900 --incognito
2020-01-30T00:46:09.160Z INFO devtools: Connect Puppeteer with browser on port 59666
2020-01-30T00:46:10.119Z INFO @wdio/devtools-service:DevToolsDriver: Connect to http://localhost:59666
2020-01-30T00:46:10.137Z ERROR @wdio/devtools-service: Couldn't connect to chrome: Error: Protocol error (Page.setInterceptFileChooserDialog): Cannot enable file chooser interception because other protocol client already intercepts it
at Promise (/Users/pmerwin/Projects/pagehealth/lib-page-health-nodejs/node_modules/puppeteer-core/lib/Connection.js:183:56)
at new Promise (<anonymous>)
at CDPSession.send (/Users/pmerwin/Projects/pagehealth/lib-page-health-nodejs/node_modules/puppeteer-core/lib/Connection.js:182:12)
at Page._initialize (/Users/pmerwin/Projects/pagehealth/lib-page-health-nodejs/node_modules/puppeteer-core/lib/Page.js:138:20)
at Function.create (/Users/pmerwin/Projects/pagehealth/lib-page-health-nodejs/node_modules/puppeteer-core/lib/Page.js:47:16)
at _pagePromise._sessionFactory.then.client (/Users/pmerwin/Projects/pagehealth/lib-page-health-nodejs/node_modules/puppeteer-core/lib/Target.js:74:32)
at process._tickCallback (internal/process/next_tick.js:68:7)
-- ASYNC --
at Target.<anonymous> (/Users/pmerwin/Projects/pagehealth/lib-page-health-nodejs/node_modules/puppeteer-core/lib/helper.js:111:15)
at DevToolsDriver.getActivePage (/Users/pmerwin/Projects/pagehealth/lib-page-health-nodejs/node_modules/@wdio/devtools-service/build/driver.js:49:30)
at process._tickCallback (internal/process/next_tick.js:68:7)
2020-01-30T00:46:10.885Z INFO devtools: COMMAND deleteSession()
2020-01-30T00:46:10.889Z INFO devtools: RESULT null
2020-01-30T00:46:10.901Z DEBUG @wdio/devtools-service:CommandHandler: cdp event: Inspector.detached with params {"reason":"Render process gone."}
2020-01-30T00:46:10.901Z DEBUG @wdio/devtools-service:CommandHandler: cdp event: Inspector.detached with params {"reason":"target_closed"}
2020-01-30T00:46:06.330Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
2020-01-30T00:46:06.880Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-01-30T00:46:06.883Z INFO @wdio/local-runner: Start worker 0-0 with arg: -s,./lib/page_health/specs/enable.js,-b,chrome,https://www.qanuggets.com,-r,0
2020-01-30T00:46:11.029Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
2020-01-30T00:46:11.031Z INFO @wdio/cli:launcher: Run onComplete hook
2020-01-30T00:46:11.058Z INFO @wdio/local-runner: Shutting down spawned worker
2020-01-30T00:46:11.309Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (13 by maintainers)
So I installed version 2.0.0 and locked it in our package.json, and that seemed to do the trick for me. @erwinheitzman