Protractor
Protractor
Protractor
Index-
1. Introduction
2. Setup
3. Sample Test
4. Integration of Protractor with Omnichannel
5. References
Introduction-
Protractor is an end-to-end test framework for AngularJS applications. Protractor
runs tests against the application running in a real browser, interacting with it as a
user would. It is a Node.js program, and runs end-to-end tests that are also written
in JavaScript and run with node.
Automatic Waiting
There is no need to add waits and sleeps to tests. Protractor can automatically
execute the next step in test the moment the webpage finishes pending tasks, so we
don’t have to worry about waiting for test and webpage to sync.
Setup-
Prerequisites:
Note: To successfully install/run prefer latest versions
1. Node.js
2. Java Development Kit (JDK)
3. Git
4. Sublime/Nodepad++ (Any editor which you prefer)
Steps for Installation:
1.Use npm to install Protractor globally with:
npm install –g protractor
This will install two command line
tools, protractor and webdriver-manager. The webdriver-manager is a helper tool to
easily get an instance of a Selenium Server running.
Snippet of conf.js:
Snippet of spec.js:
To Run a Test-
1. Open GitBash.
2. Write “webdriver-manager start”.
3. Open another GitBash.
4. Write “protractor conf.js”.
Output on console:
The functional folder consists of 4 subfolders and a configuration file in which the
path to the script to be executed is specified.
1. DataRepo- The folder contains the csv files (comma separated values) that
provides the data needed by the scripts during execution.
Here under data Repo folder we have subfolder according to the
environment present for the system. Each environment has data repos
corresponding to each LOB. For example, for VAN LOB we have
VanDataRepo.csv.
The first column in the dataRepo is of the “TestName” which contains the
test ids of the scripts. The other columns in the dataRepo corresponds to the
fields in the system in which the data according to test scenario is provided.
2. Perf- The perf folder has the same csv files which are for capturing the
performance matrix of the
References
1. http://www.protractortest.org/#/
2. https://angular.github.io/protractor/#/
3. https://github.com/angular/protractor
4. https://docs.angularjs.org/guide/e2e-testing