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

Question: Any plans on adding allure reporting? (or any other reporting mechanism) #6

Closed kumarpatel closed 5 years ago

kumarpatel commented 5 years ago

I tried added @wdio/allure-reporter to the npm global install list in Dockerfile

RUN apk --no-cache add \
    nodejs \
    npm \
    ffmpeg \
    android-tools@edgetesting \
  && npm install -g \
    npm@latest \
    @wdio/cli@^5.7.13 \
    @wdio/local-runner@^5.7.13 \
    @wdio/mocha-framework@^5.7.13 \
    @wdio/spec-reporter@^5.7.13 \
    @wdio/allure-reporter \
    @wdio/sync@^5.7.13 \
    chai@^4.2.0 \
    mailhog@^4.1.0 \
    uuid@^3.3.2 \
    wdio-screen-commands@^2.6.0 \
    webdriverio@^5.7.13 \
    lodash@^4.17.11 \

and added the config in wdio.conf.js

reporters: ["spec", "allure"],
  reporterOptions: {
    allure: {
      outputDir: "allure-results",
      disableWebdriverStepsReporting: true,
      disableWebdriverScreenshotsReporting: true,
      useCucumberStepReporter: false
    }
  },

Here's the error I get

Stderr:
wdio_1          | [0-0] 2019-04-17T11:59:36.703Z ERROR @wdio/local-runner: Failed launching test session: Error: Couldn't find plugin "allure" reporter, neither as wdio scoped package "@wdio/allure-reporter" nor as community package "wdio-allure-reporter". Please make sure you have it installed!
wdio_1          |     at initialisePlugin (/usr/lib/node_modules/@wdio/local-runner/node_modules/@wdio/utils/build/initialisePlugin.js:62:9)
wdio_1          |     at BaseReporter.initReporter (/usr/lib/node_modules/@wdio/local-runner/node_modules/@wdio/runner/build/reporter.js:189:51)
wdio_1          |     at Array.map (<anonymous>)
wdio_1          |     at new BaseReporter (/usr/lib/node_modules/@wdio/local-runner/node_modules/@wdio/runner/build/reporter.js:34:39)
wdio_1          |     at Runner.run (/usr/lib/node_modules/@wdio/local-runner/node_modules/@wdio/runner/build/index.js:89:21)
wdio_1          |     at process.on.m (/usr/lib/node_modules/@wdio/local-runner/build/run.js:37:20)
wdio_1          |     at process.emit (events.js:187:15)
wdio_1          |     at emit (internal/child_process.js:812:12)
wdio_1          |     at process._tickCallback (internal/process/next_tick.js:63:19)

Thoughts on what I'm doing wrong?

blueimp commented 5 years ago

Maybe you forgot to rebuild the Docker image?

I don't have plans to add additional packages to the blueimp/wdio Docker image.

The purpose of this project is more like a starter kit, so it's recommended to fork it and create your own Docker Hub Automated build if you require additional software inside the Docker image.

So if you make changes to the Dockerfile, you should build your own image, e.g.:

docker build -t YOUR_USERNAME/wdio .

Then in docker-compose.yml, replace blueimp/wdio with YOUR_USERNAME/wdio.

Also, the Allure outputDir must be in a writable directory, for example reports/allure:

exports.config = Object.assign({}, require('./hooks'), {
  // ...
  reporters: [
    'spec',
    [
      'allure',
      {
        outputDir: 'reports/allure',
        disableWebdriverStepsReporting: true,
        disableWebdriverScreenshotsReporting: true
      }
    ]
  ],
  // ...
})
kumarpatel commented 5 years ago

oh, I see. I'll give that approach a try. Thanks again for your help.