Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use Protractor with Github/Travis CI without SauceLabs

I've signed up to Travis CI for private repositories. All my current tests are PHP based but I wish to test my Angular/2 CLI frontend solution using protractor. I've been googling around and keep seeing "Saucelabs" as an additional tool.

Do I need to sign up to saucelabs or a.n.other 3rd party provider in order to run protractor with a github/travis? Any idiot-friendly articles for a novice?

Many thanks.

like image 845
prime Avatar asked Oct 29 '22 13:10

prime


1 Answers

You don't need to sign up for Saucelabs. You can set up your Travis CI build with a Virtual Framebuffer to imitate a display.

You will need to add the following to your .travis.yml:

before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3 # give xvfb some time to start

Firefox is installed in all Travis CI containers, so you will only need to start a web server after this in the before_script section that will start your application and then you can run your Protractor tests.

For more details, you can check this: https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI

like image 192
szmeti Avatar answered Nov 15 '22 06:11

szmeti