SlideShare a Scribd company logo
Presented By :
Komal Rajpal
&
Gaurav Kumar Shukla
Agenda
1. Introduction of Protractor
2. Why Protractor
3. Pros And Cons of Protractor
4. Protractor Architecture
5. Set up and Configurations
6. Locator Strategy
7. Design Pattern
8. Protractor Control Flow And Promises
9. Testing Non-Angular Apps With Protractor
10.Demo
Protractor
● Protractor is an end-to-end test framework for Angular and AngularJS
applications.
● Protractor runs tests against your application running in a real browser,
interacting with it as a user would.
● Webdriver + Angular = Protractor
Why Protractor
● Test like a user: Protractor is built on top of WebDriverJS, which uses native events and
browser-specific drivers to interact with your application as a user would.
● For Angular Application: Protractor supports Angular-specific locator strategies,
which allows you to test Angular-specific elements without any setup effort on your part.
● Automatic Waiting: No longer need to add waits and sleeps to your test. Protractor can
automatically execute the next step in your test the moment the webpage finishes pending
tasks, so you don’t have to worry about waiting for your test and webpage to sync.
● Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng-
model.., etc. which are not included in Selenium locators.
● Selenium is not able to identify those web elements using Selenium code. So, Protractor on
the top of Selenium can handle and controls those attributes in Web Applications.
Pros of Protractor
● Protractor has built in support for identifying the elements for angular.js
● Suitable for both Angular and non-Angular apps, Switching between them
also easier
● Supports Parallel testing through the same and cross-browser testing.
● The protractor has default waits, which waits for angular element, which
is not present in selenium. Protractor handles this with promises
● It runs on real browsers and headless browsers.
● Works on NodeJS, so the asynchronous process helps to speed up the
execution
● Compatible with Continuous integration
Cons of Protractor
● If there is an issue with WebdriverJs, the Protractor team should wait for
the WebDriverJs team to fix that issue. Protractor is built on webdriverJS
● Works like a duck when we run tests in Internet explorer
● You cannot simulate real user (which is possible in selenium using robot
class)
● Debugging in Protractor is a nightmare
● Could take some time to master all API and technicals if you are not from
selenium background
● It does not have support to automate mobile Apps.
Protractor Architecture
Protractor Setup
Follow below steps to install protractor:
● Install Protractor: Use npm to install Protractor globally with:
○ npm install -g protractor
// This will install two command line tools:
■ Protractor
■ Webdriver-Manager
● Download necessary binaries: The webdriver-manager is a helper tool to easily get an instance of a Selenium Server
running. Use it to download the necessary binaries with:
○ webdriver-manager update
● Start up the server: Start up a server with:
○ webdriver-manager start
// This will start up a Selenium Server and will output a bunch of info logs. Your Protractor test will send requests
to this server to control a local browser.
● Run Protractor Test: Run the test with:
○ protractor conf.js
Locator Strategy
● These locators should be used as a priority when possible:
○ Binding locator:
■ Syntax: by.binding('bind value');
Ex:
● by.binding('user.password')
● by.binding('user.email')
○ Exact Binding locator:
■ Syntax: by.exactBinding('exact bind value')
Ex:
● by.exactBinding('user.password')
● by.exactBinding('password') // Will not work
● Some more...
○ Model locator
■ Syntax: by.model('model value')
Ex:
● by.model('user.username')
○ Button text locator
■ Syntax: by.buttonText('button text')
Ex:
● by.buttonText('Sign In')
○ Partial button text locator
■ Syntax: by.partialButtonText('partial button text')
Ex:
● by.partialButtonText('Register')
● Some more...
○ Repeater locator
■ Syntax: by.repeater('repeater value')
Ex:
● by.repeater('review in reviews')
○ Exact repeater locator
■ Syntax: by.exactRepeater('exact repeater value')
Ex:
● by.exactRepeater('review in reviews')
● by.exactRepeater('reviews') // Won't work
○ CSS and text locator
■ Syntax: by.cssContainingText('css selector', 'text of css element')
Ex:
● by.cssContainingText('.users', 'Rebecca') // Will return the second li only
Protractor Design Pattern
● Page objects is a design pattern which results in less code duplicates, easy
maintenance and more readability.
Protractor Configurations | Conf.js
var config = {};
var timeout = 120000;
config.framework = 'jasmine2';
config.allScriptsTimeout = timeout;
config.getPageTimeout = timeout;
config.jasmineNodeOpts.isVerbose = true;
config.jasmineNodeOpts.defaultTimeoutInterval = timeout;
config.specs = ['qa/**/*Spec.js'];
config.browserName = 'chrome';
exports.config = config;
Some configurations
● Selenium Configuration:
○ seleniumServerJar: 'D:/Eclipse progs/jars/selenium-server-standalone-3.11.0.jar',
○ seleniumServerStartTimeout:20000, // 20 seconds
○ localSeleniumStandaloneOpts:
■ jvmArgs: ['-Dwebdriver.ie.driver=IEDriverServer_Win32_2.53.1.exe']
○ directConnect: false/true
Protractor tests Parameters in Conf.js file
● Specs:
○ specs: ['D:Protractor Demospecs est.js']
○ specs: ['D:Protractor Demospecs*.js'] // will run all the files with js extension
● Excludes:
○ exclude: ['D:Protractor Demospecsdummytest.js']
● Suites:
suites: {
smoke: 'spec/smoketests/*.js',
sanity: 'spec/sanitytests/*.js',
full: 'spec/*.js'
}
Protractor Control Flow and Promises
it('should find an element by text input model', function() {
browser.get('app/index.html#/form');
var username = element(by.model('username'));
username.clear();
username.sendKeys('Jane Doe');
var name = element(by.binding('username'));
expect(name.getText()).toEqual('Jane Doe');
// Point A
});
Testing Non Angular Apps with Protractor.
● Protractor is made for testing Angular applications. However, it is still possible to test non-angular applications with
Protractor if needed.
● Changes needed to test non-angular app with Protractor
○ Use browser.driver.ignoreSynchronization = true
○ Use browser.driver instead of driver
● Protractor waits for angular components to load completely on a web-page befor it begins any execution. However,
since our pages are non-angular, Protractor keeps waiting for 'angular' to load till the test fails with timeout. So, we need
to explicitly tell the Protractor to not to wait for 'angular'
References:
● http://www.protractortest.org/#/
● https://www.udemy.com/course/protractor-tutorial/
● https://rap.knoldus.com/
Thank You.
^.^

