SlideShare une entreprise Scribd logo
1  sur  20
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

Contenu connexe

Tendances

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
 

Tendances (20)

An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Kotlin vs Java | Edureka
Kotlin vs Java | EdurekaKotlin vs Java | Edureka
Kotlin vs Java | Edureka
 
Selenium-4-and-appium-2
Selenium-4-and-appium-2Selenium-4-and-appium-2
Selenium-4-and-appium-2
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
 
Appium solution
Appium solutionAppium solution
Appium solution
 
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 ...
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
 
Angular
AngularAngular
Angular
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Cypress, Playwright, Selenium, or WebdriverIO? Let the Engineers Speak!
Cypress, Playwright, Selenium, or WebdriverIO? Let the Engineers Speak!Cypress, Playwright, Selenium, or WebdriverIO? Let the Engineers Speak!
Cypress, Playwright, Selenium, or WebdriverIO? Let the Engineers Speak!
 
Python selenium
Python seleniumPython selenium
Python selenium
 
Appium ppt
Appium pptAppium ppt
Appium ppt
 
Selenium
SeleniumSelenium
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
 
Waits in Selenium | Selenium Wait Commands | Edureka
Waits in Selenium | Selenium Wait Commands | EdurekaWaits in Selenium | Selenium Wait Commands | Edureka
Waits in Selenium | Selenium Wait Commands | Edureka
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Test Automation Using Python | Edureka
Test Automation Using Python | EdurekaTest Automation Using Python | Edureka
Test Automation Using Python | Edureka
 

En vedette

интернет в социологии важнейшие информационные сайты дадададад)))
интернет в социологии   важнейшие информационные сайты дадададад)))интернет в социологии   важнейшие информационные сайты дадададад)))
интернет в социологии важнейшие информационные сайты дадададад)))
faqMEN
 

En vedette (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
 

Similaire à Protractor overview

Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applications
Rashwin
 

Similaire à 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 як інструмент браузерної автоматизації для...
 

Dernier

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Dernier (20)

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 

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