SlideShare a Scribd company logo
Front-end Testing
Visual testing with Wraith
2.
About me
Mircea Fernea
Drupal Consultant at Amplexor Romania
mircea.fernea@amplexor.com
drupal.org/u/mfernea
3.
Front-end testing
Test pages the html structure & interactions
Checking PageSpeed Insights
Testing page load times & render speeds
Check visual changes
4.
CasperJS
Allows for scripted actions to be tested with PhantomJS.
It’s easy to setup for front-end developers.
Test complex features or components within the page.
Automate complex user actions.
Test workflows like content creation.
Check http responses on sensitive pages.
HTML structure & Interactions
5.
Behat & Mink & PhantomJS
Behat can be integrated with PhantomJS through Mink
and Selenium2
Storing credentials, creating scenarios that include
backend interaction are easier to setup in Behat.
You can even run tests for multiple screen sizes.
HTML structure & Interactions
6.
grunt-pagespeed
https://www.npmjs.com/package/grunt-pagespeed
You get all the information from
https://developers.google.com/speed/pagespeed/insights/
?url=http%3A%2F%2Fwww.smashingmagazine.com%2F
&tab=mobile
PageSpeed Insights
7.
grunt-phantomas
https://www.npmjs.com/package/grunt-phantomas
A PhantomJS-based web performance metrics tool
http://stefanjudis.github.io/grunt-phantomas/gruntjs/
Page load times & render speeds
8.
grunt-phantomas
Page load times & render speeds
9.
grunt-perfbudget
https://github.com/tkadlec/grunt-perfbudget
It’s based on WebPageTest API
http://www.webpagetest.org/
It can leverage multiple browsers, geographic locations
and network speeds.
You can have budget for number of requests, load time
etc. See the budget as threshold value.
Performance budgets
10.
Wraith
https://github.com/BBC-News/wraith
Developed by the guys at BBC News
Wraith uses either PhantomJS or SlimerJS to create
screen-shots of webpages on different environments and
then creates a diff of the two images.
Imagemagick and PhantomJS or SlimmerJS are required
to use Wraith. CasperJS can be used to target specific
selectors.
Visual testing
11.
Wraith - Install
$ brew install phantomjs
$ brew install imagemagick
$ gem install wraith
Visual testing
12.
Wraith modes
Standard: take screenshots of two environments,
producing a visual diff of the two screenshots
Casper: take screenshots of an element from two
environments using selectors, producing a visual diff of the
two screenshots
History: rather than capture two environments, capture the
same environment at two different moments in time to
compare them if anything changed
Visual testing
13.
Standard mode
Take screenshots of two environments, producing a visual
diff of the two screenshots
$ wraith setup - creates configs/config.yaml and
javascript/snap.js
Adjust config.yaml to setup config and the two
environments (e.g. resolutions, pages)
$ wraith capture config
$ Open gallery.html from output dir to view results
$ wraith reset_shots config
Visual testing
14.
Visual testing
15.
Visual testing
16.
Casper mode
Casper: take screenshots of an element from two
environments using selectors, producing a visual diff of the
two screenshots
$ wraith setup_casper - creates configs/component.yaml
and javascripts/casper.js
Adjust component.yaml
$ wraith capture component
If multiple matches found, only the first one is captured
Don’t start your selector with “#”. Add “div” in front
Open gallery.html to see results
Visual testing
17.
History mode
Rather than capture two environments, capture the same
environment at two different moments in time to compare
them if anything changed
$ wraith setup
Adjust config.yaml and rename it (e.g. local-history)
$ wraith history local-history
$ wraith latest local-history
Open gallery.html and see results
Don’t run history command twice
Visual testing
18.
Tweaks
Add cookies
Add HTTP Authentication
Get debug information
Adjust PhantomJS parameters
Visual testing
19.
“Don’t believe me on anything. Try this out for yourself.”
Visual testing
20.
Questions?
Q & A
21.
Other sources & references
http://fourword.fourkitchens.com/article/testing-drupal-
casperjs
http://danmatthews.me/2014/05/09/behat-phantomjs.html
http://jaffamonkey.com/using-phantomjs-with-behat/
http://mink.behat.org/en/latest/index.html
https://amsterdam2014.drupal.org/session/automated-
frontend-testing

