SlideShare a Scribd company logo
Get a start with
for AngularJS Web Automation
TPC November 2016 Meetup
By Abhishek Yadav (@abhishekkyd)
Agenda
 Overview of Web Automation
 About Protractor
 About AngularJS
 Difference about Protractor over Selenium WebDriver
 Protractor Installation
 Scripting using Protractor for AngularJS Web Automation
 Working with Jasmine and Protractor
 Framework Development using Protractor
Overview of Web Automation
Now a days every organization prefers automated testing once a product reaches to
the stable phase to reduce the testing effort. Since testing cost is an important factor
for any project, organizations have started preferring open source test automation
tools (which have reached a stage where they now rival the commercial ones) instead
of investing in costly commercial testing tools.
A variety of open source automation testing tools is available for almost all types of
testing such as functional, Web, UAT, regression, performance etc. Some open source
tools are Selenium, Cucumber, FitNesse, Sahi, Watir etc).
“Testing is about gaining confidence that your code does what
you think it should do”
About Protractor
 Protractor is an end-to-end test framework for AngularJS applications. Protractor
runs tests against your application running in a real browser, interacting with it as a
user would.
 Protractor is built on top of WebDriverJS, which uses native events and browser-
specific drivers to interact with your application as a user would.
 It also supports non-angular APP.
 With protractor, you can write e2e tests with JavaScript, the language you write
with Angular app.
About Protractor
 Protractor works in conjunction with Selenium to provide an automated test
infrastructure that can simulate a user’s interaction with an Angular application
running in a browser or mobile device.
 it has Angular-specific features
 It's element finders wait for Angular's $digest loop and $http to finish. So you'll
have less chance to struggle with sleep and timing issues.
About AngularJS
AngularJS is what HTML would have been, had it been designed for building web-
apps. Declarative templates with data-binding, MVW, MVVM, MVC, dependency
injection and great testability story all implemented with pure client-side JavaScript!
Difference about Protractor over Selenium
WebDriver
http://www.protractortest.org/#/api?view=ProtractorBy
Protractor Installation
 Download Node.JS http://nodejs.org/download/
node --version
npm install protractor -g
webdriver-manager update
webdriver-manager update –ie
webdriver-manager start
 Configuration, copy following into “conf.js”:
 Test, copy following into “protrator-test.js”:
Scripting using Protractor for AngularJS
Web Automation
describe('angularjs homepage', function() {
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');
element(by.model('yourName')).sendKeys('Julie');
var greeting = element(by.binding('yourName'));
expect(greeting.getText()).toEqual('Hello Julie!');
});
});
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['protrator-test.js']
};
 Capabilities
 Multicapabilities
Scripting using Protractor for AngularJS
Web Automation
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['protrator-test.js']
capabilities: {
'browserName': 'chrome'
},
jasmineNodeOpts: {
showColors: true
}
};
https://github.com/angular/protractor/blob/master/lib/config.ts
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['protrator-test.js']
multiCapabilities:
{
'browserName': ‘firefox'
},
{
'browserName': 'chrome'
},
jasmineNodeOpts: {
showColors: true
}
};
Framework Development using Protractor
 Page Objects - These are the js files where you map the elements and write the
functions to perform actions;
 Exports and Require - This is how you connect your Page Objects to your Test
Specs;
 Test specs - These are the js files where you write your tests using jasmine syntax.
