blueimp / wdio

Docker setup for WebdriverIO with automatic screenshots, image diffing and screen recording support for containerized versions of Chrome and Firefox on Linux, mobile versions of Chrome and Firefox on Android as well as Safari on iOS, Safari on macOS and Edge on Windows.
https://hub.docker.com/r/blueimp/wdio
MIT License
296 stars 51 forks source link

ERROR @wdio/config:ConfigParser: #7

Closed horsecoin closed 5 years ago

horsecoin commented 5 years ago

2019-04-30 18:48:20 ☆ nickademous in ~ ± |master ↑1 ↓2 S:387 U:367 ?:452 ✗| → docker run -it -v $(pwd):/usr/workspace blueimp/wdio sh Unable to find image 'blueimp/wdio:latest' locally latest: Pulling from blueimp/wdio bdf0201b3a05: Pull complete 436b67d6d032: Pull complete 6e7ac5f22b73: Pull complete 68e94cea041c: Pull complete bfe897812e06: Pull complete Digest: sha256:5cfcfe1a43ef277e56584b820b8618b0d1744006f3e76292ae53b3bde69f410d Status: Downloaded newer image for blueimp/wdio:latest 2019-05-01T04:52:45.887Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: /opt/sh: Cannot find module '/opt/sh' /usr/lib/node_modules/@wdio/cli/node_modules/@wdio/config/build/lib/ConfigParser.js:86 throw e; ^

Error: Cannot find module '/opt/sh' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at ConfigParser.addConfigFile (/usr/lib/node_modules/@wdio/cli/node_modules/@wdio/config/build/lib/ConfigParser.js:51:48) at new Launcher (/usr/lib/node_modules/@wdio/cli/build/launcher.js:33:23) at launch (/usr/lib/node_modules/@wdio/cli/build/run.js:87:20) at run (/usr/lib/node_modules/@wdio/cli/build/run.js:64:12) at Object.run (/usr/lib/node_modules/@wdio/cli/build/index.js:45:20) at Object. (/usr/lib/node_modules/@wdio/cli/bin/wdio.js:11:21)

horsecoin commented 5 years ago

Never mind, my bad I did not read the directions, worked with docker compose! First I tried the way below and got another error, then read the directions, and works! wow! ! OMG this looks cool! Will try, wish me luck! Thanks! 2019-04-30 18:52:46 ☆ nickademous in ~ ± |master ↑1 ↓2 S:387 U:367 ?:452 ✗| → docker run -it -v $(pwd):/usr/workspace blueimp/wdio

========================= WDIO Configuration Helper

? Where should your tests be launched (Use arrow keys) ❯ local - https://www.npmjs.com/package/@wdio/local-runner

? Where should your tests be launched local - https://www.npmjs.com/package/@wdio/local-runner ? Shall I install the runner plugin for you? Yes ? Where is your automation backend located? (Use arrow keys) ❯ On my local machine In the cloud using Sauce Labs In the cloud using Browserstack or Testingbot or a different service I have my own Selenium cloud

