SlideShare a Scribd company logo
Selenium WebDriverJS based framework for automated
testing of Angular 1.x/2.x applications
OLEKSANDR KHOTEMSKYI
https://xotabu4.github.io/website
 Julie Ralph(Google) is one of the main contributors,
made first commits in January 2013
 Created as an answer to question: ”How to make end
to end tests for AngularJS applications easier?”
 Now ProtractorJS reached version 4.x, with over 1300
commits, 5700 GitHub stars, 200 contributors
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для AngularJS 1x/2x додатків”
 Easier than Java
 Thousands of libraries already exist for JS/NodeJS. Friendly community, tons of open
source code. Package manager already included in NodeJS
 Much easier common code like JSON parsing, sending HTTP requests, and others
 Duck-typing, monkey-patching
 Tools are smaller, and project start is faster
 Newest versions of TypeScript or ECMAScript 6 makes code much easier to write and
understand
 Same language for front-end, back-end and tests means that same code execution
environment
 JS is one of the most popular languages today, and TypeScript is as primary in
Angular 2.0
https://dou.ua/lenta/articles/language-rating-jan-2016/
JAVA C# JavaScript PHP PythonC++ Ruby
 Developed by Microsoft team
 Superset of JavaScript (includes JavaScript)
 Compiles to JavaScript (ECMAScript 3, 5 or 6)
 Optional types! This allows to have autocomplete in IDE
 Easier refactoring of code
 Has features that not yet in JavaScript specification
(@Annotations, async/await)
 Compilation errors, instead of runtime errors in JavaScript
ProtractorJS Java Selenium WebDriver
High-level framework Low-level automation library (not framework)
Uses script languages: TypeScript or JavaScript or
both same time
Uses Java
JasimineJS (test runner and assertions),
SauceLabs/BrowserStack integration, basic reporting,
interactive debugger, command line parameters,
configuration files

Node Package Manager shows ~628 results for
‘protractor’
Maven shows ~422 results for ‘selenium webdriver’
Asynchronous, uses own control-flow, and Promises
objects
Synchronous, traditional approach
Ability to run tests in parallel Parallel running should be done with additional
libraries/frameworks
PageObjects are just objects with attributes and
functions
PageObjects require @FindBy annotations and
PageObjectFactory usage.
Plugins. Extra element locators. Mobile browsers
support (with Appium).
Mobile browsers support.
Test Runner
(JasmineJS,
Cucumber …)
ProtractorJS
Selenium JavaScript official
bindings
NodeJS environment
Test Runner
extensions
Selenium Standalone Server (JAVA)
Other JS modules
HTTP
JSON
ChromeDriver GeckoDriver EdgeDriver SafariDriver Other drivers
• Runs on NodeJS 4.x, 5.x, 6.x
• Can be used with different Test Runners (JasmineJS, CucumberJS, Mocha, others)
• Can connect to browser using WebDriver server or directly (Chrome and Firefox only)
• Supports all browsers that WebDriver does: Chrome, Firefox, Edge, Safari, Opera,
PhantomJS and mobile
• Angular 1.x and Angular 2.x ready!
One of the key features of ProtractorJS that it is uses same JSON WebDriver Wire protocol as other
language bindings.
This code will be executed as 3 separate JSON WebDriver Wire Protocol commands:
Synchronizing with
AngularJS application
Locating element on the
page
Sending ‘click’ action for
element
• Protractor uses ‘Wrapper’ pattern to add own features to standard WebDriver, WebElement, Locators objects
Browser(WebDriver instance)
+
Inherited from WebDriver
• getProcessedConfig
• forkNewDriverInstance
• restart
• useAllAngular2AppRoots
• waitForAngular
• findElement
• findElements
• isElementPresent
• addMockModule
• clearMockModules
• removeMockModule
• getRegisteredMockModules
• get
• refresh
• navigate
• setLocation
• getLocationAbsUrl
• debugger
• enterRepl
• pause
• wrapDriver
actions
touchActions
executeScript
executeAsyncScri
pt
call
wait
sleep
getPageSource
close
getCurrentUrl
getTitle
takeScreenshot
switchTo
ElementFinder
+
Inherited from WebElement• then
• clone
• locator
• getWebElement
• all
• element
• $$
• $
• isPresent
• isElementPresent
• evaluate
• allowAnimations
• equals
• getDriver
• getId
• getRawId
• serialize
• findElement
• click
• sendKeys
• getTagName
• getCssValue
• getAttribute
• getText
• getSize
• getLocation
• isEnabled
• isSelected
• submit
• clear
• isDisplayed
• takeScreenshot
Protractor Locators
+
Inherited from WebDriver Locators• addLocator
• binding
• exactBinding
• model
• buttonText
• partialButtonText
• repeater
• exactRepeater
• cssContainingText
• options
• deepCss
• className
• css
• id
• linkText
• js
• name
• partialLinkText
• tagName
• xpath
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для AngularJS 1x/2x додатків”
 JavaScript is single threaded (mostly)
 To have possibility to do multiple tasks at once – JavaScript run them