More Related Content

PDF
Intro to the Express Web Framework
PPTX
PDF
Javascript ui for rest services
PPT
Js unit testing
PDF
Packing it all: JavaScript module bundling from 2000 to now
PDF
Backbone.js
PDF
Developing large scale JavaScript applications
PDF
Vue 淺談前端建置工具
Intro to the Express Web Framework
Javascript ui for rest services
Js unit testing
Packing it all: JavaScript module bundling from 2000 to now
Backbone.js
Developing large scale JavaScript applications
Vue 淺談前端建置工具

What's hot (20)

PDF
Webpack Tutorial, Uppsala JS
PPTX
Jasmine with JS-Test-Driver
PDF
webpack 101 slides
PPTX
An Intro into webpack
PPTX
Backbone.js
PDF
ServiceWorker: New game changer is coming!
PDF
Webpack DevTalk
PDF
Javascript MVVM with Vue.JS
PDF
Nuxt.js - Introduction
PDF
From Hacker to Programmer (w/ Webpack, Babel and React)
PPTX
PDF
Service worker - Offline Web
PDF
Building a Startup Stack with AngularJS
PDF
Angular2 ecosystem
PDF
AngularJS - Overcoming performance issues. Limits.
PDF
NodeWay in my project & sails.js
PPTX
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
PDF
Vuejs for Angular developers
PDF
Integrating Browserify with Sprockets
PDF
Nuxt.JS Introdruction
Webpack Tutorial, Uppsala JS
Jasmine with JS-Test-Driver
webpack 101 slides
An Intro into webpack
Backbone.js
ServiceWorker: New game changer is coming!
Webpack DevTalk
Javascript MVVM with Vue.JS
Nuxt.js - Introduction
From Hacker to Programmer (w/ Webpack, Babel and React)
Service worker - Offline Web
Building a Startup Stack with AngularJS
Angular2 ecosystem
AngularJS - Overcoming performance issues. Limits.
NodeWay in my project & sails.js
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
Vuejs for Angular developers
Integrating Browserify with Sprockets
Nuxt.JS Introdruction
Ad

Viewers also liked (14)

PDF
Amplexor - Future of Document Management - DXM for the workplace
PPTX
Amplexor Sharepoint 2013 seminar
PDF
Google Analytics intro - Best practices for WCM
PPTX
Amplexor Customer Experience Management seminar presentation Damien Dewitte
PPTX
Mobilize your website and web applications
PDF
Amplexor Drupal for the Enterprise seminar - introduction
PDF
DrupalCon Amsterdam 2014 - Between structure and flexibility: Drupal for Mark...
PDF
Amplexor Drupal for the Enterprise seminar - evaluating Drupal for the Enterp...
PPTX
Mobile enterprise content management
PPTX
Enterprise Search - Introduction
PDF
Amplexor Customer Experience Management seminar Adobe
PPTX
Amplexor - The K2 Case Management Framework
PPTX
Amplexor lunch seminar - Enhancing your digital workplace with Microsoft Offi...
PPTX
Case Management by EMC - xCP Platform
Amplexor - Future of Document Management - DXM for the workplace
Amplexor Sharepoint 2013 seminar
Google Analytics intro - Best practices for WCM
Amplexor Customer Experience Management seminar presentation Damien Dewitte
Mobilize your website and web applications
Amplexor Drupal for the Enterprise seminar - introduction
DrupalCon Amsterdam 2014 - Between structure and flexibility: Drupal for Mark...
Amplexor Drupal for the Enterprise seminar - evaluating Drupal for the Enterp...
Mobile enterprise content management
Enterprise Search - Introduction
Amplexor Customer Experience Management seminar Adobe
Amplexor - The K2 Case Management Framework
Amplexor lunch seminar - Enhancing your digital workplace with Microsoft Offi...
Case Management by EMC - xCP Platform
Ad

Similar to Amplexor - Drupal Camp Romania 2015 - Front-end testing (20)