More Related Content

PPTX
Protractor
Artem Chechoro
 
PPTX
Angular 2 Migration - JHipster Meetup 6
William Marques
 
PDF
Adventures with Angular 2
Dragos Ionita
 
PDF
Insights on Protractor testing
Dejan Toteff
 
PPTX
Automated Smoke Tests with Protractor
🌱 Dale Spoonemore
 
PPT
Testing in AngularJS
Peter Drinnan
 
PDF
Angular 2 : le réveil de la force
Nicolas PENNEC
 
PDF
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
 
Protractor
Artem Chechoro
 
Angular 2 Migration - JHipster Meetup 6
William Marques
 
Adventures with Angular 2
Dragos Ionita
 
Insights on Protractor testing
Dejan Toteff
 
Automated Smoke Tests with Protractor
🌱 Dale Spoonemore
 
Testing in AngularJS
Peter Drinnan
 
Angular 2 : le réveil de la force
Nicolas PENNEC
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
 

What's hot (20)

PDF
Introducing Playwright's New Test Runner
Applitools
 
PPTX
Test-Driven JavaScript Development (JavaZone 2010)
Christian Johansen
 
PPTX
Life Cycle hooks in VueJs
Squash Apps Pvt Ltd
 
PDF
Unit Testing your React / Redux app (@BucharestJS)
Alin Pandichi
 
