SlideShare a Scribd company logo
1 of 23
Download to read offline
Ideal 
Test,Scripts 
Selenium,Server 
protractor.conf.js Actual 
Browser,Drivers
Setup 
$ npm install protractor
Setup 
$ npm install protractor 
$ npm install yo 
$ sudo ynpm i -g generator-ypr 
-otractor 
$ cd your-repo-dir 
$ yo yprotractor:existing 
$ ynpm update
Setup 
$ npm install protractor 
package.json 
}, 
"devDependencies": { 
"less": "1.7.3", 
"jslint": "0.5.2", 
"mojito-cli": "0.1.2", 
"yahoo-arrow": "~0.5.1", 
"yhint": "*", 
"chai": "^1.9.0", 
"chai-as-promised": "^4.1.0", 
"mocha": "^1.19.0", 
"protractor": "1.1.x", 
"protractor-utils": "0.2.x" 
}, 
$ npm install yo 
$ sudo ynpm i -g generator-ypr 
-otractor 
$ cd your-repo-dir 
$ yo yprotractor:existing 
$ ynpm update
Setup 
$ npm install protractor 
package.json 
}, 
"devDependencies": { 
"less": "1.7.3", 
"jslint": "0.5.2", 
"mojito-cli": "0.1.2", 
"yahoo-arrow": "~0.5.1", 
"yhint": "*", 
"chai": "^1.9.0", 
"chai-as-promised": "^4.1.0", 
"mocha": "^1.19.0", 
"protractor": "1.1.x", 
"protractor-utils": "0.2.x" 
}, 
$ npm install yo 
$ sudo ynpm i -g generator-ypr 
-otractor 
$ cd your-repo-dir 
$ yo yprotractor:existing 
$ ynpm update 
$ git clone xxx.git && cd xxx 
$ ynpm i
Setup 
$ npm install webdriver-manager 
$ webdriver-manager update 
--standalone 
$ webdriver-manager start 
$ npm install protractor 
$ git clone xxx.git && cd xxx 
$ ynpm i 
$ webdriver-manager status 
$ npm install yo 
$ sudo ynpm i -g generator-ypr 
-otractor 
$ cd your-repo-dir 
$ yo yprotractor:existing 
$ ynpm update
$ npm install protractor 
Run 
$ git clone xxx.git && cd xxx 
$ ynpm i 
$ protractor tests/spec/ 
protractor.conf.js -- 
seleniumAddress="..." -- 
baseUrl="..." 
protractor.conf.js
$ npm install protractor 
Run 
$ git clone xxx.git && cd xxx 
$ ynpm i 
$ protractor tests/spec/ 
protractor.conf.js -- 
seleniumAddress="..." -- 
baseUrl="..." 
Using the selenium server at 
http://10.82.57.93:4444/wd/ 
hub 
1..2 
ok 1 Page onload test should 
match store title 
not ok 2 Universal header 
shoppingcart checking after 
click items 
... ... 
# tests 2 
# pass 1 
# fail 1
Test,Scripts 
mocha Protractor API 1.3.0 Chai%Asser*on%Library
mocha 
Protractor API 1.3.0 Chai%Asser*on%Library 
describe('Page onload test', function () { 
it('should match store title', function () { 
}); 
});
mocha 
Chai%Asser*on%Library Protractor API 1.3.0 
/* global browser, $, it, describe, before */ 
describe('Page onload test', function () { 
it('should match store title', function () { 
}); 
}); 
browser.get('/'); 
browser.getTitle()
mocha Protractor API 1.3.0 Chai%Asser*on%Library 
/* global browser, $, it, describe, before */ 
var chai = require(‘chai’), 
expect = chai.expect, 
chaiAsPromised = require(‘chai-as-promised’); 
chai.use(chaiAsPromised); 
describe('Page onload test', function () { 
it('should match store title', function () { 
}); 
}); 
browser.get('/'); 
expect( browser.getTitle() 
).to.eventually.equal('');
mocha Chai%Asser*on%Library Protractor API 1.3.0 
describe('Page onload test', function () { 
var node, present; 
it('store logo should exist', function () { 
node = element(by.css(‘.ylogo’)); 
present = node.isPresent(); 
console.log(‘present: ’, present); 
expect(present).to.equal(true); 
}); 
});
mocha Chai%Asser*on%Library Protractor API 1.3.0 
describe('Page onload test', function () { 
var node, present; 
it('store logo should exist', function () { 
node = element(by.css(‘.ylogo’)); 
present = node.isPresent(); 
console.log(‘present: ’,present); 
expect(present).to.eveutually.equal(true); 
node.isPresent().then(function (_present) { 
console.log(‘_present: ’, _present); 
expect(_present).to.equal(true); 
}); 
}); 
});
mocha Chai%Asser*on%Library Protractor API 1.3.0 
describe('Page onload test', function () { 
var node, present; 
it('check if link works', function () { 
node = $(‘.ylogo’); 
node.getAttribute('href').then(function (_linkUrl) { 
browser.getCurrentUrl().then(function (curUrl) { 
expect(_curUrl).to.contain(_linkUrl); 
}) 
.then(function () { 
node.click(); 
}); 
browser.wait(function () { 
return browser.getCurrentUrl().then(function (_curUrl) { 
return _curUrl === _linkUrl; 
}, TIMELIMIT); 
}); 
}); 
});
mocha Chai%Asser*on%Library Protractor API 1.3.0 
describe('Page onload test', function () { 
var node, present; 
it('check if link works', function () { 
node = $(‘.ylogo’); 
node.getAttribute('href').then(function (_linkUrl) { 
linkUrl = _linkUrl; 
return browser.getCurrentUrl(); 
}).then(function (curUrl) { 
expect(_curUrl).to.contain(_linkUrl); 
}).then(function () { 
node.click(); 
.then(function () { 
browser.wait(function () { 
return browser.getCurrentUrl().then(function (_curUrl) { 
return _curUrl === linkUrl; 
}, TIMELIMIT); 
}); 
}); 
});
mocha Chai%Asser*on%Library Protractor API 1.3.0 
describe('Page onload test', function () { 
var node, present; 
it('check if link works', function () { 
node = $(‘.ylogo’); 
protractor.promise.all([browser.getCurrentUrl(), node.getAttribute('href')]) 
.then(function (_res) { 
curUrl = _res[0]; 
linkUrl = _res[1]; 
node.click(); 
browser.wait(function () { 
return browser.getCurrentUrl().then(function (_curUrl) { 
return _curUrl === linkUrl; 
}, TIMELIMIT); 
}); 
}); 
});
Tips 
only skip 
describe.only('Test task A', function () 
{ 
it('sub-task 1', function () {}); 
it('sub-task 2', function () {}); 
}); 
describe('Test task B', function () { 
it('sub-task 1', function () {}); 
}); 
describe('Test task C', function () { 
it.only('sub-task 1', function () {}); 
it('sub-task 2', function () {}); 
}); 
describe('Test task D', function () { 
it('sub-task 1', function () {}); 
it('sub-task 2', function () {}); 
});
Tips 
only 
describe.only('Test task A', function () 
{ 
it.skip('sub-task 1', function () 
{}); 
it('sub-task 2', function () {}); 
skip 
only%only%is%only 
}); 
describe('Test task B', function () { 
it('sub-task 1', function () {}); 
}); 
describe.only('Test task C', function () it.skip('sub-task 1', function () {}); 
it.skip('sub-task 2', function () {}); 
it('sub-task 2', function () {}); 
}); 
describe('Test task D', function () { 
it('sub-task 1', function () {}); 
});
Tips 
$ protractor tests/spec/protractor.conf.js --seleniumAddress=... 
--baseUrl=... --specs=tests/spec/test/universal.spec.js 
--suite=uni 
protractor.conf.js
before beforeEach after 
afterEach 
Tips 
describe.only('Test task A', function () { 
var hambgNode; 
beforeEach(function () { 
hambgNode = $('.header .myStore '); 
}); 
it('sub-test 1', function () {}); 
it('sub-test 2', function () {}); 
}); 
describe('Test task B', function () { 
beforeEach(function () { 
hambgNode = $('.header .myStore '); 
}); 
it('sub-test 1', function () {}); 
});
Source 
mocha 
Protractor API 1.3.0 Chai%Asser*on%Library

More Related Content

What's hot

Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and RubyYnon Perek
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasminefoxp2code
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with RubyKeith Pitty
 
Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeJosh Mock
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontendFrederic CABASSUT
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaChristopher Bartling
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTudor Barbu
 
Unit testing with mocha
Unit testing with mochaUnit testing with mocha
Unit testing with mochaRevath S Kumar
 
Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Roy Yu
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
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 TestingLars Thorup
 
Test-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS ApplicationsTest-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS ApplicationsFITC
 
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma Christopher Bartling
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSKnoldus Inc.
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introductionNir Kaufman
 
Adventures In JavaScript Testing
Adventures In JavaScript TestingAdventures In JavaScript Testing
Adventures In JavaScript TestingThomas Fuchs
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSJim Lynch
 

What's hot (20)

Vuejs testing
Vuejs testingVuejs testing
Vuejs testing
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasmine
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with Ruby
 
Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and Node
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontend
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Unit testing with mocha
Unit testing with mochaUnit testing with mocha
Unit testing with mocha
 
Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
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
 
Jasmine BDD for Javascript
Jasmine BDD for JavascriptJasmine BDD for Javascript
Jasmine BDD for Javascript
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 
Test-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS ApplicationsTest-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS Applications
 
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introduction
 
Adventures In JavaScript Testing
Adventures In JavaScript TestingAdventures In JavaScript Testing
Adventures In JavaScript Testing
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
 

Viewers also liked

Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorFlorian Fesseler
 
Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with ProtractorAndrew Eisenberg
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScriptSimon Guest
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJSKrishna Kumar
 
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 ProtractorKasun Kodagoda
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumDev9Com
 
Using a protractor
Using a protractorUsing a protractor
Using a protractorfknights
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScriptSimon Guest
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Andrew Eisenberg
 
Classifying Triangles
Classifying TrianglesClassifying Triangles
Classifying TrianglesAmanda Casto
 
Triangle and its properties
Triangle and its propertiesTriangle and its properties
Triangle and its propertiesyas5
 
Angles: Classifications; Measuring; and Drawing
Angles: Classifications; Measuring; and DrawingAngles: Classifications; Measuring; and Drawing
Angles: Classifications; Measuring; and DrawingJames Smith
 
ProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsBinary Studio
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular SlidesJim Lynch
 
Around The World In 80 Days
Around The World In 80 DaysAround The World In 80 Days
Around The World In 80 DaysNor Fadzleen
 

Viewers also liked (20)

Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with Protractor
 
Protractor: Tips & Tricks
Protractor: Tips & TricksProtractor: Tips & Tricks
Protractor: Tips & Tricks
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJS
 
Protractor powerpoint
Protractor powerpointProtractor powerpoint
Protractor powerpoint
 
Protractor training
Protractor trainingProtractor training
Protractor training
 
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
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and Selenium
 
Using a protractor
Using a protractorUsing a protractor
Using a protractor
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScript
 
Triangles
TrianglesTriangles
Triangles
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015
 
Classifying Triangles
Classifying TrianglesClassifying Triangles
Classifying Triangles
 
Triangle and its properties
Triangle and its propertiesTriangle and its properties
Triangle and its properties
 
Angles: Classifications; Measuring; and Drawing
Angles: Classifications; Measuring; and DrawingAngles: Classifications; Measuring; and Drawing
Angles: Classifications; Measuring; and Drawing
 
Angles and Measuring (degrees quiz)
Angles and Measuring (degrees quiz)Angles and Measuring (degrees quiz)
Angles and Measuring (degrees quiz)
 
ProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applications
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Around The World In 80 Days
Around The World In 80 DaysAround The World In 80 Days
Around The World In 80 Days
 

Similar to Introduction to Protractor

JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashBret Little
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}.toster
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for JoomlaLuke Summerfield
 
New Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian BergmannNew Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian Bergmanndpc
 
Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Jason Lotito
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCPEric Jain
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testingVisual Engineering
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptRyan Anklam
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript EverywherePascal Rettig
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
Advanced javascript
Advanced javascriptAdvanced javascript
Advanced javascriptDoeun KOCH
 

Similar to Introduction to Protractor (20)

JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}
 
Testing with Node.js
Testing with Node.jsTesting with Node.js
Testing with Node.js
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
Oojs 1.1
Oojs 1.1Oojs 1.1
Oojs 1.1
 
New Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian BergmannNew Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian Bergmann
 
Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCP
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
NodeJS
NodeJSNodeJS
NodeJS
 
Django Celery
Django Celery Django Celery
Django Celery
 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Advanced javascript
Advanced javascriptAdvanced javascript
Advanced javascript
 

Recently uploaded

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
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 01KreezheaRecto
 
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.pdfKamal Acharya
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
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 Bookingdharasingh5698
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
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 Standamitlee9823
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 

Recently uploaded (20)

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
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
 
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
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
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
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
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
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 

Introduction to Protractor

  • 1.
  • 2. Ideal Test,Scripts Selenium,Server protractor.conf.js Actual Browser,Drivers
  • 3. Setup $ npm install protractor
  • 4. Setup $ npm install protractor $ npm install yo $ sudo ynpm i -g generator-ypr -otractor $ cd your-repo-dir $ yo yprotractor:existing $ ynpm update
  • 5. Setup $ npm install protractor package.json }, "devDependencies": { "less": "1.7.3", "jslint": "0.5.2", "mojito-cli": "0.1.2", "yahoo-arrow": "~0.5.1", "yhint": "*", "chai": "^1.9.0", "chai-as-promised": "^4.1.0", "mocha": "^1.19.0", "protractor": "1.1.x", "protractor-utils": "0.2.x" }, $ npm install yo $ sudo ynpm i -g generator-ypr -otractor $ cd your-repo-dir $ yo yprotractor:existing $ ynpm update
  • 6. Setup $ npm install protractor package.json }, "devDependencies": { "less": "1.7.3", "jslint": "0.5.2", "mojito-cli": "0.1.2", "yahoo-arrow": "~0.5.1", "yhint": "*", "chai": "^1.9.0", "chai-as-promised": "^4.1.0", "mocha": "^1.19.0", "protractor": "1.1.x", "protractor-utils": "0.2.x" }, $ npm install yo $ sudo ynpm i -g generator-ypr -otractor $ cd your-repo-dir $ yo yprotractor:existing $ ynpm update $ git clone xxx.git && cd xxx $ ynpm i
  • 7. Setup $ npm install webdriver-manager $ webdriver-manager update --standalone $ webdriver-manager start $ npm install protractor $ git clone xxx.git && cd xxx $ ynpm i $ webdriver-manager status $ npm install yo $ sudo ynpm i -g generator-ypr -otractor $ cd your-repo-dir $ yo yprotractor:existing $ ynpm update
  • 8. $ npm install protractor Run $ git clone xxx.git && cd xxx $ ynpm i $ protractor tests/spec/ protractor.conf.js -- seleniumAddress="..." -- baseUrl="..." protractor.conf.js
  • 9. $ npm install protractor Run $ git clone xxx.git && cd xxx $ ynpm i $ protractor tests/spec/ protractor.conf.js -- seleniumAddress="..." -- baseUrl="..." Using the selenium server at http://10.82.57.93:4444/wd/ hub 1..2 ok 1 Page onload test should match store title not ok 2 Universal header shoppingcart checking after click items ... ... # tests 2 # pass 1 # fail 1
  • 10. Test,Scripts mocha Protractor API 1.3.0 Chai%Asser*on%Library
  • 11. mocha Protractor API 1.3.0 Chai%Asser*on%Library describe('Page onload test', function () { it('should match store title', function () { }); });
  • 12. mocha Chai%Asser*on%Library Protractor API 1.3.0 /* global browser, $, it, describe, before */ describe('Page onload test', function () { it('should match store title', function () { }); }); browser.get('/'); browser.getTitle()
  • 13. mocha Protractor API 1.3.0 Chai%Asser*on%Library /* global browser, $, it, describe, before */ var chai = require(‘chai’), expect = chai.expect, chaiAsPromised = require(‘chai-as-promised’); chai.use(chaiAsPromised); describe('Page onload test', function () { it('should match store title', function () { }); }); browser.get('/'); expect( browser.getTitle() ).to.eventually.equal('');
  • 14. mocha Chai%Asser*on%Library Protractor API 1.3.0 describe('Page onload test', function () { var node, present; it('store logo should exist', function () { node = element(by.css(‘.ylogo’)); present = node.isPresent(); console.log(‘present: ’, present); expect(present).to.equal(true); }); });
  • 15. mocha Chai%Asser*on%Library Protractor API 1.3.0 describe('Page onload test', function () { var node, present; it('store logo should exist', function () { node = element(by.css(‘.ylogo’)); present = node.isPresent(); console.log(‘present: ’,present); expect(present).to.eveutually.equal(true); node.isPresent().then(function (_present) { console.log(‘_present: ’, _present); expect(_present).to.equal(true); }); }); });
  • 16. mocha Chai%Asser*on%Library Protractor API 1.3.0 describe('Page onload test', function () { var node, present; it('check if link works', function () { node = $(‘.ylogo’); node.getAttribute('href').then(function (_linkUrl) { browser.getCurrentUrl().then(function (curUrl) { expect(_curUrl).to.contain(_linkUrl); }) .then(function () { node.click(); }); browser.wait(function () { return browser.getCurrentUrl().then(function (_curUrl) { return _curUrl === _linkUrl; }, TIMELIMIT); }); }); });
  • 17. mocha Chai%Asser*on%Library Protractor API 1.3.0 describe('Page onload test', function () { var node, present; it('check if link works', function () { node = $(‘.ylogo’); node.getAttribute('href').then(function (_linkUrl) { linkUrl = _linkUrl; return browser.getCurrentUrl(); }).then(function (curUrl) { expect(_curUrl).to.contain(_linkUrl); }).then(function () { node.click(); .then(function () { browser.wait(function () { return browser.getCurrentUrl().then(function (_curUrl) { return _curUrl === linkUrl; }, TIMELIMIT); }); }); });
  • 18. mocha Chai%Asser*on%Library Protractor API 1.3.0 describe('Page onload test', function () { var node, present; it('check if link works', function () { node = $(‘.ylogo’); protractor.promise.all([browser.getCurrentUrl(), node.getAttribute('href')]) .then(function (_res) { curUrl = _res[0]; linkUrl = _res[1]; node.click(); browser.wait(function () { return browser.getCurrentUrl().then(function (_curUrl) { return _curUrl === linkUrl; }, TIMELIMIT); }); }); });
  • 19. Tips only skip describe.only('Test task A', function () { it('sub-task 1', function () {}); it('sub-task 2', function () {}); }); describe('Test task B', function () { it('sub-task 1', function () {}); }); describe('Test task C', function () { it.only('sub-task 1', function () {}); it('sub-task 2', function () {}); }); describe('Test task D', function () { it('sub-task 1', function () {}); it('sub-task 2', function () {}); });
  • 20. Tips only describe.only('Test task A', function () { it.skip('sub-task 1', function () {}); it('sub-task 2', function () {}); skip only%only%is%only }); describe('Test task B', function () { it('sub-task 1', function () {}); }); describe.only('Test task C', function () it.skip('sub-task 1', function () {}); it.skip('sub-task 2', function () {}); it('sub-task 2', function () {}); }); describe('Test task D', function () { it('sub-task 1', function () {}); });
  • 21. Tips $ protractor tests/spec/protractor.conf.js --seleniumAddress=... --baseUrl=... --specs=tests/spec/test/universal.spec.js --suite=uni protractor.conf.js
  • 22. before beforeEach after afterEach Tips describe.only('Test task A', function () { var hambgNode; beforeEach(function () { hambgNode = $('.header .myStore '); }); it('sub-test 1', function () {}); it('sub-test 2', function () {}); }); describe('Test task B', function () { beforeEach(function () { hambgNode = $('.header .myStore '); }); it('sub-test 1', function () {}); });
  • 23. Source mocha Protractor API 1.3.0 Chai%Asser*on%Library