all in single thread, and quickly switch between them
 Async tasks are running in isolation. To make execution step by step –
callbacks are used
 Callbacks are just functions, that will be called when async function is
finished. It is like – “call this when you are done”. You can pass any
arguments to them
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для AngularJS 1x/2x додатків”
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для AngularJS 1x/2x додатків”
 Pattern to avoid callback hell, extension of callbacks
 Almost every function from API returns special object – Promise
 Promise is a object, that will be resolved to a value (any), or rejected if
value can’t be returned
 Do not try to write in synchronous manner! You should
think differently when writing async code
 When you asserting results – promises automatically
resolved. Do not worry to resolve promise before
assertion
 To wait something on the page – use browser.wait() or
browser.sleep()
 ES7 features are on their way! async/await will make
our life much easier
 Be brave and good luck
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для AngularJS 1x/2x додатків”
https://gist.github.com/Xotabu4/f26afb9e24397c9d059bb984d30a6b0a
Example of simple test case
JAVA + Pure Selenium JAVA + JUNIT
TypeScript + ProtractorJS + JasmineJS
https://gist.github.com/Xotabu4/dcfe83bc98ad304f58f3b05de9cd6c69
https://gist.github.com/Xotabu4/79ece1d104f2557a70cd079b62f46f45
Example of simple pageObject pattern usage
JAVA + Selenium PageObjectFactory (@FindBy)
TypeScript + ProtractorJS
https://gist.github.com/Xotabu4/a9334f22933d1d6a16c820ccb4bd6635
And useful links:
 Protractor site: http://www.protractortest.org
 Promises, WebDriver Control Flow documentation:
http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/promise.html
 Gitter chat: https://gitter.im/angular/protractor
 StackOverflow(top questions): http://stackoverflow.com/questions/tagged/protractor?sort=votes&pageSize=20
 GitHub: https://github.com/angular/protractor
 TypeScript documentation: https://www.typescriptlang.org/docs/tutorial.html
 ES6 features: http://es6-features.org/
 Protractor TypeScript example: https://github.com/angular/protractor/tree/master/exampleTypescript
OLEKSANDR KHOTEMSKYI
https://xotabu4.github.io/website 2016

More Related Content

What's hot (20)

PPTX
Selenium_For_Beginners_VodQA_Final
Manjyot Singh
 
PPTX
Controlling the browser through python and selenium
Patrick Viafore
 
PDF
Conquering AngularJS Limitations
Valeri Karpov
 
PPT
Selenium
Manjyot Singh
 
PDF
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Matt Raible
 
PDF
Introduction to Selenium and Ruby
Ynon Perek
 
PDF
Lessons in Open Source from the MongooseJS ODM
Valeri Karpov
 
PPTX
An Introduction to AngularJS End to End Testing using Protractor
Cubet Techno Labs
 
PDF
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
Fwdays
 
PDF
MongoDB MEAN Stack Webinar October 7, 2015
Valeri Karpov
 
PDF
Android testing-with-selenium-webdriver Online Training
Nagendra Kumar
 
PDF
Why You Should Use MERN Stack for Startup Apps?
PixelCrayons
 
PDF
TDD a REST API With Node.js and MongoDB
Valeri Karpov
 
PDF
MEAN Stack WeNode Barcelona Workshop
Valeri Karpov
 
PPTX
Meanstack overview
Adthasid Sabmake
 
PPTX
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 
PPTX
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
PDF
On Selecting JavaScript Frameworks (Women Who Code 10/15)
Zoe Landon
 
PDF
Web a Quebec - JS Debugging
Rami Sayar
 