PDF
Protractor: Tips & Tricks
Sergey Bolshchikov
 
PPTX
Protractor framework architecture with example
shadabgilani
 
PDF
Unit Testing in JavaScript with MVC and QUnit
Lars Thorup
 
PDF
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
JSC “Arcadia Inc”
 
PDF
Efficient JavaScript Unit Testing, May 2012
Hazem Saleh
 
PPTX
Unit testing on mobile apps
Buşra Deniz, CSM
 
PDF
Angular 2... so can I use it now??
Laurent Duveau
 
PDF
JavaScript + Jenkins = Winning!
Eric Wendelin
 
PDF
Automated Testing in Angular Slides
Jim Lynch
 
PDF
Javascript tdd byandreapaciolla
Andrea Paciolla
 
PDF
Angular testing
Raissa Ferreira
 
PDF
Angular 2 - Core Concepts
Fabio Biondi
 
PPTX
Intro to java test frameworks
Lim Sim
 
PDF
Automated Web Testing using JavaScript
Simon Guest
 
PDF
Сергей Больщиков "Protractor Tips & Tricks"
Fwdays
 
PPTX
Beginner's guide to Selenium
Lim Sim
 
Introducing Playwright's New Test Runner
Applitools
 
Test-Driven JavaScript Development (JavaZone 2010)
Christian Johansen
 
Life Cycle hooks in VueJs
Squash Apps Pvt Ltd
 
Unit Testing your React / Redux app (@BucharestJS)
Alin Pandichi
 
Protractor: Tips & Tricks
Sergey Bolshchikov
 
Protractor framework architecture with example
shadabgilani
 
Unit Testing in JavaScript with MVC and QUnit
Lars Thorup
 
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
JSC “Arcadia Inc”
 
Efficient JavaScript Unit Testing, May 2012
Hazem Saleh
 
Unit testing on mobile apps
Buşra Deniz, CSM
 
Angular 2... so can I use it now??
Laurent Duveau
 
JavaScript + Jenkins = Winning!
Eric Wendelin
 
Automated Testing in Angular Slides
Jim Lynch
 
Javascript tdd byandreapaciolla
Andrea Paciolla
 
Angular testing
Raissa Ferreira
 
Angular 2 - Core Concepts
Fabio Biondi
 
Intro to java test frameworks
Lim Sim
 
Automated Web Testing using JavaScript
Simon Guest
 
Сергей Больщиков "Protractor Tips & Tricks"
Fwdays
 
Beginner's guide to Selenium
Lim Sim
 
Ad

Similar to Protractor End To End Testing For AngularJS (20)

PDF
Playwright Testing Guide for QA Engineers.pdf
jamescantor38
 
PPTX
Introduction to Protractor - Habilelabs
HabileLabs
 
PDF
WebDriverIO Tutorial for Selenium Automation.pdf
kalichargn70th171
 
PDF
Selenium Online Training.pdf
SpiritsoftsTraining
 
PDF
Selenium Online Training.pdf
SpiritsoftsTraining
 
PDF
Selenium Online Training.pdf
SpiritsoftsTraining
 
PDF
Selenium Online Training.pdf
SpiritsoftsTraining
 
PPTX
Protractor overview
Abhishek Yadav
 
PDF
Selenium Online Training.pdf
SpiritsoftsTraining
 
PPTX
Presentation_Protractor
Umesh Randhe
 
PPTX
test_automation_POC
Rafael Battesti
 
PDF
Moving from selenium to protractor for test automation
Zoe Gilbert
 
PPTX
Protractor for angularJS
Krishna Kumar
 
PDF
Node.js and Selenium Webdriver, a journey from the Java side
Mek Srunyu Stittri
 
PDF
Workshop 14: AngularJS Parte III
Visual Engineering
 