? Do you want to run your test on Sauce Headless? (https://saucelabs.com/products/web-testing/sauce-headless) Yes ? Which framework do you want to use? mocha ? Shall I install the framework adapter for you? Yes ? Do you want to run WebdriverIO commands synchronous or asynchronous? sync ? Where are your test specs located? ./test/specs/*/.js ? Which reporter do you want to use? (Press to select, to toggle all, to invert selection) ? Do you want to add a service to your test setup? (Press to select, to toggle all, to invert selection) ? Level of logging verbosity debug ? What is the base url? http://localhost

Installing wdio packages:

  • @wdio/local-runner
  • @wdio/mocha-framework
  • @wdio/sync npm WARN checkPermissions Missing write access to /opt npm WARN enoent ENOENT: no such file or directory, open '/opt/package.json' npm WARN @wdio/local-runner@5.8.0 requires a peer of @wdio/cli@^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN opt No description npm WARN opt No repository field. npm WARN opt No README data npm WARN opt No license field.

npm ERR! path /opt npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/opt' npm ERR! { [Error: EACCES: permission denied, access '/opt'] npm ERR! stack: 'Error: EACCES: permission denied, access \'/opt\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/opt' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in: npm ERR! /home/wdio/.npm/_logs/2019-05-01T05_13_32_885Z-debug.log (node:1) UnhandledPromiseRejectionWarning: Error: null at _inquirer.default.prompt.then.answers (/usr/lib/node_modules/@wdio/cli/build/setup.js:57:15) at process._tickCallback (internal/process/next_tick.js:68:7) (node:1) 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:1) [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.


Then docker worked like a charm!! 2019-04-30 19:23:04 ☆ nickademous in ~/wdio ± |master ✓| → docker-compose run --rm wdio firefox Creating network "wdio_default" with the default driver Pulling mailhog (blueimp/mailhog:)... latest: Pulling from blueimp/mailhog ce01a9a67e3c: Pull complete 5e4a4f793028: Pull complete Building example Step 1/6 : FROM python:alpine alpine: Pulling from library/python bdf0201b3a05: Already exists 59c926705abf: Pull complete 31ca6b067b5a: Pull complete b18bc4e1c47b: Pull complete 0a92c60c32df: Pull complete Digest: sha256:ef431c6357f42a8507e01584038d5bda38f01664678e5737d3ba05afcf70133d Status: Downloaded newer image for python:alpine ---> 715a1f28828d Step 2/6 : RUN pip3 install itsdangerous && rm -rf /root/.cache ---> Running in ce8505da70f4 Collecting itsdangerous Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl Installing collected packages: itsdangerous Successfully installed itsdangerous-1.1.0 Removing intermediate container ce8505da70f4 ---> f22dffe8ec05 Step 3/6 : ENV PYTHONUNBUFFERED=1 ---> Running in c63f4c9a4f67 Removing intermediate container c63f4c9a4f67 ---> cffb0931335f Step 4/6 : COPY server.py /srv/ ---> 058cf8639de0 Step 5/6 : USER nobody ---> Running in aefc53c92e1c Removing intermediate container aefc53c92e1c ---> b764f8d5fc78 Step 6/6 : CMD ["/srv/server.py"] ---> Running in 0fb1526693d8 Removing intermediate container 0fb1526693d8 ---> 68fc97b7f882

Successfully built 68fc97b7f882 Successfully tagged wdio_example:latest WARNING: Image for service example was built because it did not already exist. To rebuild this image you must use docker-compose build or docker-compose up --build. Pulling chromedriver (blueimp/chromedriver:)... latest: Pulling from blueimp/chromedriver 6ae821421a7d: Pull complete aa552d4be22c: Pull complete ff4aa1c553b6: Pull complete 0e753ed6d077: Pull complete 492a53310798: Pull complete 3d80fc1b5c67: Pull complete 5a79f4759e40: Pull complete Pulling geckodriver (blueimp/geckodriver:)... latest: Pulling from blueimp/geckodriver 6ae821421a7d: Already exists aa552d4be22c: Already exists ff4aa1c553b6: Already exists 0e753ed6d077: Already exists 492a53310798: Already exists 3d80fc1b5c67: Already exists 9e57744d6c5b: Pull complete 46a398662e9c: Pull complete Creating wdio_mailhog_1 ... done Creating wdio_chromedriver_1 ... done Creating wdio_geckodriver_1 ... done Creating wdio_example_1 ... done Waiting for host: chromedriver:4444 ... ok Waiting for host: geckodriver:4444 ... ok Waiting for host: example:8080 ... ok 2019-05-01T05:26:52.019Z INFO @wdio/cli:Launcher: Run onPrepare hook 2019-05-01T05:26:52.043Z INFO @wdio/local-runner: Start worker 0-0 with arg: firefox

RUNNING 0-0 in firefox - /test/specs/01-session.js

RUNNING 0-1 in firefox - /test/specs/02-mail.js

RUNNING 0-2 in firefox - /test/specs/03-attachments.js

"spec" Reporter:

[firefox #0-0] Spec: /opt/test/specs/01-session.js [firefox #0-0] Running: firefox [firefox #0-0] [firefox #0-0] Session [firefox #0-0] ✓ requires login [firefox #0-0] ✓ requires email [firefox #0-0] ✓ requires password [firefox #0-0] ✓ logs in [firefox #0-0] ✓ logs out [firefox #0-0] [firefox #0-0] 5 passing (26.6s)

[firefox #0-1] Spec: /opt/test/specs/02-mail.js [firefox #0-1] Running: firefox [firefox #0-1] [firefox #0-1] Mail [firefox #0-1] ✓ logs in [firefox #0-1] ✓ requires recipient [firefox #0-1] ✓ sends unicode [firefox #0-1] [firefox #0-1] 3 passing (12.1s)

[firefox #0-2] Spec: /opt/test/specs/03-attachments.js [firefox #0-2] Running: firefox [firefox #0-2] [firefox #0-2] Attachments [firefox #0-2] ✓ logs in [firefox #0-2] ✓ sends one [firefox #0-2] ✓ sends multiple [firefox #0-2] [firefox #0-2] 3 passing (9.8s)

Test Suites: 3 passed, 3 total (100% completed) Time: 🕙 65.73s

2019-04-30 19:27:59 ☆ nickademous in ~/wdio ± |master ✓| → open vnc://user:secret@localhost:5901

Screen Shot 2019-04-30 at 7.31.32 PM.png

Wow, this is the coolest docker I ever have tested out, looks like I got my work cut out for me! Thanks again!

blueimp commented 5 years ago

Glad you like the setup! ☺️

sayurimizuguchi commented 2 years ago

For me the fix was changing

from


require('ts-node/register');

to


require('ts-node');