PDF
Afrimadoni the power of docker
PHP Indonesia
 
Selenium_For_Beginners_VodQA_Final
Manjyot Singh
 
Controlling the browser through python and selenium
Patrick Viafore
 
Conquering AngularJS Limitations
Valeri Karpov
 
Selenium
Manjyot Singh
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Matt Raible
 
Introduction to Selenium and Ruby
Ynon Perek
 
Lessons in Open Source from the MongooseJS ODM
Valeri Karpov
 
An Introduction to AngularJS End to End Testing using Protractor
Cubet Techno Labs
 
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
Fwdays
 
MongoDB MEAN Stack Webinar October 7, 2015
Valeri Karpov
 
Android testing-with-selenium-webdriver Online Training
Nagendra Kumar
 
Why You Should Use MERN Stack for Startup Apps?
PixelCrayons
 
TDD a REST API With Node.js and MongoDB
Valeri Karpov
 
MEAN Stack WeNode Barcelona Workshop
Valeri Karpov
 
Meanstack overview
Adthasid Sabmake
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
On Selecting JavaScript Frameworks (Women Who Code 10/15)
Zoe Landon
 
Web a Quebec - JS Debugging
Rami Sayar
 
Afrimadoni the power of docker
PHP Indonesia
 

Viewers also liked (9)

PPTX
Олександр Струков “QA skills keeping it up to date”
Dakiry
 
PPTX
Оля Фейдак “Is there life during regression?”
Dakiry
 
PPTX
Денис Жевнер “Social engineering: connecting cracking people”
Dakiry
 
PPTX
Олена Бєлкіна “7 смертних гріхів зворотнього зв’язку“
Dakiry
 
PDF
Альона Тудан “World of bugs: let’s find together”
Dakiry
 
PPTX
Bohdana Muzyka “GUI and Usability Testing: Becoming User Advocate”
Dakiry
 
PPTX
Оксана Вей “To risk or not to risk?”
Dakiry
 
PPTX
Андрій Лазарєв “Автоматизація тестування Enterprise систем”
Dakiry
 
PPTX
Тетяна Свірідова “From Junior Tester to Test Manager: Tips&Tricks“
Dakiry
 
Олександр Струков “QA skills keeping it up to date”
Dakiry
 
Оля Фейдак “Is there life during regression?”
Dakiry
 
Денис Жевнер “Social engineering: connecting cracking people”
Dakiry
 
Олена Бєлкіна “7 смертних гріхів зворотнього зв’язку“
Dakiry
 
Альона Тудан “World of bugs: let’s find together”
Dakiry
 
Bohdana Muzyka “GUI and Usability Testing: Becoming User Advocate”
Dakiry
 
Оксана Вей “To risk or not to risk?”
Dakiry
 
Андрій Лазарєв “Автоматизація тестування Enterprise систем”
Dakiry
 
Тетяна Свірідова “From Junior Tester to Test Manager: Tips&Tricks“
Dakiry
 
Ad

Similar to Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для AngularJS 1x/2x додатків” (20)

PPTX
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QAFest
 
PPTX
Selenium Basics and Overview topics.pptx
sountharyaravi010
 
PPTX
Selenium Basics and Overview1233444.pptx
sountharyaravi010
 
PPTX
Protractor overview
Abhishek Yadav
 
PPTX
Introduction to React native
Dhaval Barot
 
PDF
Selenide
DataArt
 
PDF
Beginning MEAN Stack
Rob Davarnia
 
PDF
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
PPTX
Automated ui-testing
Slobodan Lohja
 
PPT
Automation with Selenium Presented by Quontra Solutions
Quontra Solutions
 
PPTX
Advanced JavaScript
Mahmoud Tolba
 
PPT
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Atirek Gupta
 
PPT
Top java script frameworks ppt
Omkarsoft Bangalore
 
PPTX
Selenium.pptx
orbitprojects
 
PDF
JavaScript and jQuery for SharePoint Developers
Rob Windsor
 
PPTX
What is Mean Stack Development ?
Balajihope
 
PPTX
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Deepu S Nath
 
PDF
Web Test Automation Framework - IndicThreads Conference
IndicThreads
 
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to node.js by jiban
Jibanananda Sana
 
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
QAFest
 
Selenium Basics and Overview topics.pptx
sountharyaravi010
 