PDF
Rest web service_with_spring_hateoas
PDF
Beginning AngularJS
PPTX
Single Page JavaScript WebApps... A Gradle Story
PPT
Capistrano
PDF
Cross browser testing using BrowserStack
PPT
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
PPTX
Rails Engine | Modular application
PPTX
Web Controls Set-1
PPTX
Decapitating Selenium with JavaScript
PPTX
Java script performance tips
PDF
Struts An Open-source Architecture for Web Applications
PPTX
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
PDF
Magento Performance Optimization 101
PDF
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
PDF
Front End performance as a Continuous Integration - Part1
PDF
How to Webpack your Django!
PDF
Responsive Websites and Grid-Based Layouts by Gabriel Walt
PDF
Visual Regression Testing Using Playwright.pdf
PPT
Parkjihoon phonegap research_for_bada
PPTX
NLIT 2011: Chef & Capistrano
Rest web service_with_spring_hateoas
Beginning AngularJS
Single Page JavaScript WebApps... A Gradle Story
Capistrano
Cross browser testing using BrowserStack
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Rails Engine | Modular application
Web Controls Set-1
Decapitating Selenium with JavaScript
Java script performance tips
Struts An Open-source Architecture for Web Applications
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Magento Performance Optimization 101
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Front End performance as a Continuous Integration - Part1
How to Webpack your Django!
Responsive Websites and Grid-Based Layouts by Gabriel Walt
Visual Regression Testing Using Playwright.pdf
Parkjihoon phonegap research_for_bada
NLIT 2011: Chef & Capistrano

More from Amplexor (20)

PDF
Amplexor- Global Content Solutions
PDF
Amplexor- Intellectual Property Translations
PDF
Amplexor- Elearning Localization
PDF
Amplexor- Enterprise Terminology
PDF
Amplexor Enterprise Machine Translation
PDF
AMPLEXOR Expérience Digitale avec Adobe
PDF
AMPLEXOR Energy & Engineering - Services et Solutions
PDF
AMPLEXOR Energy & Engineering Solutions
PDF
AMPLEXOR and Drupal: Partnering for Premium Digital Experiences
PDF
20+ Years of International Documentum Expertise
PDF
AMPLEXOR Next-Generation Intranets
PDF
AMPLEXOR - Global leading partner for digital experience, collaboration and c...
PDF
AMPLEXOR | Career opportunities for graduates in Belgium
PDF
Internship Program for developers in Romania | Java & AEM
PDF
Internship Program for developers in Romania | PHP & Drupal
PDF
AMPLEXOR Digital Experience-Lösungen
PDF
AMPLEXOR Solutions d'Expérience Digitale
PDF
AMPLEXOR & Kentico | La formule gagnante pour votre strategie digitale
PDF
Camka, your hands-on partner for service excellence
PDF
AMPLEXOR - myInsight
Amplexor- Global Content Solutions
Amplexor- Intellectual Property Translations
Amplexor- Elearning Localization
Amplexor- Enterprise Terminology
Amplexor Enterprise Machine Translation
AMPLEXOR Expérience Digitale avec Adobe
AMPLEXOR Energy & Engineering - Services et Solutions
AMPLEXOR Energy & Engineering Solutions
AMPLEXOR and Drupal: Partnering for Premium Digital Experiences
20+ Years of International Documentum Expertise
AMPLEXOR Next-Generation Intranets
AMPLEXOR - Global leading partner for digital experience, collaboration and c...
AMPLEXOR | Career opportunities for graduates in Belgium
Internship Program for developers in Romania | Java & AEM
Internship Program for developers in Romania | PHP & Drupal
AMPLEXOR Digital Experience-Lösungen
AMPLEXOR Solutions d'Expérience Digitale
AMPLEXOR & Kentico | La formule gagnante pour votre strategie digitale
Camka, your hands-on partner for service excellence
AMPLEXOR - myInsight

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
A Presentation on Artificial Intelligence
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
Advanced methodologies resolving dimensionality complications for autism neur...
A Presentation on Artificial Intelligence
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25-Week II
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
A comparative analysis of optical character recognition models for extracting...
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity

