2

I have a node.js application that runs mocha tests using chimp, and it works normally when running inside my local OS. It uses Google Chrome to do the ui tests.

Currently, I am dockerizing this application... However, I am unsure about what I need in order to run the ui test in terms of browser.

I used some of the commands from https://github.com/workflow/docker-chimp/blob/master/Dockerfile in order to install a headless chrome browser.

My tests fail at the "before all" hook... But I have no idea where that is, nor why it happens.. The tests run normally in the Host OS.

> pluto_integ_test@1.0.0 test /PlutoD2D/itest
> chimp --mocha


[chimp] Running...


  1) "before all" hook

  0 passing (1m)
  1 failing

  1)  "before all" hook:
     Error: timeout of 60000ms exceeded. Ensure the done() callback is being called in this test




Mocha failed
npm ERR! Test failed.  See above for more details.

How can I find out what the problem is?

Jean Alesi
  • 167
  • 2
  • 15
  • 1
    try --debug flag. Also, see this https://medium.com/lucjuggery/using-chimp-to-test-a-docker-compose-application-a258a610a57e#.h58qbe7el – Xolv.io Aug 12 '16 at 19:04
  • The solution was to either run it as privileged, or use xvfb (better) – Jean Alesi Oct 22 '16 at 07:05

1 Answers1

2

Try to use mocha-headless-chrome package.

npm i mocha-headless-chrome

mocha-headless-chrome -f test-page.html

Also you need some libraries for execute headless chrome in docker container:

apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

See the details.

dima117
  • 113
  • 1
  • 6