Protractor end to end testing for AngularJS -Protractor Setup with Eclipse
Protractor is an end-to-end test framework for AngularJS applications. Protractor is a Node.js program that supports the Jasmine and Mocha test frameworks.
Selenium is a browser automation framework. Selenium includes the Selenium Server, the WebDriver APIs, and the WebDriver browser drivers.
- Lets start Protractor Setup with Eclipse
- Download the Node.js .msi Installer click here
- Verify Nodejs is installed by writing command in comman line as node –version
Setting Up Protractor
- During Protractor Setup with Eclipse After installing Nodejs you have to install Protractor NPM package.
- Protractor is a Node.js program. To run Protractor, you will need to have Node.js installed.
- Type in command line npm install -g protractor
- Verify Protractor is installed correctly with command protractor –version.
- Protractor installation includes protractor and webdriver-manager command line tool.
- The webdriver-manager is a helper tool to easily get an instance of a Selenium Server running.
- You also have to update webdriver manager for that type in command line webdriver-manager update
- After this to start webdriver manager you have to type command webdriver-manager start
- This will start up a Selenium Server and will output a bunch of info logs.
- You can see information about the status of the server by typing http://localhost:4444 into the browser url.
Configuring Eclipse to run Protractor
- First we will have to install below plugins from eclipse Marketplace
- Anjularjs plugin
- Batch Editor plugin
- Tern eclipse IDE plugin
- You will find the conf.js and example_spec.js files at path C:\ Users \ Admin\ AppData \Roaming \ npm \ node_modules \ protractor \ example
- After copying conf.js and example_spec.js files.
- Right click on project -> configure ->click on convert to tern Project. As shown below.
- After clicking on convert to tern project you will get pop up window as shown on left image
- Select the options AnjularJs , Jasmine and Protractor from the list and click on OK button after this our project will get converted into tern project.
- To run the project we need to make a bat file
Creating bat file to Run project
- To create bat file Right click on Project ->New ->file-> give file name as ProtractorRunner.bat ->Click Finish
- Inside bat file write the one line of code ” protractor conf.js “
- To run bat file we need to make below configurations
- Select click ProtractorRunner.bat file and click on External Tools Configurations as highlighted below
- In main tab click on Browse Workspace and give the path of ProtractorRunner.bat
- Similarly in main tab for Working directory click on Browse Workspace and select the project folder as shown in below image.
- After this click on run button after this program should run successfully if you face any issue let me know in comment section.
- Protractor Setup with Eclipse is completed here
Protractor for AnjularJS (Part-1 ) Protractor Setup with Eclipse
Protractor for AnjularJS (Part-2 ) | Protractor Setup with Eclipse