Amplexor - Drupal Camp Romania 2015 - Front-end testing

  • 2. 2. About me Mircea Fernea Drupal Consultant at Amplexor Romania mircea.fernea@amplexor.com drupal.org/u/mfernea
  • 3. 3. Front-end testing Test pages the html structure & interactions Checking PageSpeed Insights Testing page load times & render speeds Check visual changes
  • 4. 4. CasperJS Allows for scripted actions to be tested with PhantomJS. It’s easy to setup for front-end developers. Test complex features or components within the page. Automate complex user actions. Test workflows like content creation. Check http responses on sensitive pages. HTML structure & Interactions
  • 5. 5. Behat & Mink & PhantomJS Behat can be integrated with PhantomJS through Mink and Selenium2 Storing credentials, creating scenarios that include backend interaction are easier to setup in Behat. You can even run tests for multiple screen sizes. HTML structure & Interactions
  • 6. 6. grunt-pagespeed https://www.npmjs.com/package/grunt-pagespeed You get all the information from https://developers.google.com/speed/pagespeed/insights/ ?url=http%3A%2F%2Fwww.smashingmagazine.com%2F &tab=mobile PageSpeed Insights
  • 7. 7. grunt-phantomas https://www.npmjs.com/package/grunt-phantomas A PhantomJS-based web performance metrics tool http://stefanjudis.github.io/grunt-phantomas/gruntjs/ Page load times & render speeds
  • 9. 9. grunt-perfbudget https://github.com/tkadlec/grunt-perfbudget It’s based on WebPageTest API http://www.webpagetest.org/ It can leverage multiple browsers, geographic locations and network speeds. You can have budget for number of requests, load time etc. See the budget as threshold value. Performance budgets
  • 10. 10. Wraith https://github.com/BBC-News/wraith Developed by the guys at BBC News Wraith uses either PhantomJS or SlimerJS to create screen-shots of webpages on different environments and then creates a diff of the two images. Imagemagick and PhantomJS or SlimmerJS are required to use Wraith. CasperJS can be used to target specific selectors. Visual testing
  • 11. 11. Wraith - Install $ brew install phantomjs $ brew install imagemagick $ gem install wraith Visual testing
  • 12. 12. Wraith modes Standard: take screenshots of two environments, producing a visual diff of the two screenshots Casper: take screenshots of an element from two environments using selectors, producing a visual diff of the two screenshots History: rather than capture two environments, capture the same environment at two different moments in time to compare them if anything changed Visual testing
  • 13. 13. Standard mode Take screenshots of two environments, producing a visual diff of the two screenshots $ wraith setup - creates configs/config.yaml and javascript/snap.js Adjust config.yaml to setup config and the two environments (e.g. resolutions, pages) $ wraith capture config $ Open gallery.html from output dir to view results $ wraith reset_shots config Visual testing
  • 16. 16. Casper mode Casper: take screenshots of an element from two environments using selectors, producing a visual diff of the two screenshots $ wraith setup_casper - creates configs/component.yaml and javascripts/casper.js Adjust component.yaml $ wraith capture component If multiple matches found, only the first one is captured Don’t start your selector with “#”. Add “div” in front Open gallery.html to see results Visual testing
  • 17. 17. History mode Rather than capture two environments, capture the same environment at two different moments in time to compare them if anything changed $ wraith setup Adjust config.yaml and rename it (e.g. local-history) $ wraith history local-history $ wraith latest local-history Open gallery.html and see results Don’t run history command twice Visual testing
  • 18. 18. Tweaks Add cookies Add HTTP Authentication Get debug information Adjust PhantomJS parameters Visual testing
  • 19. 19. “Don’t believe me on anything. Try this out for yourself.” Visual testing
  • 21. 21. Other sources & references http://fourword.fourkitchens.com/article/testing-drupal- casperjs http://danmatthews.me/2014/05/09/behat-phantomjs.html http://jaffamonkey.com/using-phantomjs-with-behat/ http://mink.behat.org/en/latest/index.html https://amsterdam2014.drupal.org/session/automated- frontend-testing