webdriverio/webdriverio

[🐛 Bug]: browser.enablePerformanceAudits is not a function node18 wdio 8.5.7

Open

#9,922 opened on 2023年3月9日

GitHub で見る
 (19 comments) (1 reaction) (0 assignees)JavaScript (6,029 stars) (1,793 forks)batch import
Bug 🐛Needs Investigationhelp wanted

説明

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

18.15.0

Mode

WDIO Testrunner

Which capabilities are you using?

capabilities: [
        {
            browserName: "chrome",
            maxInstances: 1,
            "goog:chromeOptions": {
                mobileEmulation: {
                    deviceName: "iPhone X",
                },
                args: ["ignore-certificate-errors", "Start-fullscreen"],
            },
        },
    ],

What happened?

Devtools fail when I run the test:

I simply call it in the before =>

describe('test perf', async () => {
    before(async function () {
        browser.enablePerformanceAudits()
    })

And Here is the Error:

browser.enablePerformanceAudits is not a function

What is your expected behavior?

No response

How to reproduce the bug.

Specs file:

describe('test perf', async () => {
    before(async function () {
        await browser.enablePerformanceAudits()
    })

    it('should do something', async function () {
        console.log('test devtools')
    })


    after(() => {
        browser.disablePerformanceAudits()
    })
})

run: npx wdio run ./wdio.conf.ts

Relevant log output

[0-0] 2023-03-09T18:02:18.202Z ERROR @wdio/utils:shim: TypeError: Failed to fetch browser webSocket URL from http://localhost:62805/json/version: fetch failed
[0-0]     at Object.fetch (node:internal/deps/undici/undici:11413:11)
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[0-0]     at async getWSEndpoint (file:///Users/e.frelon/xxxxxxxx/node_modules/puppeteer-core/src/common/BrowserConnector.ts:143:20)
[0-0]     at async _connectToCDPBrowser (file:///Users/e.frelon/xxxxxxxx/node_modules/puppeteer-core/src/common/BrowserConnector.ts:107:27)
[0-0]     at async Browser.getPuppeteer (file:///Users/e.frelon/xxxxxxxx/node_modules/webdriverio/build/commands/browser/getPuppeteer.js:82:26)
[0-0]     at async Browser.wrapCommandFn (file:///Users/e.frelon/xxxxxxxx/node_modules/@wdio/utils/build/shim.js:72:29)
[0-0]     at async DevToolsService._setupHandler (file:///Users/e.frelon/xxxxxxxx/node_modules/@wdio/devtools-service/build/index.js:174:27)
[0-0]     at async Promise.all (index 0)
[0-0]     at async executeHooksWithArgsShim (file:///Users/e.frelon/xxxxxxxx/node_modules/@wdio/utils/build/shim.js:50:20)
[0-0]     at async Runner.run (file:///Users/e.frelon/xxxxxxxx/node_modules/@wdio/runner/build/index.js:88:9)
[0-0] TypeError in "test perf."before all" hook for "should do something""
TypeError: browser.enablePerformanceAudits is not a function
    at Context.<anonymous> (/Users/e.frelon/xxxxx/specs/xxxxxxxx.ts:35:23)
[0-0] FAILED in chrome - file:///specs/xxxxxxxx.ts

 "spec" Reporter:
------------------------------------------------------------------
[chrome 111.0.5563.64 mac os x #0-0] Running: chrome (v111.0.5563.64) on mac os x
[chrome 111.0.5563.64 mac os x #0-0] Session ID: 1a16c931022dab34fe1bc28ced909a7c
[chrome 111.0.5563.64 mac os x #0-0]
[chrome 111.0.5563.64 mac os x #0-0] » /specs/xxxxxxxx.ts
[chrome 111.0.5563.64 mac os x #0-0] test perf
[chrome 111.0.5563.64 mac os x #0-0]    ✖ "before all" hook for test perf
[chrome 111.0.5563.64 mac os x #0-0]
[chrome 111.0.5563.64 mac os x #0-0] 1 failing (65ms)
[chrome 111.0.5563.64 mac os x #0-0]
[chrome 111.0.5563.64 mac os x #0-0] 1) test perf "before all" hook for test perf
[chrome 111.0.5563.64 mac os x #0-0] browser.enablePerformanceAudits is not a function
[chrome 111.0.5563.64 mac os x #0-0] TypeError: browser.enablePerformanceAudits is not a function
[chrome 111.0.5563.64 mac os x #0-0]     at Context.<anonymous> (/Users/e.frelon/xxxxxxx/specs/xxxxxx.ts:35:23)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

コントリビューターガイド