Gulp is a build tool much like Grunt. It caters the need to run tasks for building websites. In addition, you can perform the following tasks related to web development.
- Reloading the browser (After the file is saved)
- Using SaaS and other preprocessors
- Optimizing assets (JavaScript, Images, CSS)
- Spinning up a web server
Coming to protractor, you can run multiple JavaScript files containing protractor script using this tool. To implement gulp on protractor script, follow the following steps.
- Use webstorm editor to open the project. Right-click on project name to add a new folder.
- Name the folder “Test’ and click OK.
- Drag the test.js file into the test folder. This will display the Move window. Click OK to complete the process.
- Right-click the file name and go to Refactor->Rename to rename the test.js file.
Provide a file name and click Refactor button.
- Right-click on folder and add another js file in the test folder.
- Enter the file name and click OK.
- Write the following code in the testsub.js file.
- Modify the gulp.src() method in gulpfile.js file by writing the following code.
- All the files with .js extension will be included and executed.
- The guplfile.js will look like the following.
- Start Selenium server using the following command.
- Run the following command to run protractor script.