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

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
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
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
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
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
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...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
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...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
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
 

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