In our previous post we see how we can run multiple javascript file. There we have started our selenium server by typing the following command at the terminal and pressing enter button. Every time we have to run it manually when executing our protractor script.
Gulp can handle the problem and it can run automatically when our protractor scripts start executing.
We have to add the following code in our gulpfile.js file.
Step 1 : At first add two variables like the following,
First one is for updating webdriver and second one is for starting Selenium server.
Step 2 : Now add this two task like the following,
Step 3 : Now modify default gulp.task() method.
Note that we have added two variables ‘webdriver_update’ and ‘webdriver_standalone’ as gulp.task() argument so that it runs first and then run the default task that means protractor script.
Step 4 : Now gulpfile.js file looks like the following,
Step 5 : Now run the protractor script using only gulp command and do not need to run selenium standalone server using manual command.
It first update selenium webdriver and then start the selenium standalone server. After that it starts executing protractor script.
That’s all from here. We will discuss more on gulp and protractor in future.
Happy UI Testing with Protractor!!!
No comments:
Post a Comment