Page Objects
var AngularHomepage = function() {
this.nameInput = element(by.model('yourName')); this.greeting =
element(by.binding('yourName'));
this.get = function() { browser.get('http://www.angularjs.org');
};
this.setName = function(name) {
this.nameInput.sendKeys(name);
};
};
var AngularHomepage = require('homepage.js');
describe('HomePage Tests', function() {
var angularHomepage = new AngularHomepage();
angularHomepage.get();
angularHomepage.nameInput.sendKeys('Rafael');
});
Separate your tests in various test suites
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: {
'browserName': 'chrome‘
},
suites: {
homepage: ‘homepage/*',
search: [‘SearchSpec.js']
},
jasmineNodeOpts: {
showColors: true
}
};
protractor protractor.conf.js --suite homepage
Using OnPrepare
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome‘
},
onPrepare: function() {
browser.driver.manage().window().maximize();
},
jasmineNodeOpts: {
showColors: true
}
};
Using OnPrepare
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome‘
},
onPrepare: function() {
global.mydriver = browser.driver;
mydriver.manage().window().maximize();
},
jasmineNodeOpts: {
showColors: true
}
};
Using params
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome‘
},
// This can be changed via the command line as:
// --params.login.user 'ngrocks'
params: {
login: {
user: 'protractor-br',
password: '#ng123#'
}
},
jasmineNodeOpts: {
showColors: true
}
};
Using params
describe('login page', function() {
var params = browser.params;
it('should login successfully', function() {
element( by.model('username') ).sendKeys( params.login.user );
element( by.model('password') ).sendKeys( params.login.password );
element( by.css('[ng-click="login()"]') ).click();
expect( element(by.binding('username') ).getText() ).toEqual(
params.login.user );
});
});
References
 http://www.protractortest.org/#/
 http://www.protractortest.org/#/api
 https://github.com/angular/protractor
 https://angularjs.org/
 https://jasmine.github.io/2.0/introduction.html
 https://github.com/angular/protractor/blob/master/docs/toc.md
 http://www.ng-newsletter.com/posts/practical-protractor.html
 https://www.youtube.com/watch?v=idb6hOxlyb8
Protractor overview
Protractor overview

More Related Content

What's hot

BDD with Cucumber
BDD with CucumberBDD with Cucumber
BDD with Cucumber
Knoldus Inc.
 
Selenium with Cucumber
Selenium  with Cucumber Selenium  with Cucumber
Selenium with Cucumber
Knoldus Inc.
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 
Playwright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern WebPlaywright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern Web
Applitools
 
Selenium WebDriver training
Selenium WebDriver trainingSelenium WebDriver training
Selenium WebDriver training
Vijay Krishnan Ramaswamy
 
Appium ppt
Appium pptAppium ppt
Appium ppt
natashasweety7
 
Appium: Automation for Mobile Apps
Appium: Automation for Mobile AppsAppium: Automation for Mobile Apps
Appium: Automation for Mobile Apps
Sauce Labs
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
Karapet Sarkisyan
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
Anuraj S.L
 
Selenium
SeleniumSelenium
selenium with python training
selenium with python trainingselenium with python training
selenium with python training
SaiprasadVella
 
Appium
AppiumAppium
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using Selenium
Weifeng Zhang
 
Selenium
SeleniumSelenium
Selenium
Kalyan ch
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
Archana Krushnan
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring Boot
Vincent Kok
 
Cross browser testing with browser stack
Cross browser testing with browser stackCross browser testing with browser stack
Cross browser testing with browser stack
Denys Poloka
 

What's hot (20)

BDD with Cucumber
BDD with CucumberBDD with Cucumber
BDD with Cucumber
 
Selenium with Cucumber
Selenium  with Cucumber Selenium  with Cucumber
Selenium with Cucumber
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Playwright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern WebPlaywright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern Web
 
Selenium WebDriver training
Selenium WebDriver trainingSelenium WebDriver training
Selenium WebDriver training
 
Appium ppt
Appium pptAppium ppt
Appium ppt
 
Appium: Automation for Mobile Apps
Appium: Automation for Mobile AppsAppium: Automation for Mobile Apps
Appium: Automation for Mobile Apps
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Selenium
SeleniumSelenium
Selenium
 
selenium with python training
selenium with python trainingselenium with python training
selenium with python training
 
Appium
AppiumAppium
Appium
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring Boot
 
Cross browser testing with browser stack
Cross browser testing with browser stackCross browser testing with browser stack
Cross browser testing with browser stack
 

Viewers also liked

Protractor: Tips & Tricks
Protractor: Tips & TricksProtractor: Tips & Tricks
Protractor: Tips & Tricks
Sergey Bolshchikov
 
Protractor training
Protractor trainingProtractor training
Protractor training
Sergiy Stotskiy
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJS
Krishna Kumar
 
интернет в социологии важнейшие информационные сайты дадададад)))
интернет в социологии   важнейшие информационные сайты дадададад)))интернет в социологии   важнейшие информационные сайты дадададад)))
интернет в социологии важнейшие информационные сайты дадададад)))faqMEN
 
20150128 angular js_headless_testing
20150128 angular js_headless_testing20150128 angular js_headless_testing
20150128 angular js_headless_testing
Benjamin Neu
 
Protractor end-to-end testing framework for angular js
Protractor   end-to-end testing framework for angular jsProtractor   end-to-end testing framework for angular js
Protractor end-to-end testing framework for angular js
codeandyou forums
 
Advanced Jasmine
Advanced JasmineAdvanced Jasmine
Advanced Jasmine
jbellsey
 
Testing Angular 2 Applications - HTML5 Denver 2016
Testing Angular 2 Applications - HTML5 Denver 2016Testing Angular 2 Applications - HTML5 Denver 2016
Testing Angular 2 Applications - HTML5 Denver 2016
Matt Raible
 
Testing Backbone applications with Jasmine
Testing Backbone applications with JasmineTesting Backbone applications with Jasmine
Testing Backbone applications with Jasmine
Leon van der Grient
 
The sweet smell of jasmine for testing JavaScript
The sweet smell of jasmine for testing JavaScriptThe sweet smell of jasmine for testing JavaScript
The sweet smell of jasmine for testing JavaScript
Emma Armstrong
 
Jasmine framework
Jasmine frameworkJasmine framework
Jasmine framework
Vishwanath KC
 
Automated Acceptance Testing Example
Automated Acceptance Testing ExampleAutomated Acceptance Testing Example
Automated Acceptance Testing Example
Hani Massoud
 
Angular Testing
Angular TestingAngular Testing
Angular Testing
Priscila Negreiros
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Codemotion
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using Protractor
Kasun Kodagoda
 
Selenium Camp 2016
Selenium Camp 2016Selenium Camp 2016
Selenium Camp 2016
Dan Cuellar
 
Advanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit TestingAdvanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit Testing
Lars Thorup
 

Viewers also liked (20)

Protractor: Tips & Tricks
Protractor: Tips & TricksProtractor: Tips & Tricks
Protractor: Tips & Tricks
 
Protractor training
Protractor trainingProtractor training
Protractor training
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJS
 
интернет в социологии важнейшие информационные сайты дадададад)))
интернет в социологии   важнейшие информационные сайты дадададад)))интернет в социологии   важнейшие информационные сайты дадададад)))
интернет в социологии важнейшие информационные сайты дадададад)))
 
20150128 angular js_headless_testing
20150128 angular js_headless_testing20150128 angular js_headless_testing
20150128 angular js_headless_testing
 
Protractor end-to-end testing framework for angular js
Protractor   end-to-end testing framework for angular jsProtractor   end-to-end testing framework for angular js
Protractor end-to-end testing framework for angular js
 
Advanced Jasmine
Advanced JasmineAdvanced Jasmine
Advanced Jasmine
 
Testing Angular 2 Applications - HTML5 Denver 2016
Testing Angular 2 Applications - HTML5 Denver 2016Testing Angular 2 Applications - HTML5 Denver 2016
Testing Angular 2 Applications - HTML5 Denver 2016
 
Testing Backbone applications with Jasmine
Testing Backbone applications with JasmineTesting Backbone applications with Jasmine
Testing Backbone applications with Jasmine
 
The sweet smell of jasmine for testing JavaScript
The sweet smell of jasmine for testing JavaScriptThe sweet smell of jasmine for testing JavaScript
The sweet smell of jasmine for testing JavaScript
 
Jasmine framework
Jasmine frameworkJasmine framework
Jasmine framework
 
Automated Acceptance Testing Example
Automated Acceptance Testing ExampleAutomated Acceptance Testing Example
Automated Acceptance Testing Example
 
Thinking outside the box (SOX)
Thinking outside the box (SOX)Thinking outside the box (SOX)
Thinking outside the box (SOX)
 
Angular Testing
Angular TestingAngular Testing
Angular Testing
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using Protractor
 
Selenium Camp 2016
Selenium Camp 2016Selenium Camp 2016
Selenium Camp 2016
 
Selenium
SeleniumSelenium
Selenium
 
Advanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit TestingAdvanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit Testing
 
Software Testing
Software TestingSoftware Testing
Software Testing
 

Similar to Protractor overview

Moving from selenium to protractor for test automation
Moving from selenium to protractor for test automationMoving from selenium to protractor for test automation
Moving from selenium to protractor for test automation
Zoe Gilbert
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applicationsRashwin
 
Big Improvement_ New AngularJS Tools Changing How We Develop.pdf
Big Improvement_ New AngularJS Tools Changing How We Develop.pdfBig Improvement_ New AngularJS Tools Changing How We Develop.pdf
Big Improvement_ New AngularJS Tools Changing How We Develop.pdf
sarah david
 
Big Improvement_ New AngularJS Tools Changing How We Develop.pptx
Big Improvement_ New AngularJS Tools Changing How We Develop.pptxBig Improvement_ New AngularJS Tools Changing How We Develop.pptx
Big Improvement_ New AngularJS Tools Changing How We Develop.pptx
sarah david
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
Mek Srunyu Stittri
 
quantum_leap_angularjs_tools_redefining_development_in_2023.pdf
quantum_leap_angularjs_tools_redefining_development_in_2023.pdfquantum_leap_angularjs_tools_redefining_development_in_2023.pdf
quantum_leap_angularjs_tools_redefining_development_in_2023.pdf
sarah david
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
Mek Srunyu Stittri
 
quantum_leap_angularjs_tools_redefining_development_in_2023.pptx
quantum_leap_angularjs_tools_redefining_development_in_2023.pptxquantum_leap_angularjs_tools_redefining_development_in_2023.pptx
quantum_leap_angularjs_tools_redefining_development_in_2023.pptx
sarah david
 
Top 5 AngularJS Tool for Application Development
Top 5 AngularJS Tool for Application DevelopmentTop 5 AngularJS Tool for Application Development
Top 5 AngularJS Tool for Application Development
Paul Cook
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Atirek Gupta
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
Agile Testing Alliance
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
AngularJS - A JavaScript Framework
AngularJS - A JavaScript FrameworkAngularJS - A JavaScript Framework
AngularJS - A JavaScript Framework
Tekki Web Solutions Pvt. Ltd.
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
Cubet Techno Labs
 
Javascript-heavy Salesforce Applications
Javascript-heavy Salesforce ApplicationsJavascript-heavy Salesforce Applications
Javascript-heavy Salesforce Applications
Salesforce Developers
 
Top 10 Angular Development Tools For Developers
Top 10 Angular Development Tools For DevelopersTop 10 Angular Development Tools For Developers
Top 10 Angular Development Tools For Developers
Albiorix Technology
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
shadabgilani
 
A Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptx
A Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptxA Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptx
A Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptx
Matthew Allen
 
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Dakiry
 

Similar to Protractor overview (20)

Moving from selenium to protractor for test automation
Moving from selenium to protractor for test automationMoving from selenium to protractor for test automation
Moving from selenium to protractor for test automation
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applications
 
Big Improvement_ New AngularJS Tools Changing How We Develop.pdf
Big Improvement_ New AngularJS Tools Changing How We Develop.pdfBig Improvement_ New AngularJS Tools Changing How We Develop.pdf
Big Improvement_ New AngularJS Tools Changing How We Develop.pdf
 
Big Improvement_ New AngularJS Tools Changing How We Develop.pptx
Big Improvement_ New AngularJS Tools Changing How We Develop.pptxBig Improvement_ New AngularJS Tools Changing How We Develop.pptx
Big Improvement_ New AngularJS Tools Changing How We Develop.pptx
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
 
quantum_leap_angularjs_tools_redefining_development_in_2023.pdf
quantum_leap_angularjs_tools_redefining_development_in_2023.pdfquantum_leap_angularjs_tools_redefining_development_in_2023.pdf
quantum_leap_angularjs_tools_redefining_development_in_2023.pdf
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 
quantum_leap_angularjs_tools_redefining_development_in_2023.pptx
quantum_leap_angularjs_tools_redefining_development_in_2023.pptxquantum_leap_angularjs_tools_redefining_development_in_2023.pptx
quantum_leap_angularjs_tools_redefining_development_in_2023.pptx
 
Top 5 AngularJS Tool for Application Development
Top 5 AngularJS Tool for Application DevelopmentTop 5 AngularJS Tool for Application Development
Top 5 AngularJS Tool for Application Development
 
SatishKumar_Prolifics
SatishKumar_ProlificsSatishKumar_Prolifics
SatishKumar_Prolifics
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
AngularJS - A JavaScript Framework
AngularJS - A JavaScript FrameworkAngularJS - A JavaScript Framework
AngularJS - A JavaScript Framework
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
 
Javascript-heavy Salesforce Applications
Javascript-heavy Salesforce ApplicationsJavascript-heavy Salesforce Applications
Javascript-heavy Salesforce Applications
 
Top 10 Angular Development Tools For Developers
Top 10 Angular Development Tools For DevelopersTop 10 Angular Development Tools For Developers
Top 10 Angular Development Tools For Developers
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
A Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptx
A Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptxA Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptx
A Definitive Guide to Mastering Selenium WebDriver Automation Effectively.pptx
 
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
 

Recently uploaded

The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 

Recently uploaded (20)

The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 

Protractor overview

  • 1. Get a start with for AngularJS Web Automation TPC November 2016 Meetup By Abhishek Yadav (@abhishekkyd)
  • 2. Agenda  Overview of Web Automation  About Protractor  About AngularJS  Difference about Protractor over Selenium WebDriver  Protractor Installation  Scripting using Protractor for AngularJS Web Automation  Working with Jasmine and Protractor  Framework Development using Protractor
  • 3. Overview of Web Automation Now a days every organization prefers automated testing once a product reaches to the stable phase to reduce the testing effort. Since testing cost is an important factor for any project, organizations have started preferring open source test automation tools (which have reached a stage where they now rival the commercial ones) instead of investing in costly commercial testing tools. A variety of open source automation testing tools is available for almost all types of testing such as functional, Web, UAT, regression, performance etc. Some open source tools are Selenium, Cucumber, FitNesse, Sahi, Watir etc). “Testing is about gaining confidence that your code does what you think it should do”
  • 4. About Protractor  Protractor is an end-to-end test framework for AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would.  Protractor is built on top of WebDriverJS, which uses native events and browser- specific drivers to interact with your application as a user would.  It also supports non-angular APP.  With protractor, you can write e2e tests with JavaScript, the language you write with Angular app.
  • 5. About Protractor  Protractor works in conjunction with Selenium to provide an automated test infrastructure that can simulate a user’s interaction with an Angular application running in a browser or mobile device.  it has Angular-specific features  It's element finders wait for Angular's $digest loop and $http to finish. So you'll have less chance to struggle with sleep and timing issues.
  • 6. About AngularJS AngularJS is what HTML would have been, had it been designed for building web- apps. Declarative templates with data-binding, MVW, MVVM, MVC, dependency injection and great testability story all implemented with pure client-side JavaScript!
  • 7. Difference about Protractor over Selenium WebDriver http://www.protractortest.org/#/api?view=ProtractorBy
  • 8. Protractor Installation  Download Node.JS http://nodejs.org/download/ node --version npm install protractor -g webdriver-manager update webdriver-manager update –ie webdriver-manager start
  • 9.  Configuration, copy following into “conf.js”:  Test, copy following into “protrator-test.js”: Scripting using Protractor for AngularJS Web Automation describe('angularjs homepage', function() { it('should greet the named user', function() { browser.get('http://www.angularjs.org'); element(by.model('yourName')).sendKeys('Julie'); var greeting = element(by.binding('yourName')); expect(greeting.getText()).toEqual('Hello Julie!'); }); }); exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['protrator-test.js'] };
  • 10.  Capabilities  Multicapabilities Scripting using Protractor for AngularJS Web Automation exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['protrator-test.js'] capabilities: { 'browserName': 'chrome' }, jasmineNodeOpts: { showColors: true } }; https://github.com/angular/protractor/blob/master/lib/config.ts exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['protrator-test.js'] multiCapabilities: { 'browserName': ‘firefox' }, { 'browserName': 'chrome' }, jasmineNodeOpts: { showColors: true } };
  • 11. Framework Development using Protractor  Page Objects - These are the js files where you map the elements and write the functions to perform actions;  Exports and Require - This is how you connect your Page Objects to your Test Specs;  Test specs - These are the js files where you write your tests using jasmine syntax.
  • 12. Page Objects var AngularHomepage = function() { this.nameInput = element(by.model('yourName')); this.greeting = element(by.binding('yourName')); this.get = function() { browser.get('http://www.angularjs.org'); }; this.setName = function(name) { this.nameInput.sendKeys(name); }; }; var AngularHomepage = require('homepage.js'); describe('HomePage Tests', function() { var angularHomepage = new AngularHomepage(); angularHomepage.get(); angularHomepage.nameInput.sendKeys('Rafael'); });
  • 13. Separate your tests in various test suites exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome‘ }, suites: { homepage: ‘homepage/*', search: [‘SearchSpec.js'] }, jasmineNodeOpts: { showColors: true } }; protractor protractor.conf.js --suite homepage
  • 14. Using OnPrepare exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome‘ }, onPrepare: function() { browser.driver.manage().window().maximize(); }, jasmineNodeOpts: { showColors: true } };
  • 15. Using OnPrepare exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome‘ }, onPrepare: function() { global.mydriver = browser.driver; mydriver.manage().window().maximize(); }, jasmineNodeOpts: { showColors: true } };
  • 16. Using params exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome‘ }, // This can be changed via the command line as: // --params.login.user 'ngrocks' params: { login: { user: 'protractor-br', password: '#ng123#' } }, jasmineNodeOpts: { showColors: true } };
  • 17. Using params describe('login page', function() { var params = browser.params; it('should login successfully', function() { element( by.model('username') ).sendKeys( params.login.user ); element( by.model('password') ).sendKeys( params.login.password ); element( by.css('[ng-click="login()"]') ).click(); expect( element(by.binding('username') ).getText() ).toEqual( params.login.user ); }); });
  • 18. References  http://www.protractortest.org/#/  http://www.protractortest.org/#/api  https://github.com/angular/protractor  https://angularjs.org/  https://jasmine.github.io/2.0/introduction.html  https://github.com/angular/protractor/blob/master/docs/toc.md  http://www.ng-newsletter.com/posts/practical-protractor.html  https://www.youtube.com/watch?v=idb6hOxlyb8