PPTX
Cypress for Testing
PoojaSingh1123
 
PDF
Nightwatch.js (vodQA Shots - Pune 2017)
Smriti Tuteja
 
PDF
Performance testing with jmeter
Knoldus Inc.
 
DOCX
Protractor end-to-end testing framework for angular js
codeandyou forums
 
PDF
JSFest 2019: Technology agnostic microservices at SPA frontend
Vlad Fedosov
 
Playwright Testing Guide for QA Engineers.pdf
jamescantor38
 
Introduction to Protractor - Habilelabs
HabileLabs
 
WebDriverIO Tutorial for Selenium Automation.pdf
kalichargn70th171
 
Selenium Online Training.pdf
SpiritsoftsTraining
 
Selenium Online Training.pdf
SpiritsoftsTraining
 
Selenium Online Training.pdf
SpiritsoftsTraining
 
Selenium Online Training.pdf
SpiritsoftsTraining
 
Protractor overview
Abhishek Yadav
 
Selenium Online Training.pdf
SpiritsoftsTraining
 
Presentation_Protractor
Umesh Randhe
 
test_automation_POC
Rafael Battesti
 
Moving from selenium to protractor for test automation
Zoe Gilbert
 
Protractor for angularJS
Krishna Kumar
 
Node.js and Selenium Webdriver, a journey from the Java side
Mek Srunyu Stittri
 
Workshop 14: AngularJS Parte III
Visual Engineering
 
Cypress for Testing
PoojaSingh1123
 
Nightwatch.js (vodQA Shots - Pune 2017)
Smriti Tuteja
 
Performance testing with jmeter
Knoldus Inc.
 
Protractor end-to-end testing framework for angular js
codeandyou forums
 
JSFest 2019: Technology agnostic microservices at SPA frontend
Vlad Fedosov
 
Ad

More from Knoldus Inc. (20)

PPTX
Angular Hydration Presentation (FrontEnd)
Knoldus Inc.
 
PPTX
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Knoldus Inc.
 
PPTX
Self-Healing Test Automation Framework - Healenium
Knoldus Inc.
 
PPTX
Kanban Metrics Presentation (Project Management)
Knoldus Inc.
 
PPTX
Java 17 features and implementation.pptx
Knoldus Inc.
 
PPTX
Chaos Mesh Introducing Chaos in Kubernetes
Knoldus Inc.
 
PPTX
GraalVM - A Step Ahead of JVM Presentation
Knoldus Inc.
 
PPTX
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
PPTX
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
PPTX
DAPR - Distributed Application Runtime Presentation
Knoldus Inc.
 
PPTX
Introduction to Azure Virtual WAN Presentation
Knoldus Inc.
 
PPTX
Introduction to Argo Rollouts Presentation
Knoldus Inc.
 
PPTX
Intro to Azure Container App Presentation
Knoldus Inc.
 
PPTX
Insights Unveiled Test Reporting and Observability Excellence
Knoldus Inc.
 
PPTX
Introduction to Splunk Presentation (DevOps)
Knoldus Inc.
 
PPTX
Code Camp - Data Profiling and Quality Analysis Framework
Knoldus Inc.
 
PPTX
AWS: Messaging Services in AWS Presentation
Knoldus Inc.
 
PPTX
Amazon Cognito: A Primer on Authentication and Authorization
Knoldus Inc.
 
PPTX
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Knoldus Inc.
 
PPTX
Managing State & HTTP Requests In Ionic.
Knoldus Inc.
 
Angular Hydration Presentation (FrontEnd)
Knoldus Inc.
 
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Knoldus Inc.
 
Self-Healing Test Automation Framework - Healenium
Knoldus Inc.
 
Kanban Metrics Presentation (Project Management)
Knoldus Inc.
 
Java 17 features and implementation.pptx
Knoldus Inc.
 