Selenium Basics and Overview1233444.pptx
sountharyaravi010
 
Protractor overview
Abhishek Yadav
 
Introduction to React native
Dhaval Barot
 
Selenide
DataArt
 
Beginning MEAN Stack
Rob Davarnia
 
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Automated ui-testing
Slobodan Lohja
 
Automation with Selenium Presented by Quontra Solutions
Quontra Solutions
 
Advanced JavaScript
Mahmoud Tolba
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Atirek Gupta
 
Top java script frameworks ppt
Omkarsoft Bangalore
 
Selenium.pptx
orbitprojects
 
JavaScript and jQuery for SharePoint Developers
Rob Windsor
 
What is Mean Stack Development ?
Balajihope
 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Deepu S Nath
 
Web Test Automation Framework - IndicThreads Conference
IndicThreads
 
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
Introduction to node.js by jiban
Jibanananda Sana
 
Ad

More from Dakiry (20)

PDF
НАРЦИСИЗМ ЯК ПАСИВНЕ КУРІННЯ
Dakiry
 
PDF
МАНІПУЛЯЦІЇ: ХТО КОГО І ДЛЯ ЧОГО? - Інна Тіторенко
Dakiry
 
PPTX
How to run a discovery workshop
Dakiry
 
PPTX
З понеділка йду на новий проект. The tester’s version - Олександра Зубаль
Dakiry
 
PDF
Робота з текстом: від чернетки до опублікування
Dakiry
 
PPTX
Контентна стратегія в ІТ: від статті до першого ліда
Dakiry
 
PPTX
Oleh Shpyrna "Security Testing Basics: Check your Webapp for gaps before l_unch"
Dakiry
 
PPTX
Stepan Shykerynets "Power of QA (A Journey: From Hell to Heaven. Story of gr...
Dakiry
 
PDF
Микола Солопій "Selenium рулить, однак..."
Dakiry
 
PDF
Oleksandra Zubal "Project starters: test automation view"
Dakiry
 
PDF
Vladyslav Romanchenko "How to keep high code quality without e2e tests"
Dakiry
 
PPTX
Діана Пінчук "Як відрізнити авторизацію від аутентифікації та перестати бояти...
Dakiry
 
PPT
Yuriy Malyi "E2E testing organization in multi-system projects"
Dakiry
 
PPTX
Petro Tarasenko "You've become a TL. What's next?"
Dakiry
 
PDF
Roman Yakymchuk "Дослідницьке тестування. Перезапуск"
Dakiry
 
PPTX
Maryna Shulga "Mission Impossible. Впровадити тест процеси, якщо ніхто цього ...
Dakiry
 
PDF
Олексій Брошков "Мистецтво Дослідницького Тестування"
Dakiry
 
PPSX
Альона Тудан " Життя QA в ажурі"
Dakiry
 
PPTX
Андрій Степура "Тренди в публічних виступах"
Dakiry
 
PPTX
Зоряна Борбулевич "Підхід, який трансформував компанію Microsoft: ННК і його...
Dakiry
 
НАРЦИСИЗМ ЯК ПАСИВНЕ КУРІННЯ
Dakiry
 
МАНІПУЛЯЦІЇ: ХТО КОГО І ДЛЯ ЧОГО? - Інна Тіторенко
Dakiry
 
How to run a discovery workshop
Dakiry
 
З понеділка йду на новий проект. The tester’s version - Олександра Зубаль
Dakiry
 
Робота з текстом: від чернетки до опублікування
Dakiry
 
Контентна стратегія в ІТ: від статті до першого ліда
Dakiry
 
Oleh Shpyrna "Security Testing Basics: Check your Webapp for gaps before l_unch"
Dakiry
 
Stepan Shykerynets "Power of QA (A Journey: From Hell to Heaven. Story of gr...
Dakiry
 
Микола Солопій "Selenium рулить, однак..."
Dakiry
 
Oleksandra Zubal "Project starters: test automation view"
Dakiry
 
Vladyslav Romanchenko "How to keep high code quality without e2e tests"
Dakiry
 
Діана Пінчук "Як відрізнити авторизацію від аутентифікації та перестати бояти...
Dakiry
 
Yuriy Malyi "E2E testing organization in multi-system projects"
Dakiry
 
Petro Tarasenko "You've become a TL. What's next?"
Dakiry
 
