Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIKE Can we run the e2e tests on TravisCI (or other CI)? #8

Closed
nelsonic opened this issue Jun 14, 2016 · 37 comments · Fixed by #57
Closed

SPIKE Can we run the e2e tests on TravisCI (or other CI)? #8

nelsonic opened this issue Jun 14, 2016 · 37 comments · Fixed by #57

Comments

@nelsonic
Copy link
Member

Given that we have the selenium start/shutdown and test run in a single command npm run e2e,
we could try to run this on Travis...

@nelsonic
Copy link
Member Author

Sadly this did not work looks like the Selenium server did not start: https://travis-ci.org/nelsonic/learn-nightwatch/builds/137542228#L185
we don't have an easy way of debugging it...
But I'm going to try and install Java before running the tests...
http://superuser.com/questions/993718/can-i-install-java-8-on-travis-ci-for-a-python-project

@nelsonic
Copy link
Member Author

@nelsonic
Copy link
Member Author

Looks like Travis-CI is not going to be an option... see: travis-ci/travis-ci#4090 (for now...)

@nelsonic
Copy link
Member Author

Hold on, found this: http://stackoverflow.com/questions/18456611/is-it-possible-to-set-up-travis-to-run-tests-for-several-languages which leads to http://entulho.fiatjaf.alhur.es/guias/how-to-use-node-along-with-other-language-on-travis-ci/ which suggests that we set the language in .travis.yml to Java and then run the tests in a script ... e.g:

language: java

install:
  - . $HOME/.nvm/nvm.sh
  - nvm install stable
  - nvm use stable
  - npm install

script:
  - npm test

This example is for Go but still relevant: https://github.com/OrangeTux/Goppetto/blob/develop/.travis.yml

@nelsonic
Copy link
Member Author

nelsonic commented Jun 14, 2016

Note: This works on CodeShip without any issues:
learn-nightwatch-codeship-passes
learn-nightwatch-codeship-2
Codeship passes while Travis Fails...
codeship-passes-travis-fails
https://travis-ci.org/nelsonic/learn-nightwatch/builds/137568733#L138

@nelsonic
Copy link
Member Author

Travis is pure frustration ... 😞
https://travis-ci.org/nelsonic/learn-nightwatch/builds/137568733#L138

@nelsonic
Copy link
Member Author

Attempt to run the selenium jar file as a background process:
http://stackoverflow.com/questions/12102270/run-java-jar-file-on-a-server-as-background-process

@nelsonic
Copy link
Member Author

Attempt to use https://github.com/angular/webdriver-manager to run selenium...

@nelsonic
Copy link
Member Author

@nelsonic
Copy link
Member Author

nelsonic commented Jun 15, 2016

@nelsonic
Copy link
Member Author

Selenium is Running! https://travis-ci.org/nelsonic/learn-nightwatch/builds/137849262
travis-loads-selenium

But I cannot access it!
travis-cannot-connect-to-selenium

@amilajack
Copy link
Contributor

@nelsonic would a PR for this still be welcome? Think I might give it a go.

@amilajack
Copy link
Contributor

I'm getting the error:

