webdriverio-community / wdio-docker-service Goto Github PK
View Code? Open in Web Editor NEWDocker service for Webdriver.io
License: MIT License
Docker service for Webdriver.io
License: MIT License
I'm trying to add --network host
command/args option but was blocked by below exception ).
2020-07-21T04:28:46.783Z INFO wdio-docker-service: Launching docker image 'selenium/standalone-chrome'
events.js:292
throw er; // Unhandled 'error' event
^
Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
The real exception was below
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"--network\": executable file not found in $PATH": unknown.
Docker command
DEBUG wdio-docker-service: Docker command: docker run --cidfile /path-to/selenium_standalone_chrome.cid --rm -p 4444:4444 -p 5900:5900 --shm-size 2g selenium/standalone-chrome --network host
Moving --network host
to before selenium/standalone-chrome
and the command works.
I don't know if there's a reason why command and args are pushed behind container name. I think container name should be pushed last.
I can create a PR to fix this if it makes sense to you.
const cmdChain = ['docker', 'run'].concat((0, _optionsSerializer.default)(this.options), [this.image]);
if (this.command) {
cmdChain.push(this.command);
}
if (this.args) {
cmdChain.push(this.args);
}
Background: I could not use addHost
because our login server only accepts localHost
and that will be changing everywhere from localhost to, say dockerhost
. So docker --network host
is the only feasible option.
Is there any plan to use latest major WebdriverIO version?
when I try and run my wdio tests with this service I am getting:
events.js:160
throw er; // Unhandled 'error' event
^
Error: Couldn't initialise launcher from service "docker".
Error: Cannot find module './lib/launcher'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (~/node_modules/wdio-docker-service/launcher.js:2:24)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Launcher.getLauncher (~/node_modules/webdriverio/build/lib/launcher.js:731:35)
at Launcher._callee$ (~/node_modules/webdriverio/build/lib/launcher.js:233:49)
at tryCatch (~/code/muse/node_modules/regenerator-runtime/runtime.js:64:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (~/regenerator-runtime/runtime.js:355:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (~/node_modules/regenerator-runtime/runtime.js:116:21)
at step (~/babel-runtime/helpers/asyncToGenerator.js:17:30)
at !/babel-runtime/helpers/asyncToGenerator.js:35:14
at Promise.F (!/node_modules/core-js/library/modules/_export.js:35:28)
at Launcher.<anonymous> (~/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
at Launcher.run (~/node_modules/webdriverio/build/lib/launcher.js:373:29)
Really appreciate this service!
I'm pretty new to setting up CI. I'm trying to set this up in gitlab. This perhaps is not much of an issue or maybe not the right place to ask this so I apologize if so. I'm having an issue with connecting to the port and I'm not sure how to solve this issue. Is there perhaps an example or something that could point me in the right direction?
'ERROR webdriver: RequestError: connect ECONNREFUSED 127.0.0.1:4444'
'ERROR @wdio/runner: Error: Failed to create session.
[0-0] Unable to connect to "http://localhost:4444/wd/hub", make sure browser driver is running on that address.'
I've set-up my wdio.config in this manner according to the example. This is my custom one:
`const { config } = require('./shared.wdio.conf')
config.services = ['docker'],
config.hostname = 'localhost',
config.port = 4444,
// config.path = '/',
config.path = '/wd/hub', // Required to work with wdio v6
config.dockerOptions = {
image: 'selenium/standalone-chrome',
healthCheck: 'http://localhost:4444',
maxRetries: 3,
inspectInterval: 1000,
startDelay: 2000,
options: {
p: ['4444:4444'],
shmSize: '2g',
}
}`
docker-compose.yml:
version: "3"
services:
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
restart: always
ports:
- "4444:4444"
firefox:
image: selenium/node-firefox-debug:latest
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
scale: 2
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
restart: on-failure:3
chrome:
image: selenium/node-chrome-debug:latest
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
scale: 2
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
restart: on-failure:3
`
the gitlab-ci :
`image: tmaier/docker-compose:latest
services:
before_script:
stages:
This feature would allow automatic startup/teardown of docker-compose
files in addition do Docker images.
Originally logged here: webdriverio/webdriverio#6997
If you run a test that needs browser.mock
inside docker container, it fails on node-fetch ClientRequest with ECONNREFUSED
error.
Exception:
FetchError: Failed to fetch browser webSocket URL from http://localhost:39857/json/version: request to http://localhost:39857/json/version failed, reason: connect ECONNREFUSED 127.0.0.1:39857
at ClientRequest.<anonymous> (C:\Users\user\workspace\node.js\tyl-e2e-reviews\node_modules\node-fetch\lib\index.js:1461:11)
at Socket.socketErrorListener (_http_client.js:426:9)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
at Browser.runCommandWithHooks (C:\Users\user\workspace\node.js\tyl-e2e-reviews\node_modules\@wdio\sync\build\wrapCommand.js:100:24)
at Browser.wrapCommandFn (C:\Users\user\workspace\node.js\tyl-e2e-reviews\node_modules\@wdio\sync\build\wrapCommand.js:67:44)
at LoginPage.setPassword (C:\Users\user\workspace\node.js\tyl-e2e-reviews\tests\pages\app\application\login.page.js:36:29)
NOTE: The port seen above is not same every time, so cant expose it either.
Environment (please complete the following information):
Config of WebdriverIO
exports.config = {
runner: 'local',
hostname: 'localhost',
path: '/wd/hub',
outputDir: './logs',
capabilities: [
{
"maxInstances": 5,
"browserName": "chrome",
"goog:chromeOptions": {
"args": [
"--start-maximized"
],
"prefs": {
"credentials_enable_service": false,
"profile": {
"password_manager_enabled": false
}
}
}
}],
services:
[
[wdioScreenshot],
'shared-store',
'docker'
],
dockerOptions: {
image: 'selenium/standalone-chrome-debug',
healthCheck: {
url: 'http://localhost:4444',
maxRetries: 3,
inspectInterval: 1000,
startDelay: 2000
},
options: {
p: ['4444:4444', '5900:5900'],
shmSize: '2g'
}
},
dockerLogs: 'logs',
}
Describe the bug
I am running my existing local tests inside the docker container using the wdio-docker-service
and the tests that were running successfully locally dont run inside the container, where it encounters the browser.mock()
call, its throwing the error mentioned above.
To Reproduce
Steps to reproduce the behavior:
wdio-docker-service
browser.mock()
Expected behavior
The test should pass when running inside the container.
Log
Nothing in logs, see the exception above.
Hi,
i'm trying to run the tests with docker but but without success.
What is the right command that I should run?
When I run wdio, I get this error:
A service failed in the 'onPrepare' hook
TypeError: _fsExtra2.default.readFile(...).then(...).finally is not a function
at Docker._removeStaleContainer C:\Repos\AppRiver.Shakedown\e2e\webdriverio\node_modules\wdio-docker-service\lib\utils\docker.js:212:19)
When I remove the finally
block from the _removeStaleContainer
method, it works fine.
My setup is:
wdio-docker-service: 1.1.7
webdriverio: 4.12.0
node: 8.10.0
@stsvilik I looked over the way we use "fs-extra": "^7.0.0",
package and I believe we can get rid of the dependency by having a bunch of local functions in src/utils
based on fs
native module. Let me know your thoughts on this.
Should we throw a SevereServiceErrorwhen
docker` isn't found? Right now there's an error in the log but the tests keep running:
DEBUG wdio-docker-service: Docker command: docker run --cidfile .../wdio-docker-service/nginx.cid --rm -p 8080:8080 -v .../wdio-docker-service/test/integration/docker-app/app/:/usr/share/nginx/html:ro -v .../wdio-docker-service/test/integration/docker-app/nginx.conf:/etc/nginx/nginx.conf:ro --health-cmd "curl -sS http://127.0.0.1:8080 || exit 1" --health-timeout 10s --health-interval 5s nginx
WARN wdio-docker-service: Connecting dockerEventsListener: 585794
INFO wdio-docker-service: Cleaning up CID files
WARN wdio-docker-service: NOTE: Pulling image for the first time. Please be patient.
ERROR wdio-docker-service: Error: Error executing sub-child: docker events --format "{{json .}}" --filter image=nginx
/bin/sh: 1: docker: not found
at DockerEventsListener._onMessage (/home/sean/Development/GitHub/seanpoulter/Forks/webdriverio-community/wdio-docker-service/src/utils/dockerEventsListener.js:55:27)
at ChildProcess.emit (events.js:400:28)
at ChildProcess.emit (domain.js:475:12)
at emit (internal/child_process.js:935:14)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
WARN wdio-docker-service: Disconnecting dockerEventsListener: 585794
INFO chromedriver: Initiate Chromedriver Launcher (v8.1.1)
We suppress the ENOENT
here:
wdio-docker-service/src/utils/docker.js
Lines 123 to 129 in efa15d3
Hey 👋
first off, thank you for creating this plugin and extending the WebdriverIO ecosystem! It is widely used and a huge success.
We have been looking into successful WDIO plugins like this one as we want to ensure that its development can be continued even if the original maintainer decides to move on. Therefore on behalf of the WebdriverIO community I would like to ask if you would be interested to move this repository into the WebdriverIO Community organisation. It would allow us to help maintain this package, automate a few things like releases and allow others to contribute to it and make the package even better. You would of course continue to have full access to it.
What do you think? Please let me know if you have any questions.
Launching docker image 'selenium/standalone-chrome'
docker run --cidfile /mnt/jenkins/workspace/Project (Dev)/client/selenium_standalone_chrome.cid --rm -p 4444:4444 --shm-size 2g selenium/standalone-chrome
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.
colorLogger.js is lost starting from v1.4.1
Can I, with the help of this service, connect to Electron app (Chrome based) which is running in a docker Container run by this service ? What should the baseUrl be in that case ?
Configured the config file as mentioned in the example. I am getting this error on building the image. my configuration files are as follows.
// wdio.conf.js
exports.config = {
// ...
specs: [
// 'specs/login.spec.js',
// 'specs/medical_codes.spec.js',
'test2.js'
// 'specs/chart_view.spec.js'
],
services: ['docker'],
// mochaOpts: {
// timeout: 9999999,
// ui: 'bdd',
// },
// ...
// Options are set here as well
capabilities: [{
maxInstances: 5,
browserName: 'firefox',
assumeUntrustedCertIssuer: true,
canAssumeUntrustedCertIssuer: true,
setAcceptUntrustedCertificates: true,
ignoreUndefinedDefinitions: true,
acceptInsecureCerts: true,
acceptSslCerts: true,
trustAllSSLCertificates: true
}],
dockerLogs: './logs',
dockerOptions: {
image: 'selenium/standalone-firefox',
healthCheck: 'http://localhost:4444',
options: {
p: ['4444: 4444'],
shmSize: '2g'
}
},
before: function (capabilities, specs) {
browser.timeouts('script', 5000000);
browser.timeouts('implicit', 1000);
browser.timeouts('page load', 5000000);
},
//...
};
Dockerfile
FROM node:carbon ADD . /app WORKDIR /app RUN npm i RUN npm run test
Full error text as follows
NOTE: Pulling image for the first time. Please be patient.
ERROR: connect ECONNREFUSED 127.0.0.1:4444
firefox
at new RuntimeError (/app/node_modules/webdriverio/build/lib/utils/ErrorHandler.js:144:12)
at Request._callback (/app/node_modules/webdriverio/build/lib/utils/RequestHandler.js:327:43)
at self.callback (/app/node_modules/request/request.js:186:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/app/node_modules/request/request.js:878:8)
at emitOne (events.js:121:20)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `wdio test.conf`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-03-02T10_11_20_106Z-debug.log
Hi, thank you for your amazing work on wdio-docker-service. Is there a way to configure dockerOptions section of my wdio.conf.js to allow for a hub with nodes? e.g. Instead of using the a standalone image, I would like to use the hub with chrome and firefox. Thanks!
Hi
I am able to open an applications which are not secured inside the docker successfully when we try to open secured applications with cookies inside docker using webdriverio.
We are not able to able any.There are no logs getting generated inside the docker
Request your Help on this issue
First of all thanks for this service.
disclaimer: I am very new to webdriverio and javascript.
Issue:
docker service doesn't wait for hub to be up when using "zalenium"
Details
I am using zalenium docker images to start hub/node, and using health property for docker-service. Since zalenium take sometime to start hub and register node , docker service is not waiting for it to be up
reason for this behaviour is, health end point doesnot wait for the service to return 200OK which is kind of make sense as well after reading fetch documentation , but right now I am stuck with this problem.
Fix:
Ideal fix: would be to take a call back in health options and wait for it to be complete.
Quick fix: would be to implement checkStatus function in health , similar to this
If you agree this is issue and should be fixed, I can take first stab at fixing this.
2020-04-20T17:44:07.162Z ERROR wdio-docker-service: Error: Error executing sub-child: docker events --format "{{json .}}" --filter image=selenium/standalone-chrome
at DockerEventsListener._onMessage (/builds/get.on/patientapp-web-automation/node_modules/wdio-docker-service/lib/utils/dockerEventsListener.js:67:21)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:485:12)
at emit (internal/child_process.js:881:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
2020-04-20T17:44:07.163Z WARN wdio-docker-service: Disconnecting dockerEventsListener: 234
Error: connect ECONNREFUSED 127.0.0.1:8080
I have an use case that the docker container starts really slow and the health check timeout in 5 seconds.
Could you allow us to pass in max retry as part of dockerOptions?
If possible, the following options will be great:
Interval(INSPECT_DOCKER_INTERVAL)
Start period(before start checking docker's health)
Retries(MAX_INSPECT_ATTEMPTS)
Many thanks
I might have misunderstood the purpose of healthCheck
and the onDockerReady
callback method, but in my experience, onDockerReady
method is called even though an app isn't reachable.
Let's say I have an app that runs on http://localhost:8080
.
A working wdio.conf.js
config could look like this:
{
(...)
dockerLogs: './build/logs',
dockerOptions: {
image: 'MY_APP',
healthCheck: {
url: 'http://localhost:8080',
maxRetries: 3,
inspectInterval: 1000,
},
options: {
p: ['8080:8080'],
},
},
onDockerReady() {
console.log('MY_APP CONTAINER IS UP');
},
(...)
}
Now, If I were to change the p
option to e.g. ['3030:'3030'']
, I would expect the onDockerReady
method to not be called because the app is not configured to respond on port 3030. But it would still get called and MY_APP CONTAINER IS UP
would appear in the console log.
After updated to 1.5.0 we start to see errors like this:
Launching docker image 'chromeheadless:66.0'
Error: Error executing sub-child: docker events --format {{json\ .}} --filter image=chromeheadless:66.0
at DockerEventsListener._onMessage (/node_modules/wdio-docker-service/src/utils/dockerEventsListener.js:57:27)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at emit (internal/child_process.js:762:12)
at _combinedTickCallback (internal/process/next_tick.js:142:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)
The docker service starts as expected though, the problem lays on the older version of docker we are using: 1.12.
Would be nice if you can update the release note so that other user will be noticed about this change.
Hi,
I am getting ERROR: connect ECONNREFUSED 127.0.0.1:4444 while using the wdio-docker-service. Below is my Dockerfile:
`FROM ubuntu:latest
LABEL maintainer="Ankit Ranjan"
ENV LC_ALL=C
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true
RUN groupadd --gid 1000 node
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
RUN apt-get -qqy update
RUN apt-get -qqy install
apt-transport-https
ca-certificates
curl
software-properties-common
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe\n" > /etc/apt/sources.list
&& echo "deb http://archive.ubuntu.com/ubuntu xenial-updates main universe\n" >> /etc/apt/sources.list
&& echo "deb http://security.ubuntu.com/ubuntu xenial-security main universe\n" >> /etc/apt/sources.list
RUN apt-get -qqy update
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get -qqy --no-install-recommends install
nodejs \
openjdk-8-jre-headless
x11vnc
xvfb
xfonts-100dpi
xfonts-75dpi
xfonts-scalable
xfonts-cyrillic
RUN export DISPLAY=:99.0
RUN Xvfb :99 -shmem -screen 0 1366x768x16 &
WORKDIR /home/node
ADD . .
RUN chown node:node -R .
RUN chmod 777 -R .
RUN node --version
RUN npm --version
USER node
RUN npm install
ENTRYPOINT ["tail", "-f", "/dev/null"]`
Below is my docker-compose file:
`version: "2"
services:
testapp:
build:
context: .
dockerfile: Dockerfile
networks:
- testing-lan
seleniumappchrome:
image: selenium/standalone-chrome-debug
volumes:
- /dev/shm:/dev/shm
ports:
- "4444:4444"
- "5900:5900"
networks:
- testing-lan
networks:
testing-lan:
driver: bridge`
And below is my wdio-conf.js file:
`exports.config = {
services: ['docker'],
specs: [
'bdd-tests/features/featureFiles/*.feature'
],
maxInstances: 2,
capabilities: [{
maxInstances: 1,
//
browserName: 'chrome'
},
],
dockerOptions: [{
image: 'selenium/standalone-chrome-debug',
healthCheck: {
url: 'http://0.0.0.0:4444/wd/hub',
inspectInterval: 1000,
startDelay: 15000
},
options: {
p: ['4444: 4444', '5900:5900'],
shmSize: '2g'
}
},
],
framework: 'cucumber',
reporters: ['cucumber-json', 'spec'],
reporterOptions: {
outputDir: 'bdd-tests/output/jsonReport',
},
// If you are using Cucumber you need to specify the location of your step definitions.
cucumberOpts: {
require: ['./bdd-tests/features/step-definitions/*.js'],// <string[]> (file/dir) require files before executing features
backtrace: false, // <boolean> show full backtrace for errors
compiler: [], // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
dryRun: false, // <boolean> invoke formatters without executing steps
failFast: false, // <boolean> abort the run on first failure
format: 'json', // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
colors: true, // <boolean> disable colors in formatter output
snippets: true, // <boolean> hide step definition snippets for pending steps
source: true, // <boolean> hide source uris
profile: [], // <string[]> (name) specify the profile to use
strict: false, // <boolean> fail if there are any undefined or pending steps
tags: [], // <string[]> (expression) only execute the features or scenarios with tags matching the expression
timeout: 20000, // <number> timeout for step definitions
ignoreUndefinedDefinitions: false, // <boolean> Enable this config to treat undefined definitions as warnings.
}
}
And below is the error I am getting:
[16:36:57] Using gulpfile ~/gulpfile.js
[16:36:57] Starting 'cucumber'...
[16:36:57] Starting 'prepareReportFolders'...
[16:36:57] Finished 'prepareReportFolders' after 5.99 ms
[16:36:57] Starting 'selenium'...
[16:36:57] Finished 'selenium' after 3.24 ms
[16:36:57] Starting 'wdio'...
[16:36:57] COMMAND POST "/wd/hub/session"
[16:36:57] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":1,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.14.4","name":"webdriverio"}}}
ERROR: connect ECONNREFUSED 127.0.0.1:4444
chrome
at new RuntimeError (/home/node/node_modules/webdriverio/build/lib/utils/ErrorHandler.js:143:12)
at Request._callback (/home/node/node_modules/webdriverio/build/lib/utils/RequestHandler.js:342:43)
at self.callback (/home/node/node_modules/request/request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/home/node/node_modules/request/request.js:877:8)
at emitOne (events.js:121:20)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:401:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:73:8)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)
Wrote json report to [bdd-tests/output/jsonReport].
[16:36:58] 'wdio' errored after 906 ms
[16:36:58] Error in plugin 'gulp-webdriver'
Message:
wdio exited with code 1
[16:36:58] Finished 'cucumber' after 922 ms`
Please help me to find if I am missing anything.
Thanks,
Ankit Ranjan
Hey, how can I add extra_hosts
to dockerOptions
?
When I'm using docker-compose, it looks like this. How can I add this parameter into wdio config options for wdio-docker-service
?
image: myimage
shm_size: 2g
environment:
- HUB_PORT_4444_TCP_ADDR=hub
- HUB_PORT_4444_TCP_PORT=4444
volumes:
- ./uploadImages/:/uploadImages
ports:
- 5900:5900
extra_hosts:
- "nginx:172.17.0.1"
This change would align with the other repos in webdriverio and webdriverio-community.
For more see https://github.com/github/renaming?tab=readme-ov-file#renaming-the-default-branch-from-master.
Hi,
I'm facing an issue with the docker service:
Config of WebdriverIO
exports.config = {
runner: 'local',
specs: [
'./test/specs/**/*.js'
],
exclude: [
],
maxInstances: 10,
capabilities: [
{
browserName: 'chrome',
acceptInsecureCerts: true,
'goog:chromeOptions': {
args: ['--window-size=1920,1080', '--incognito', '-–ignore-certificate-errors', '--headless'],
},
},
],
logLevel: 'info',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
dockerOptions: {
image: 'selenium/standalone-chrome',
healthCheck: 'http://localhost:4444',
options: {
p: ['4444:4444'],
shmSize: '2g'
}
},
services: ['docker'],
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 60000
},
}
Bug description:
For test execution, I'm using lerna, which executes tests with a docker. After the test execution, the docker process is stuck.
61549 ttys001 0:00.09 /usr/local/bin/node /Users/alexeykagansky/dev/wdio-docker-lerna/node_modules/wdio-docker-service/lib/modules/dockerEvents
To Reproduce
https://github.com/AlexeyCL/wdio-docker-lerna you can find a simple example
when i configured below package configuration in my project . its throwing this error
npm package use
webdriverio - 5.16.5
wdio-docker-service - 2.1.4
// wdio.conf.js
exports.config = {
// ...
specs: [
'./test/**/01**.js',
],
services: ['docker'],
// Options are set here as well
capabilities: [{
{ browserName: 'chrome'
// chromeOptions: {
// args: debug ? [] : [ '--disable-gpu', '--window-size=1280,800'],
// }
}
}],
dockerLogs: './logs',
dockerOptions: {
image: 'selenium/standalone-chrome',
healthCheck: {
url: 'http://localhost:4444',
maxRetries: 3,
inspectInterval: 1000,
startDelay: 15000
},
options: {
p: ['4444: 4444'],
shmSize: '2g'
}
},
};
//Actual test file
describe(browser.capabilities.browserName + ' - basic test', function() {
it('should have the right title', async () => {
await browser.url('https://webdriver.io');
const title = await browser.getTitle();
assert.equal(title, 'WebdriverIO · Next-gen WebDriver test framework for Node.js');
});
});
Error on console
Execution of 1 spec files started at 2019-11-21T05:54:28.504Z
[0-0] RUNNING in chrome - C:\codebase\webdriverio\01-base-test.js
0-0 worker error { name: 'Error',
message: 'connect ECONNREFUSED 127.0.0.1:4444',
stack:
'Error: connect ECONNREFUSED 127.0.0.1:4444\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)' }
[0-0] FAILED in chrome - C:\codebase\webdriverio01-base-test.js
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:06
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Exit status 1
npm ERR!
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Hi,
I am interested if the docker service is able to run a docker-compose file or if I can build a setup with multiple images similar to the following docker-compose.yml file.
version: '3'
services:
selenoid:
network_mode: bridge
image: aerokube/selenoid
volumes:
- .{$PWD}
- ./docker:/etc/selenoid/
- /var/run/docker.sock:/var/run/docker.sock
- ./docker/video:/opt/selenoid/video
environment:
- OVERRIDE_VIDEO_OUTPUT_DIR=/opt/selenium/video
command: [
"-limit", "12",
"-conf", "/etc/selenoid/browsers.json",
"-video-output-dir", "/opt/selenoid/video"
]
ports:
- "4444:4444"
restart: always
selenoid-ui:
network_mode: bridge
image: "aerokube/selenoid-ui"
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
restart: always
chrome:
image: selenoid/vnc:chrome_73.0
network_mode: bridge
links:
- selenoid
volumes:
- .{$PWD}
- /dev/shm:/dev/shm
depends_on:
- selenoid
restart: always
firefox:
image: selenoid/vnc:firefox_66.0
network_mode: bridge
links:
- selenoid
volumes:
- .{$PWD}
- /dev/shm:/dev/shm
depends_on:
- selenoid
restart: always
I'm asking this because I am more used to docker-compose than docker run and wanted to know if I need to look into transforming my yml file into a single docker run command or not.
Thank you in advance
#31 bug fix made sure that onDockerReady()
callback function isn't called if an app was is, great! Now, if you have debug: true
in wdio.config.js
you will also see the following error message:
Failed to run container: request to http://localhost:8080/ failed, reason: connect ECONNREFUSED 127.0.0.1:8080
However, this error is handled and logged here which means that WDIO will continue to run tests even though the app is unreachable.
I argue that one wouldn't want to run tests against an unreachable environment, but instead get a fast exit/feedback if that is the case.
Is it possible to not handle the error (or purposefully exiting) to make the test runner exit if the app is not reachable?
Hi, I have these options
options: {
e: ["NODE_ENV=development", "FOO=bar"],
p: ['4444:4444'],
shmSize: '2g',
rm: true
}
when running wdio they get translated like this:
[... ]--rm -e=NODE_ENV=development -e=FOO=bar -p=4444:4444 --shm-size=2g
not sure if I'm doing something wrong, I'm sure i saw them working earlier.
"wdio-docker-service": "^2.1.5-rc.0"
Currently this does not work with docker on windows.
Error: Error executing sub-child: docker events --format {{json .}} --filter image=selenium/standalone-chrome-debug
The following change to dockerEvents.js fixes it.
const DEFAULT_OPTIONS = {
format: '"{{json .}}"'
};
We are getting following error with v5 version of WebdriverIO.
[0-0] RUNNING in chrome - /test/basicTest.js
[0-0] This test will run using docker service provided by WebDriverIO using standalone-chrome-debug image.
[0-0] 2019-06-07T18:34:22.521Z ERROR @wdio/runner: Error: connect ECONNREFUSED 127.0.0.1:4444
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
0-0 worker error { name: 'Error',
message: 'connect ECONNREFUSED 127.0.0.1:4444',
stack:
'Error: connect ECONNREFUSED 127.0.0.1:4444\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)' }
[0-0] FAILED in chrome - /test/basicTest.js
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:00
Node Version: v10.15.3
@wdio/[email protected]
[email protected]
services = ['docker'];
host = 'localhost';
dockerLogs = './dockerLogs';
dockerOptions = {
image: 'selenium/standalone-chrome-debug',
healthCheck: {
url: 'https://localhost:4444',
maxRetries: 3,
inspectInterval: 1000,
startDelay: 15000
},
options: {
p: ['4444:4444'],
shmSize: '2g'
}
};
Can you please let us know if we are missing something?
Hello, I am attempting to upload a jpg to the browser. I can console.log out the file's location but I am getting a "file no found" when running with this service. This does work when using selenium-standalone service.
The code is similar to this:
it ("can create movie 1", function() {
// Viewing local files (local to my machine or inside of the selenium container?)
var spawn = require('child_process').spawn;
var ls = spawn('ls', ['/home/chris/SEER/core-qa-automation/webdriverIO/test/files/']);
ls.stdout.on('data', function (data) {
console.log("ls on path to files (/home/chris/SEER/core-qa-automation/webdriverIO/test/files/): " + data);
});
VideosPage.open();
const filePath = path.join(__dirname, '../files/dbz.jpg');
this.uploadFilePath.setValue(filePath);
})
The error logs look like this:
[0-0] RUNNING in chrome - /test/specs/turnkeyDemoCarousel.spec.js
[0-0] ls on path to files (/home/chris/SEER/core-qa-automation/webdriverIO/test/files/): bojack-unbound.jpg
dbz.jpg
dbz-series.jpg
one-second.mp4
return-of-cooler.jpg
[0-0] 2020-03-21T18:17:40.711Z ERROR webdriver: Request failed due to invalid argument: invalid argument: File not found : /home/chris/SEER/core-qa-automation/webdriverIO/test/files/dbz.jpg
(Session info: chrome=80.0.3987.106)
at getErrorFromResponseBody (/home/chris/SEER/core-qa-automation/webdriverIO/node_modules/@wdio/runner/node_modules/webdriver/build/utils.js:124:10)
at Request._callback (/home/chris/SEER/core-qa-automation/webdriverIO/node_modules/@wdio/runner/node_modules/webdriver/build/request.js:121:64)
at Request.self.callback (/home/chris/SEER/core-qa-automation/webdriverIO/node_modules/request/request.js:185:22)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at Request.<anonymous> (/home/chris/SEER/core-qa-automation/webdriverIO/node_modules/request/request.js:1161:10)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at IncomingMessage.<anonymous> (/home/chris/SEER/core-qa-automation/webdriverIO/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:286:20)
[0-0] invalid argument in "SEER backend can create movie 1"
invalid argument: File not found : /home/chris/SEER/core-qa-automation/webdriverIO/test/files/dbz.jpg
(Session info: chrome=80.0.3987.106)
[0-0] FAILED in chrome - /test/specs/turnkeyDemoCarousel.spec.js`
Any help would be appreciated. This project is awesome and I'd love to continue to use it.
Much thanks!
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.
Hi,
Root cause was wrong command was used to check docker image exists locally or not.
I created a pull request for this.
https://github.com/mouyigang/wdio-docker-service/pull/1
Thanks,
Andy
Hi, sorry this is not an issue but a question. I'm using wdio and would like to run my tests in containers. My image is stored in AWS Elastic Container Repository. Can I use that url in dockerOptions.image?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.