Roman Yakymchuk "Дослідницьке тестування. Перезапуск"
Dakiry
 
Maryna Shulga "Mission Impossible. Впровадити тест процеси, якщо ніхто цього ...
Dakiry
 
Олексій Брошков "Мистецтво Дослідницького Тестування"
Dakiry
 
Альона Тудан " Життя QA в ажурі"
Dakiry
 
Андрій Степура "Тренди в публічних виступах"
Dakiry
 
Зоряна Борбулевич "Підхід, який трансформував компанію Microsoft: ННК і його...
Dakiry
 

Recently uploaded (20)

PPTX
Oil and Gas EPC Market Size & Share | Growth - 2034
Aman Bansal
 
DOCX
RECLAIM STOLEN CRYPTO REVIEW WITH RECUVA HACKER SOLUTIONS
camilamichaelj7
 
PDF
Robbie Teehan - Owns The Pro Composer
Robbie Teehan
 
PDF
BeMetals_Presentation_July_2025 .pdf
DerekIwanaka2
 
PDF
Pyrolysis Oil Manufacturing Plant Project Report.pdf
procurement resource
 
PDF
Jordan Minnesota City Codes and Ordinances
Forklift Trucks in Minnesota
 
PPTX
Ensar Capabilities by team ensar (1).pptx
redyamanil
 
PDF
HOW TO RECOVER LOST CRYPTOCURRENCY - VISIT iBOLT CYBER HACKER COMPANY
diegovalentin771
 
PDF
Agriculture Machinery PartsAgriculture Machinery Parts
mizhanw168
 
PPTX
Key Neurology Coding Changes Every Physician Should Know (1).pptx
alicecarlos1
 
PDF
15 Essential Cloud Podcasts Every Tech Professional Should Know in 2025
Amnic
 
PPTX
Business profile making an example ppt for small scales
Bindu222929
 
PDF
Bespoke Inspiration Tours & Factfinding Missions
Niki Skene
 
PDF
Gabino Barbosa - A Master Of Efficiency
Gabino Barbosa
 
PDF
Marketing strategies and tools ppt infographics360degree 1.pdf
theinfographics360de
 
DOCX
How to Choose the Best Dildo for Men A Complete Buying Guide.docx
Glas Toy
 
PDF
Smart Lead Magnet Review: Effortless Email List Growth with Automated Funnels...
Larry888358
 
PDF
Biography of Safwan Sobhan
Safwan Sobhan
 
PDF
NewBase 07 July 2025 Energy News issue - 1800 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
PPTX
World First Cardiovascular & Thoracic CT Scanner
arineta37
 
Oil and Gas EPC Market Size & Share | Growth - 2034
Aman Bansal
 
RECLAIM STOLEN CRYPTO REVIEW WITH RECUVA HACKER SOLUTIONS
camilamichaelj7
 
Robbie Teehan - Owns The Pro Composer
Robbie Teehan
 
BeMetals_Presentation_July_2025 .pdf
DerekIwanaka2
 
Pyrolysis Oil Manufacturing Plant Project Report.pdf
procurement resource
 
Jordan Minnesota City Codes and Ordinances
Forklift Trucks in Minnesota
 
Ensar Capabilities by team ensar (1).pptx
redyamanil
 
HOW TO RECOVER LOST CRYPTOCURRENCY - VISIT iBOLT CYBER HACKER COMPANY
diegovalentin771
 
Agriculture Machinery PartsAgriculture Machinery Parts
mizhanw168
 
Key Neurology Coding Changes Every Physician Should Know (1).pptx
alicecarlos1
 
15 Essential Cloud Podcasts Every Tech Professional Should Know in 2025
Amnic
 
Business profile making an example ppt for small scales
Bindu222929
 
Bespoke Inspiration Tours & Factfinding Missions
Niki Skene
 
Gabino Barbosa - A Master Of Efficiency
Gabino Barbosa
 
Marketing strategies and tools ppt infographics360degree 1.pdf
theinfographics360de
 
How to Choose the Best Dildo for Men A Complete Buying Guide.docx
Glas Toy
 
Smart Lead Magnet Review: Effortless Email List Growth with Automated Funnels...
Larry888358
 
Biography of Safwan Sobhan
Safwan Sobhan
 