TypeError: Path must be a string. Received { url: 'http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar'

Seems like env2 isn't configured properly in the config.

@nelsonic
Copy link
Member Author

nelsonic commented Jul 13, 2016

@amilajack I think the error relates to the latest version of download not working with node v6 see: #24
we first need make selenium-download compatible with node v6.x ... I forked the repo: https://github.com/dwyl/selenium-download and started to debug why it wasn't working ... (you are a contributor if you want to take a look)

@nelsonic
Copy link
Member Author

nelsonic commented Oct 25, 2016

@Danwhy & @SimonLab what are you doing differently to run your Nightwatch tests on Travis-CI ?
They appear to run without issues: https://travis-ci.org/TheScienceMuseum/collectionsonline/builds/169499325#L1957
running this command: https://github.com/TheScienceMuseum/collectionsonline/blob/master/package.json#L71
CC: @Conorc1000

@Danwhy
Copy link
Member

Danwhy commented Oct 25, 2016

It could be because we're running ours through saucelabs

@nelsonic
Copy link
Member Author

@Danwhy next time we're in the same room please walk me through it so I understand. thanks! 😉

@justinmc
Copy link

For whatever it's worth, I seem to have gotten my project to work with Nightwatch tests on Travis using this guide, but I had to settle with only using phantomjs: Autodesk/molecule-2d-for-react#15

@nelsonic
Copy link
Member Author

@justinmc nice work! thanks for confirming you got it working with PhantomJS! 👍

@nelsonic
Copy link
Member Author

nelsonic commented Nov 3, 2016

@jackcarlisle this is how I log progress in a "Spike"... it lets someone else see what has been attempted and can pick up the baton...

@jackcarlisle
Copy link
Member

@nelsonic 👍 I'll do the same for the karma spike

@gregorybesson
Copy link

gregorybesson commented Dec 4, 2016

Hello guys,

I've been able to make it work with Chrome in Travis: https://github.com/abecms/abecms/blob/master/.travis.yml

  1. You have to use the beta build from travis
sudo: required
dist: trusty
  1. You launch xvfb + install the last stable version of Chrome
before_install:
 - export CHROME_BIN=/usr/bin/google-chrome
 - export DISPLAY=:99.0
 - sh -e /etc/init.d/xvfb start
 - sudo apt-get update
 - sudo apt-get install -y libappindicator1 fonts-liberation
 - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
 - sudo dpkg -i google-chrome*.deb
  1. last but not least, switch to the last version of jdk:
script:
  - jdk_switcher use oraclejdk8

The nightwatch config file is here:https://github.com/AdFabConnect/abejs/blob/master/nightwatch.conf.js

Hope it will work for you ;)

@Conorc1000
Copy link
Contributor

Since this issue was made this short piece has been added to the readme.
"Running your Nightwatch tests on CircleCi."

@qacwnfq
Copy link

qacwnfq commented Dec 19, 2016

@gregorybesson
Thanks, it works!
For me the deciding part seems to have been export DISPLAY and starting xvfb.

@gregorybesson
Copy link

@qacwnfq U welcome. Indeed, we must start xvfb for chrome to be able to launch

@nelsonic nelsonic removed their assignment Feb 11, 2017
@ritz078
Copy link
Contributor

ritz078 commented Mar 14, 2017

@nelsonic Tests running on Travis with saucelabs
screen shot 2017-03-15 at 1 27 23 am

Here is the full code ritz078/embed-js#228

@nelsonic
Copy link
Member Author

nelsonic commented Mar 15, 2017

@ritz078 nice one. 👍
If you have time to send us a Pull Request explaining the steps to get it setup using sauce connect, it would be massively appreciated! ❤️
(once PR is merged we can send you PayPal or Amazon credit 😉 )

@ritz078
Copy link
Contributor

ritz078 commented Mar 15, 2017

I will create a PR.

@nelsonic
Copy link
Member Author

@ritz078 thank you for your fantastic contribution! 👍
I have reviewed & merged your Pull Request. ✅
Please email me to claim your reward! 🥇

tvararu added a commit to alphagov/accessible-autocomplete that referenced this issue May 15, 2017
tvararu added a commit to alphagov/accessible-autocomplete that referenced this issue May 15, 2017
sravan-s added a commit to sravan-s/zeppelin that referenced this issue Jul 11, 2017
@nelsonic nelsonic changed the title Can we run the e2e tests on TravisCI (or other CI)? SPIKE Can we run the e2e tests on TravisCI (or other CI)? Nov 1, 2017
@kalote
Copy link

kalote commented Mar 28, 2018

I just read this full issue that looked like a story ... and that was a super funny one!

Nice job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants