Is there a way to run e2e tests using Protractor and Gulp in a single task?
Right now, in order to run e2e tests, I have to open 3 separate shells and run the following:
webdriver-manager update
webdriver-manager start
npm start (which runs the app server)
protractor protractor.conf.js (in a separate window)
There must be a simpler way of running these tests. Any thoughts?
Yes it's possible.
Just run once command with NPM:
This will install required packages.
Next modify the protractor.conf.js with selenium standalone instead of selenium address:
Now when you run protractor [ config file] like: protractor protractor.conf.js he will start selenium for himself and make tests.
You can implement that into build process, during build with GULP he will fire for you protractor and protractor will fire up selenium-driver himself.
I see that its really tiring to you to run those command, why would you do that even, just use Gulp to make it for you.
I will explain you this on working example.
All you need is:
Add to your (NPM) package.json file: (pick the version that suits you, this works for me.
Then you need the proper config in protractor.conf.js: You need to replace the "seleniumAddress" with direct JAR file so the protractor will fire it for you and attach to it automaticly! piece of file is:
The seleniumServerJar is a reference path to the file which will be installed with "selenium-standalone-jar": "2.45.0", from your package.json file.
And last step is to properly make a gulp task, here's mine:
Enjoy!
Here is a solution that can work
You can run testsuite as well by just adding --suite in 'args'.
A complete solution, (working with Travis CI)
npm
configurationBasically, configure
http-server
to start before you run gulp script. Later on you will have to run the tests vianpm
, fe.npm test
ornpm run <action>
if you choose other name.gulp
withgulp-angular-protractor
Define the action you want to run.
See the above in action in GitHub project: https://github.com/atais/angular-eonasdan-datetimepicker