Chaos Mesh Introducing Chaos in Kubernetes
Knoldus Inc.
 
GraalVM - A Step Ahead of JVM Presentation
Knoldus Inc.
 
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
DAPR - Distributed Application Runtime Presentation
Knoldus Inc.
 
Introduction to Azure Virtual WAN Presentation
Knoldus Inc.
 
Introduction to Argo Rollouts Presentation
Knoldus Inc.
 
Intro to Azure Container App Presentation
Knoldus Inc.
 
Insights Unveiled Test Reporting and Observability Excellence
Knoldus Inc.
 
Introduction to Splunk Presentation (DevOps)
Knoldus Inc.
 
Code Camp - Data Profiling and Quality Analysis Framework
Knoldus Inc.
 
AWS: Messaging Services in AWS Presentation
Knoldus Inc.
 
Amazon Cognito: A Primer on Authentication and Authorization
Knoldus Inc.
 
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Knoldus Inc.
 
Managing State & HTTP Requests In Ionic.
Knoldus Inc.
 

Recently uploaded (20)

PDF
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PDF
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PDF
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PDF
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
PDF
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
Applitools Platform Pulse: What's New and What's Coming - July 2025
Applitools
 
Exploring AI Agents in Process Industries
amoreira6
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Bandai Playdia The Book - David Glotz
BluePanther6
 