NewBase 07 July 2025 Energy News issue - 1800 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
World First Cardiovascular & Thoracic CT Scanner
arineta37
 

Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для AngularJS 1x/2x додатків”

  • 1. Selenium WebDriverJS based framework for automated testing of Angular 1.x/2.x applications OLEKSANDR KHOTEMSKYI https://xotabu4.github.io/website
  • 2.  Julie Ralph(Google) is one of the main contributors, made first commits in January 2013  Created as an answer to question: ”How to make end to end tests for AngularJS applications easier?”  Now ProtractorJS reached version 4.x, with over 1300 commits, 5700 GitHub stars, 200 contributors
  • 4.  Easier than Java  Thousands of libraries already exist for JS/NodeJS. Friendly community, tons of open source code. Package manager already included in NodeJS  Much easier common code like JSON parsing, sending HTTP requests, and others  Duck-typing, monkey-patching  Tools are smaller, and project start is faster  Newest versions of TypeScript or ECMAScript 6 makes code much easier to write and understand  Same language for front-end, back-end and tests means that same code execution environment
  • 5.  JS is one of the most popular languages today, and TypeScript is as primary in Angular 2.0 https://dou.ua/lenta/articles/language-rating-jan-2016/ JAVA C# JavaScript PHP PythonC++ Ruby
  • 6.  Developed by Microsoft team  Superset of JavaScript (includes JavaScript)  Compiles to JavaScript (ECMAScript 3, 5 or 6)  Optional types! This allows to have autocomplete in IDE  Easier refactoring of code  Has features that not yet in JavaScript specification (@Annotations, async/await)  Compilation errors, instead of runtime errors in JavaScript
  • 7. ProtractorJS Java Selenium WebDriver High-level framework Low-level automation library (not framework) Uses script languages: TypeScript or JavaScript or both same time Uses Java JasimineJS (test runner and assertions), SauceLabs/BrowserStack integration, basic reporting, interactive debugger, command line parameters, configuration files  Node Package Manager shows ~628 results for ‘protractor’ Maven shows ~422 results for ‘selenium webdriver’ Asynchronous, uses own control-flow, and Promises objects Synchronous, traditional approach Ability to run tests in parallel Parallel running should be done with additional libraries/frameworks PageObjects are just objects with attributes and functions PageObjects require @FindBy annotations and PageObjectFactory usage. Plugins. Extra element locators. Mobile browsers support (with Appium). Mobile browsers support.
  • 8. Test Runner (JasmineJS, Cucumber …) ProtractorJS Selenium JavaScript official bindings NodeJS environment Test Runner extensions Selenium Standalone Server (JAVA) Other JS modules HTTP JSON ChromeDriver GeckoDriver EdgeDriver SafariDriver Other drivers
  • 9. • Runs on NodeJS 4.x, 5.x, 6.x • Can be used with different Test Runners (JasmineJS, CucumberJS, Mocha, others) • Can connect to browser using WebDriver server or directly (Chrome and Firefox only) • Supports all browsers that WebDriver does: Chrome, Firefox, Edge, Safari, Opera, PhantomJS and mobile • Angular 1.x and Angular 2.x ready!
  • 10. One of the key features of ProtractorJS that it is uses same JSON WebDriver Wire protocol as other language bindings. This code will be executed as 3 separate JSON WebDriver Wire Protocol commands: Synchronizing with AngularJS application Locating element on the page Sending ‘click’ action for element
  • 11. • Protractor uses ‘Wrapper’ pattern to add own features to standard WebDriver, WebElement, Locators objects Browser(WebDriver instance) + Inherited from WebDriver • getProcessedConfig • forkNewDriverInstance • restart • useAllAngular2AppRoots • waitForAngular • findElement • findElements • isElementPresent • addMockModule • clearMockModules • removeMockModule • getRegisteredMockModules • get • refresh • navigate • setLocation • getLocationAbsUrl • debugger • enterRepl • pause • wrapDriver actions touchActions executeScript executeAsyncScri pt call wait sleep getPageSource close getCurrentUrl getTitle takeScreenshot switchTo
  • 12. ElementFinder + Inherited from WebElement• then • clone • locator • getWebElement • all • element • $$ • $ • isPresent • isElementPresent • evaluate • allowAnimations • equals • getDriver • getId • getRawId • serialize • findElement • click • sendKeys • getTagName • getCssValue • getAttribute • getText • getSize • getLocation • isEnabled • isSelected • submit • clear • isDisplayed • takeScreenshot
  • 13. Protractor Locators + Inherited from WebDriver Locators• addLocator • binding • exactBinding • model • buttonText • partialButtonText • repeater • exactRepeater • cssContainingText • options • deepCss • className • css • id • linkText • js • name • partialLinkText • tagName • xpath
  • 15.  JavaScript is single threaded (mostly)  To have possibility to do multiple tasks at once – JavaScript run them all in single thread, and quickly switch between them  Async tasks are running in isolation. To make execution step by step – callbacks are used  Callbacks are just functions, that will be called when async function is finished. It is like – “call this when you are done”. You can pass any arguments to them
  • 18.  Pattern to avoid callback hell, extension of callbacks  Almost every function from API returns special object – Promise  Promise is a object, that will be resolved to a value (any), or rejected if value can’t be returned
  • 19.  Do not try to write in synchronous manner! You should think differently when writing async code  When you asserting results – promises automatically resolved. Do not worry to resolve promise before assertion  To wait something on the page – use browser.wait() or browser.sleep()  ES7 features are on their way! async/await will make our life much easier  Be brave and good luck
  • 21. https://gist.github.com/Xotabu4/f26afb9e24397c9d059bb984d30a6b0a Example of simple test case JAVA + Pure Selenium JAVA + JUNIT TypeScript + ProtractorJS + JasmineJS https://gist.github.com/Xotabu4/dcfe83bc98ad304f58f3b05de9cd6c69
  • 22. https://gist.github.com/Xotabu4/79ece1d104f2557a70cd079b62f46f45 Example of simple pageObject pattern usage JAVA + Selenium PageObjectFactory (@FindBy) TypeScript + ProtractorJS https://gist.github.com/Xotabu4/a9334f22933d1d6a16c820ccb4bd6635
  • 23. And useful links:  Protractor site: http://www.protractortest.org  Promises, WebDriver Control Flow documentation: http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/promise.html  Gitter chat: https://gitter.im/angular/protractor  StackOverflow(top questions): http://stackoverflow.com/questions/tagged/protractor?sort=votes&pageSize=20  GitHub: https://github.com/angular/protractor  TypeScript documentation: https://www.typescriptlang.org/docs/tutorial.html  ES6 features: http://es6-features.org/  Protractor TypeScript example: https://github.com/angular/protractor/tree/master/exampleTypescript OLEKSANDR KHOTEMSKYI https://xotabu4.github.io/website 2016

