Steps to Test an Angular Website using Protractor

Steps to Test an Angular Website using Protractor

Step 1:- Install and Setup Protractor on Windows Machine Link

Step 2:- Download WebStorm Link

Step 3:- Install and Setup WebStorm

Step 4:- Launch WebStorm

Step 5:- Click on File –> New –> Project

Step 6:- Select “Empty Project”

Step 7:- Enter the desired name of the project. e.g. Demo

Step 8:- Click on “Create”.

Step 9:- Now create a new directory under your project.

Select Your project –> Right Click on New –> Click on Directory –> Enter the desired name of your Directory

                                 Create a New Directory

Here the name of the directory is DemoDirectory

Step 10:- Create a new “JavaScript file” under the newly created directory and name them conf.js

Step 11:- Create a new sub-directory under the directory DemoDirectory” . Here the name of the sub-directory is fame1

Step 12:- Now add two JavaScript file under sub-directory fame1, login.po and login.spec respectively. Complete Structure of the Demo project is shown below:-

                                      Structure

Step 13:- login.po.js file is used as an Object Repository where you can add the page objects as well as the actions performed on that objects.

Step 14:- login.spec.js file is used to create test cases.

Steps 15:- Setup of conf.js file

Steps 16:- Setup of login.po file

Steps 17:- Setup of login.spec file

Steps 18:- Now your basic project code with their config file is setup.

Steps 19:- To run a Protractor Project, we have to update the selenium server first using below mentioned command in command prompt

webdriver-manager update

Steps 20:- After updating the webdriver-manager , we have to start it using below mentioned command in command prompt

             webdriver-manager start

Steps 21:- Once the server is started, open a new command prompt and go to the specified location of the project and enter below mentioned command to run the Protractor project

    C:UsersVikasWebstormProjectsDemo>protractor conf.js

After following all the above mentioned steps you will be able to run your first test successfully.

Link to Download or Clone the above code from Git

Leave a Reply

%d bloggers like this: