4. 4axelerant.com@shwetasharma84
Agenda
● What is Automated Visual testing?
● Why do we need it?
● How does it work?
● When to use what?
● Challenges with Automated Visual testing
● How WebdriverIO / Applitools addresses these challenges
● Reports in WebdriverIO
● Demo
9. 9axelerant.com@shwetasharma84
How does it work?
Test Runner
Capture screenshots at run time
Report differences
Update baselineBug
Compare
Capture baseline images
First run
Subsequent runs
11. 11axelerant.com@shwetasharma84
WebdriverIO
● Open source
● Support for BDD
● Good community support
● Support for multiple test framework (Mocha, Jasmine, Cucumber)
● Corresponding support for assertion libraries (Chai for Mocha)
● Wide CLI options
● Page Object framework
● Multiple reporting options
● Multiple ready to use services (Visual regression service)
● Cloud service support (Browserstack, Sauce Labs or TestingBot)
12. 12axelerant.com@shwetasharma84
How WebdriverIO handles few challenges
Visual regression service by WebdriverIO
Hide
● Hide all elements queried by
WebdriverIO selector strategies
● Element’s space is filled and
considered in the layout of the
screenshot captured
● Good candidates - Ad blocks, Images
that change
Remove
● Remove all elements queried by
WebdriverIO selector strategies
● Element is removed from the DOM -
affects the design of the page
● Good candidates - Sticky
headers/footers, popover help/chat
windows
NOTE: Visual regression service is available till version 4.*. It is replaced by Applitools service from 5.*
15. 15axelerant.com@shwetasharma84
WebdriverIO Reports
● Dot (default)
● Spec
● Junit (Sophisticated reports for CI server)
● Allure
● Teamcity
● Concise
● Tap ()
● Mochawesome (creates a json output consumed by marge)
● Slick (local development)
16. 16axelerant.com@shwetasharma84
Demonstration
● Speed up tests - Parallel execution on multiple browsers
● Tests using below frameworks:
○ Mocha
○ Jasmine
● Organize Test Suites
● Run tests on browserstack
○ WebdriverIO has out of the box support
○ Creates a tunnel between local machine and browserstack (browserstack.Local: true)
○ Supports multiple browsers with different browser/OS versions
○ Supports multiple real devices (needs Mobile App plan activation)
17. 17axelerant.com@shwetasharma84
Applitools
● 40+ SDKs available free to use
○ Different programming languages
○ Test Runners
○ Web/Mobile apps
○ Quick to extend your current tests to include Visual Validation
● Capture screenshot commands
○ checkWindow - Entire browser/window
○ checkElement - Particular element
○ checkFrame - Particular frame
○ checkRegion - To handle dynamic and shifting content
● Handles dynamic content which is also floating/shifting
● In-built support for anti-aliasing
18. 18axelerant.com@shwetasharma84
Match Levels in Applitools
Strict
● Recommended
● Content
● Font
● Layout
● Color
● Position of elements
Layout
● Tests the layout
● Validates the alignment
and relative position of
all elements on the page,
such as: buttons, menus,
text areas, paragraphs,
images, and columns
● Ignores the content,
colour and other style
changes between the
pages
Content
● Similar to Strict
● Compares content but
ignores colors
21. 21axelerant.com@shwetasharma84
How we integrated in our development workflow?
BUILD
CI PIPELINE
COMMIT
CODE
ACCEPTANCE
TESTING
VISUAL
REGRESSION
DATA
SEEDING
CD PIPELINE
REVIEW
STAGING
PRODUCTION
22. 22axelerant.com@shwetasharma84
Advantages of Gold Master testing
● Test data
○ Time saved to handle dynamic content scenarios because of data consistency
○ Minimal efforts for Visual tests
● Seamless integration of Automation tools involved
● Visual tests validated for the site which is a replica of the wireframe
● Less number of assertions required for the Acceptance test Automation suite
23. 23axelerant.com@shwetasharma84
Facts
● Efforts needed to maintain baseline images
● Respect the Test Pyramid
○ Include Unit tests, Service tests, Acceptance tests and Visual tests
● Best practices in Automating Visual tests:
○ Ensure full page validation
○ Do not have too many element specific tests
■ Avoid element locators maintenance
○ General rules for automating Acceptance tests apply here too:
■ Pick up the right candidates for Automation
■ Logical division of tests
■ Usage of Seams
● Do not expect overnight success
24. 24axelerant.com@shwetasharma84
When to use what?
Static content
● Wraith
● PhantomCSS
● Spectre
Shifting Content
● Applitools (SDKs and
Selenium IDE extension)
Dynamic content
● WebdriverIO Visual
regression service
● Shoov
● BackstopJS
● WebdriverCSS
● Gemini
26. 26axelerant.com@shwetasharma84
Join us for contribution opportunities
Mentored Contribution
9:00-18:00
Room: 602
General Contribution
9:00-18:00
Room: 6A
First time Contributor
Workshop
9:00-12:00
Room: 606
Friday, April 12, 2019
27. 27axelerant.com@shwetasharma84
What did you think?
Locate this session at the DrupalCon Seattle website:
https://events.drupal.org/seattle2019/schedule/builder/2019-04-11
Take the Survey!
https://www.surveymonkey.com/r/DrupalConSeattle
28. 28axelerant.com@shwetasharma84
Q & A
● Concept of Automated Visual testing
● Algorithm around all tools
● Challenges in Automated Visual
testing
● Challenges handled by WebdriverIO
and Applitools
● Gold Master Testing
Twitter - @shwetasharma84
LinkedIn - @shwetaneelsharma
GitHub - @shwetaneelsharma
Skype - @shweta_ns