Editor's Notes

  • #3: Последняя 4.4
  • #7: Мое мнение – для новых проектов использовать уже TypeScript, старые можно частично мигрировать на TypeScript, или оставить как есть. ПОКАЖИ ВИДЕО!!!
  • #9: Здесь важно сказать что протрактор работает по точно такому же протоколу как и Java bindings. То есть в браузере разницы видно не будет. + javascript бингинги официальные, и поддерживаются практически наравне с джавашными и остальными. WebDriver wire protocol
  • #10: Protractor element EXTENDS WebDriverJS element, so all functions are accessible.
  • #11: Here is exampe of simple Protractor interaction with the page: First, Protractor tells the browser to run a snippet of JavaScript. This is a custom command which asks Angular to respond when the application is done with all timeouts and asynchronous requests, and ready for the test to resume. Then, the command to find the element is sent. Finally the command to perform a click action is sent. Summary: Protractor uses the same API to manipulate browser as any other language bindings, so browser won’t notice any difference here
  • #12: Protractor element EXTENDS WebDriverJS element, so all functions are accessible.
  • #13: Protractor element EXTENDS WebDriverJS element, so all functions are accessible.
  • #14: ProtractorBy.prototype.deepCss - Find an element by css selector within the Shadow DOM. ProtractorBy.prototype.options - Find an element by ng-options expression.
  • #15: Тут рассказать про асинхронность и контрол флоу Больше всего у людей которые начинают переходить в мир JS взрывает мозг именно асинхронность. Попытаемся рассказать основные моменты
  • #19: Это вернет Promise, который станет или текущим именем пользователя, или пустой строкой, в случае если такого элемента не существует.
  • #22: Explicit creating and closing of browser is needed
  • #23: Explicit creating and closing of browser is needed