I am attempting to use docker and devtools service together to evaluate performance of a page. Running locally. I am running into issues when I include ‘devtools’ as a service along with docker service, without ‘devtools’ the test just runs fine. Below is the error I see. What am I missing?. Seems like same issue mentioned here by prathameshnyt -> #3744 (comment)
Error without the mention of chrome debuggerAddress
2020-03-16T22:29:25.397Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
2020-03-16T22:29:25.405Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
2020-03-16T22:29:25.702Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-03-16T22:29:25.703Z DEBUG wdio-docker-service: Docker command: docker run --cidfile /Users/phanagodimath/Desktop/Projects/Martech-Performance/selenium_standalone_chrome.cid --rm -p 4444:4444 --shm-size 2g selenium/standalone-chrome
2020-03-16T22:29:25.710Z WARN wdio-docker-service: Connecting dockerEventsListener: 6138
2020-03-16T22:29:25.712Z INFO wdio-docker-service: Shutting down running container
2020-03-16T22:29:26.074Z INFO wdio-docker-service: Cleaning up CID files
2020-03-16T22:29:26.127Z INFO wdio-docker-service: Launching docker image 'selenium/standalone-chrome'
2020-03-16T22:29:26.471Z INFO wdio-docker-service: Container started: {
"args": "",
"image": "selenium/standalone-chrome",
"timeStamp": "2020-03-16T22:29:26.480Z",
"type": "container.start",
"status": "start",
"detail": {
"id": "3c9d234b53b5e9ff0997826cff84b8dd5b378595ea1da0363f205f56dbc94a0d",
"scope": "local",
"actor": {
"ID": "3c9d234b53b5e9ff0997826cff84b8dd5b378595ea1da0363f205f56dbc94a0d",
"Attributes": {
"authors": "SeleniumHQ",
"image": "selenium/standalone-chrome",
"name": "musing_elbakyan"
}
}
}
}
2020-03-16T22:29:26.587Z DEBUG wdio-docker-service: 2020-03-16 22:29:26,597 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2020-03-16T22:29:26.588Z DEBUG wdio-docker-service: 2020-03-16 22:29:26,598 INFO supervisord started with pid 7
2020-03-16T22:29:27.592Z DEBUG wdio-docker-service: 2020-03-16 22:29:27,603 INFO spawned: 'xvfb' with pid 10
2020-03-16T22:29:27.594Z DEBUG wdio-docker-service: 2020-03-16 22:29:27,605 INFO spawned: 'selenium-standalone' with pid 11
2020-03-16T22:29:28.066Z DEBUG wdio-docker-service: 22:29:28.075 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
2020-03-16 22:29:28,078 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16 22:29:28,078 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16T22:29:28.222Z DEBUG wdio-docker-service: 22:29:28.234 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-03-16T22:29:28.322Z DEBUG wdio-docker-service: 2020-03-16 22:29:28.327:INFO::main: Logging initialized @710ms to org.seleniumhq.jetty9.util.log.StdErrLog
2020-03-16T22:29:28.735Z DEBUG wdio-docker-service: 22:29:28.745 INFO [WebDriverServlet.] - Initialising WebDriverServlet
2020-03-16T22:29:28.896Z DEBUG wdio-docker-service: 22:29:28.908 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
2020-03-16T22:29:29.249Z INFO wdio-docker-service: Docker container is ready
2020-03-16T22:29:29.251Z INFO @wdio/local-runner: Start worker 0-0 with arg: config/wdio.conf.docker.js
[0-0] 2020-03-16T22:29:29.475Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - /test/specs/basic_docker.js
[0-0] 2020-03-16T22:29:29.553Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
[0-0] 2020-03-16T22:29:29.558Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
[0-0] 2020-03-16T22:29:29.840Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-03-16T22:29:29.841Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-03-16T22:29:29.843Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session
[0-0] 2020-03-16T22:29:29.843Z INFO webdriver: DATA {
capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' }
}
2020-03-16T22:29:29.989Z DEBUG wdio-docker-service: 22:29:30.002 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome"
}
2020-03-16T22:29:29.992Z DEBUG wdio-docker-service: 22:29:30.005 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
2020-03-16T22:29:30.032Z DEBUG wdio-docker-service: Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 7411
2020-03-16T22:29:30.037Z DEBUG wdio-docker-service: Only lo[c1a5l8 4c3o9n7n7e7c0t.i0o4n5s] [aSrEeV EaRlEl]o:w ebdi.n
Pdl(e)a sfea iplreodt:e cCta npnoortts used by C harsosmiegDnr irveerq uaensdt erde laadtderde stse s(t9 9f)r
2020-03-16T22:29:30.038Z DEBUG wdio-docker-service: ameworks to prevent access by malicious code.
2020-03-16T22:29:30.855Z DEBUG wdio-docker-service: 22:29:30.870 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
2020-03-16T22:29:30.919Z DEBUG wdio-docker-service: 22:29:30.934 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 29c930f81189207ce9af3ddeadcf1107 (org.openqa.selenium.chrome.ChromeDriverService)
[0-0] (node:6155) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:34783
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1126:14)
[0-0] (node:6155) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6155) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^Z
[5]+ Stopped npm run test:docker
Error running with chrome debuggerAddress
2020-03-16T22:05:09.898Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
2020-03-16T22:05:09.903Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
2020-03-16T22:05:10.176Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-03-16T22:05:10.177Z DEBUG wdio-docker-service: Docker command: docker run --cidfile /Users/phanagodimath/Desktop/Projects/Martech-Performance/selenium_standalone_chrome.cid --rm -p 4444:4444 -p 9222:9222 --shm-size 2g --hostname selenium selenium/standalone-chrome
2020-03-16T22:05:10.182Z WARN wdio-docker-service: Connecting dockerEventsListener: 5857
2020-03-16T22:05:10.185Z INFO wdio-docker-service: Shutting down running container
2020-03-16T22:05:10.529Z INFO wdio-docker-service: Cleaning up CID files
2020-03-16T22:05:10.581Z INFO wdio-docker-service: Launching docker image 'selenium/standalone-chrome'
2020-03-16T22:05:10.979Z INFO wdio-docker-service: Container started: {
"args": "",
"image": "selenium/standalone-chrome",
"timeStamp": "2020-03-16T22:05:11.004Z",
"type": "container.start",
"status": "start",
"detail": {
"id": "ec657e32cce91f66e021b65a52364b800b5ff2fbccbaad281b97cf9be7924ca3",
"scope": "local",
"actor": {
"ID": "ec657e32cce91f66e021b65a52364b800b5ff2fbccbaad281b97cf9be7924ca3",
"Attributes": {
"authors": "SeleniumHQ",
"image": "selenium/standalone-chrome",
"name": "focused_dirac"
}
}
}
}
2020-03-16T22:05:11.084Z DEBUG wdio-docker-service: 2020-03-16 22:05:11,109 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2020-03-16T22:05:11.085Z DEBUG wdio-docker-service: 2020-03-16 22:05:11,110 INFO supervisord started with pid 7
2020-03-16T22:05:12.095Z DEBUG wdio-docker-service: 2020-03-16 22:05:12,118 INFO spawned: 'xvfb' with pid 10
2020-03-16 22:05:12,120 INFO spawned: 'selenium-standalone' with pid 11
2020-03-16T22:05:12.548Z DEBUG wdio-docker-service: 22:05:12.572 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
2020-03-16T22:05:12.548Z DEBUG wdio-docker-service: 2020-03-16 22:05:12,575 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16 22:05:12,575 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-03-16T22:05:12.703Z DEBUG wdio-docker-service: 22:05:12.730 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-03-16T22:05:12.805Z DEBUG wdio-docker-service: 2020-03-16 22:05:12.826:INFO::main: Logging initialized @694ms to org.seleniumhq.jetty9.util.log.StdErrLog
2020-03-16T22:05:13.207Z DEBUG wdio-docker-service: 22:05:13.232 INFO [WebDriverServlet.] - Initialising WebDriverServlet
2020-03-16T22:05:13.362Z DEBUG wdio-docker-service: 22:05:13.389 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
2020-03-16T22:05:13.706Z INFO wdio-docker-service: Docker container is ready
2020-03-16T22:05:13.708Z INFO @wdio/local-runner: Start worker 0-0 with arg: config/wdio.conf.docker.js
[0-0] 2020-03-16T22:05:13.937Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - /test/specs/basic_docker.js
[0-0] 2020-03-16T22:05:14.024Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "docker"
[0-0] 2020-03-16T22:05:14.030Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "devtools"
[0-0] 2020-03-16T22:05:14.312Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-03-16T22:05:14.313Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-03-16T22:05:14.315Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session
[0-0] 2020-03-16T22:05:14.315Z INFO webdriver: DATA {
capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' }
}
2020-03-16T22:05:14.461Z DEBUG wdio-docker-service: 22:05:14.490 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome"
}
2020-03-16T22:05:14.464Z DEBUG wdio-docker-service: 22:05:14.493 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
2020-03-16T22:05:14.508Z DEBUG wdio-docker-service: Starting Chro[m1e5D8r4i3v9e6r3 1840.529].[0S.E3V9E8R7E.]1:0 6b i(nfd6(8)0 6f9a5i7l4e6d0:9 2C3a0ncnfo9tb 6a3s5scidg7n8 4rcefqbu1e
2020-03-16T22:05:14.509Z DEBUG wdio-docker-service: bf81bb53a-refs/branch-heads/3987@{#882}) on port 31965
2020-03-16T22:05:14.509Z DEBUG wdio-docker-service: Only local connections are allowed.
Please protect ports used by ChrosmeDtreidv eard darneds sr e(l9a9t)e
2020-03-16T22:05:14.510Z DEBUG wdio-docker-service: d test frameworks to prevent access by malicious code.
2020-03-16T22:05:15.313Z DEBUG wdio-docker-service: 22:05:15.342 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
2020-03-16T22:05:15.374Z DEBUG wdio-docker-service: 22:05:15.403 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 0488ca55b2f225efc8fbb340896f129b (org.openqa.selenium.chrome.ChromeDriverService)
[0-0] (node:5874) UnhandledPromiseRejectionWarning: Error: socket hang up
at connResetException (internal/errors.js:561:14)
at Socket.socketOnEnd (_http_client.js:440:23)
at Socket.emit (events.js:214:15)
at Socket.EventEmitter.emit (domain.js:476:20)
at endReadableNT (_stream_readable.js:1178:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
[0-0] (node:5874) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5874) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^Z
[4]+ Stopped npm run test:docker
Config of WebdriverIO
exports.config = {
runner: 'local',
sync: true,
path: '/wd/hub',
specs: [
'./test/specs/basic_docker.js'
],
maxInstances: 10,
capabilities: [{
browserName: 'chrome',
}],
logLevel: 'debug',
bail: 0,
baseUrl: '',
waitforTimeout: 10000,
connectionRetryCount: 3,
services: ['docker', ['devtools', { debuggerAddress: 'localhost:9222' }]],
dockerOptions: {
image: 'selenium/standalone-chrome',
healthCheck: {
url: 'http://localhost:4444',
maxRetries: 3,
inspectInterval: 1000,
startDelay: 2000
},
options: {
p: ['4444:4444', '9222:9222'],
shmSize: '2g',
hostname: 'selenium'
}
},
framework: 'mocha',
reporters: [
['allure', { outputDir: 'allure-results' }]
],
mochaOpts: {
ui: 'bdd',
timeout: 180000
},
afterTest: function(test, context, { error, result, duration, passed, retries }) {
if (!passed) {
browser.takeScreenshot();
}
},
}
package.json file
{
"name": "performance",
"version": "1.0.0",
"description": "Performance test for web pages",
"main": "index.js",
"scripts": {
"test:sauce": "wdio ./wdio.conf.sauce.js",
"test:docker": "wdio config/wdio.conf.docker.js",
"test:local": "wdio config/wdio.conf.ori.js",
"test:compose": "wdio wdio.conf.compose.js"
},
"author": "Pratik",
"license": "ISC",
"devDependencies": {
"@wdio/allure-reporter": "^5.18.6",
"@wdio/cli": "^5.15.1",
"@wdio/devtools-service": "^5.16.16",
"@wdio/local-runner": "^5.18.7",
"@wdio/mocha-framework": "^5.18.7",
"@wdio/sauce-service": "^5.16.10",
"@wdio/spec-reporter": "^5.18.7",
"@wdio/sync": "^5.18.7",
"chromedriver": "^80.0.1",
"selenium-standalone": "^6.17.0",
"wdio-chromedriver-service": "^5.0.2",
"wdio-docker-service": "^2.3.0",
"wdio-selenium-standalone-service": "0.0.12",
"webdriverio": "^5.20.2"
}
}
Test
const assert = require('assert')
describe('Test page - ', () => {
before(() => {
browser.enablePerformanceAudits({
//[offline, GPRS, Regular 2G, Good 2G, Regular 3G, Good 3G, Regular 4G, DSL, Wifi and online]
networkThrottling: 'Regular 4G',
// cpuThrottling: 4,
cacheEnabled: true
})
})
it('Performance test', () => {
browser.url('https://www.google.com')
console.log(browser.getMetrics())
console.log(browser.getDiagnostics())
})
after(() => {
browser.disablePerformanceAudits()
})
})
Steps to reproduce the behavior
In wdio config, use services: ['docker', ['devtools', { debuggerAddress: 'localhost:9222' }]] and run any simple test.
Expected behavior
Test should run in the docker container along with devtools service which will provide performance metrics.