Protractor End To End Testing For AngularJS

  • 1. Presented By : Komal Rajpal & Gaurav Kumar Shukla
  • 2. Agenda 1. Introduction of Protractor 2. Why Protractor 3. Pros And Cons of Protractor 4. Protractor Architecture 5. Set up and Configurations 6. Locator Strategy 7. Design Pattern 8. Protractor Control Flow And Promises 9. Testing Non-Angular Apps With Protractor 10.Demo
  • 3. Protractor ● Protractor is an end-to-end test framework for Angular and AngularJS applications. ● Protractor runs tests against your application running in a real browser, interacting with it as a user would. ● Webdriver + Angular = Protractor
  • 4. Why Protractor ● Test like a user: Protractor is built on top of WebDriverJS, which uses native events and browser-specific drivers to interact with your application as a user would. ● For Angular Application: Protractor supports Angular-specific locator strategies, which allows you to test Angular-specific elements without any setup effort on your part. ● Automatic Waiting: No longer need to add waits and sleeps to your test. Protractor can automatically execute the next step in your test the moment the webpage finishes pending tasks, so you don’t have to worry about waiting for your test and webpage to sync.
  • 5. ● Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng- model.., etc. which are not included in Selenium locators. ● Selenium is not able to identify those web elements using Selenium code. So, Protractor on the top of Selenium can handle and controls those attributes in Web Applications.
  • 6. Pros of Protractor ● Protractor has built in support for identifying the elements for angular.js ● Suitable for both Angular and non-Angular apps, Switching between them also easier ● Supports Parallel testing through the same and cross-browser testing. ● The protractor has default waits, which waits for angular element, which is not present in selenium. Protractor handles this with promises ● It runs on real browsers and headless browsers. ● Works on NodeJS, so the asynchronous process helps to speed up the execution ● Compatible with Continuous integration
  • 7. Cons of Protractor ● If there is an issue with WebdriverJs, the Protractor team should wait for the WebDriverJs team to fix that issue. Protractor is built on webdriverJS ● Works like a duck when we run tests in Internet explorer ● You cannot simulate real user (which is possible in selenium using robot class) ● Debugging in Protractor is a nightmare ● Could take some time to master all API and technicals if you are not from selenium background ● It does not have support to automate mobile Apps.
  • 9. Protractor Setup Follow below steps to install protractor: ● Install Protractor: Use npm to install Protractor globally with: ○ npm install -g protractor // This will install two command line tools: ■ Protractor ■ Webdriver-Manager ● Download necessary binaries: The webdriver-manager is a helper tool to easily get an instance of a Selenium Server running. Use it to download the necessary binaries with: ○ webdriver-manager update ● Start up the server: Start up a server with: ○ webdriver-manager start // This will start up a Selenium Server and will output a bunch of info logs. Your Protractor test will send requests to this server to control a local browser. ● Run Protractor Test: Run the test with: ○ protractor conf.js
  • 10. Locator Strategy ● These locators should be used as a priority when possible: ○ Binding locator: ■ Syntax: by.binding('bind value'); Ex: ● by.binding('user.password') ● by.binding('user.email') ○ Exact Binding locator: ■ Syntax: by.exactBinding('exact bind value') Ex: ● by.exactBinding('user.password') ● by.exactBinding('password') // Will not work
  • 11. ● Some more... ○ Model locator ■ Syntax: by.model('model value') Ex: ● by.model('user.username') ○ Button text locator ■ Syntax: by.buttonText('button text') Ex: ● by.buttonText('Sign In') ○ Partial button text locator ■ Syntax: by.partialButtonText('partial button text') Ex: ● by.partialButtonText('Register')
  • 12. ● Some more... ○ Repeater locator ■ Syntax: by.repeater('repeater value') Ex: ● by.repeater('review in reviews') ○ Exact repeater locator ■ Syntax: by.exactRepeater('exact repeater value') Ex: ● by.exactRepeater('review in reviews') ● by.exactRepeater('reviews') // Won't work ○ CSS and text locator ■ Syntax: by.cssContainingText('css selector', 'text of css element') Ex: ● by.cssContainingText('.users', 'Rebecca') // Will return the second li only
  • 13. Protractor Design Pattern ● Page objects is a design pattern which results in less code duplicates, easy maintenance and more readability.
  • 14. Protractor Configurations | Conf.js var config = {}; var timeout = 120000; config.framework = 'jasmine2'; config.allScriptsTimeout = timeout; config.getPageTimeout = timeout; config.jasmineNodeOpts.isVerbose = true; config.jasmineNodeOpts.defaultTimeoutInterval = timeout; config.specs = ['qa/**/*Spec.js']; config.browserName = 'chrome'; exports.config = config;
  • 15. Some configurations ● Selenium Configuration: ○ seleniumServerJar: 'D:/Eclipse progs/jars/selenium-server-standalone-3.11.0.jar', ○ seleniumServerStartTimeout:20000, // 20 seconds ○ localSeleniumStandaloneOpts: ■ jvmArgs: ['-Dwebdriver.ie.driver=IEDriverServer_Win32_2.53.1.exe'] ○ directConnect: false/true
  • 16. Protractor tests Parameters in Conf.js file ● Specs: ○ specs: ['D:Protractor Demospecs est.js'] ○ specs: ['D:Protractor Demospecs*.js'] // will run all the files with js extension ● Excludes: ○ exclude: ['D:Protractor Demospecsdummytest.js'] ● Suites: suites: { smoke: 'spec/smoketests/*.js', sanity: 'spec/sanitytests/*.js', full: 'spec/*.js' }
  • 17. Protractor Control Flow and Promises it('should find an element by text input model', function() { browser.get('app/index.html#/form'); var username = element(by.model('username')); username.clear(); username.sendKeys('Jane Doe'); var name = element(by.binding('username')); expect(name.getText()).toEqual('Jane Doe'); // Point A });
  • 18. Testing Non Angular Apps with Protractor. ● Protractor is made for testing Angular applications. However, it is still possible to test non-angular applications with Protractor if needed. ● Changes needed to test non-angular app with Protractor ○ Use browser.driver.ignoreSynchronization = true ○ Use browser.driver instead of driver ● Protractor waits for angular components to load completely on a web-page befor it begins any execution. However, since our pages are non-angular, Protractor keeps waiting for 'angular' to load till the test fails with timeout. So, we need to explicitly tell the Protractor to not to wait for 'angular'