Closed nelsonic closed 7 years ago
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
Looks like Travis-CI is not going to be an option... see: https://github.com/travis-ci/travis-ci/issues/4090 (for now...)
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
Setting the language to Java did not work ... https://travis-ci.org/nelsonic/learn-nightwatch#L417
attempting: https://docs.travis-ci.com/user/customizing-the-build/#Installing-a-Second-Programming-language linked to by: http://superuser.com/questions/993718/can-i-install-java-8-on-travis-ci-for-a-python-project#comment1405598_993718
Note: This works on CodeShip without any issues: Codeship passes while Travis Fails... https://travis-ci.org/nelsonic/learn-nightwatch/builds/137568733#L138
Travis is pure frustration ... 😞 https://travis-ci.org/nelsonic/learn-nightwatch/builds/137568733#L138
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
Attempt to use https://github.com/angular/webdriver-manager to run selenium...
Check status of selenium server before running the tests: http://localhost:4444/wd/hub/status
Selenium is Running! https://travis-ci.org/nelsonic/learn-nightwatch/builds/137849262
But I cannot access it!
When we attempt to start selenium in nightwatch.json
we get: https://travis-ci.org/nelsonic/learn-nightwatch/builds/137876826#L192
Trying the advice in: https://github.com/travis-ci/travis-ci/issues/2843 to sleep ...
before running the tests!
https://travis-ci.org/nelsonic/learn-nightwatch/builds/137880716#L245 Ok, I'm shelving this for now. Its taken way too much time to do something that should be simple...!! These guys appear to have it working: https://github.com/Khan/KaTeX/blob/master/.travis.yml which lead me to: https://github.com/SeleniumHQ/docker-selenium
But I don't have time to investigate this further today... if anyone else has time to try and debug this, please go for it! $100 bounty for successfully running Selenium (Nightwatch) tests on Travis-CI. 💲
Sadly, Travis-CI is still not cooperating: https://travis-ci.org/nelsonic/learn-nightwatch/builds/140380579#L205
Appears we nee to use Xvfb
see: http://stackoverflow.com/a/23673054/1148249
See instructions on Travis-CI: https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI
Adding Xvfb
as instructed by Travis-CI did not work. https://travis-ci.org/nelsonic/learn-nightwatch/builds/140396366
I really don't have time to mess about with Travis-CI anymore ... if anyone wants to pitch in and figure this out I have £100 with your name on it. (preferably with the ability to take/save screenshots...)
This was the state before I gave up: my .travis.yml
file:
language: node_js
node_js:
- 4.4.6
before_install:
- java -version
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
Outcome:
@des-des / @jrans you gents appear to have some practice/experience of using Nightwatch in cmt-integration
... if you have time to look at this, just invoice me for how ever long it takes you to get it working! 😉
@nelsonic would a PR for this still be welcome? Think I might give it a go.
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.
@amilajack I think the error relates to the latest version of download
not working with node v6
see: https://github.com/dwyl/learn-nightwatch/issues/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)
@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
It could be because we're running ours through saucelabs
@Danwhy next time we're in the same room please walk me through it so I understand. thanks! 😉
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: https://github.com/Autodesk/molecule-2d-for-react/pull/15
@justinmc nice work! thanks for confirming you got it working with PhantomJS! 👍
@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...
@nelsonic 👍 I'll do the same for the karma spike
Hello guys,
I've been able to make it work with Chrome in Travis: https://github.com/abecms/abecms/blob/master/.travis.yml
You have to use the beta build from travis
sudo: required
dist: trusty
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
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 ;)
Since this issue was made this short piece has been added to the readme. "Running your Nightwatch tests on CircleCi."
@gregorybesson Thanks, it works! For me the deciding part seems to have been export DISPLAY and starting xvfb.
@qacwnfq U welcome. Indeed, we must start xvfb for chrome to be able to launch
@nelsonic Tests running on Travis with saucelabs
Here is the full code https://github.com/ritz078/embed.js/pull/228
@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 😉 )
I will create a PR.
@ritz078 thank you for your fantastic contribution! 👍 I have reviewed & merged your Pull Request. ✅ Please email me to claim your reward! 🥇
I just read this full issue that looked like a story ... and that was a super funny one!
Nice job!
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...