Visual/CSS Regression Testing Catching the Unintended Consequences - - PowerPoint PPT Presentation

visual css regression testing
SMART_READER_LITE
LIVE PREVIEW

Visual/CSS Regression Testing Catching the Unintended Consequences - - PowerPoint PPT Presentation

Visual/CSS Regression Testing Catching the Unintended Consequences of modifying your theme DrupalCamp Florida 2015 Florida Technical College Saturday, April 11, 2015 Who am I? Lisa Ridley Solutions Architect, Promet Source


slide-1
SLIDE 1

Visual/CSS Regression Testing

DrupalCamp Florida 2015 Florida Technical College Saturday, April 11, 2015

Catching the “Unintended Consequences”

  • f modifying your theme
slide-2
SLIDE 2

Who am I?

  • Lisa Ridley
  • Solutions Architect, Promet Source
  • lisa@prometsource.com
  • drupal: lhridley
  • twitter: lhridley
  • blog: codementality.com
slide-3
SLIDE 3

About Promet Source

Custom Development

  • Drupal websites
  • Drupal-based web

applications

  • Mobile apps integration
  • Systems integration
  • CMS migrations
  • Custom ecommerce
  • Prototyping and proof-of-

concepts

Support

  • 24x7 with SLA
  • Support for Drupal sites

built by others

  • 24x7 monitoring
  • Drupal security and

maintenance updates

  • QA for custom modules
  • Code-level fixes
  • Help desk support
  • Ongoing development

DevOps

  • Automated cloud

infrastructure

  • Drupal deployments
  • Configuration

management for Drupal

  • Automated testing
  • Continuous integration
  • Performance and scaling
  • Open source tools (Chef,

Git, Jenkins)

Open Source Applications – Focus on Drupal

➢ Founded in 2003 ➢ Open source technologists ➢ Drupal platform since 2008 ➢ Mobile apps since 2009 ➢ Based in Chicago ➢ Distributed global team ➢ Agile development practices ➢ 24x7 support

slide-4
SLIDE 4

–Wikipedia

What is Regression Testing?

slide-5
SLIDE 5

How do you regression test the visual components of a user interface?

slide-6
SLIDE 6

What if you could take a “before” and “after” picture? And could easily compare those pictures to each other?

slide-7
SLIDE 7

Enter PhantomCSS

slide-8
SLIDE 8

How does it work?

slide-9
SLIDE 9

What does that look like?

Baseline Image Comparison Image PhantomCSS Diff Image

slide-10
SLIDE 10

PhantomCSS Dependencies

+

PhantomJS (v1.9.7) CasperJS (1.1.beta-3)

SlimerJS (v0.9.4)

slide-11
SLIDE 11

Other Dependencies for Testing Servers (Linux)

  • FontConfig
  • FreeType
  • ttf-dejavu
  • ttf-mscorefonts-installer
  • xvfb (SlimerJS)
slide-12
SLIDE 12

Skillsets Needed to Write Tests for PhantomCSS

Javascript

slide-13
SLIDE 13

casper.start( ‘url-of-web-page’ ); casper.viewport(1024, 768); casper.then(function(){ phantomcss.screenshot(‘#css-selector‘, ‘image-name’); }); casper.then( function now_check_the_screenshots(){ phantomcss.compareAll(); }); casper.then( function end_it(){ casper.test.done(); }); casper.run(function(){ phantom.exit(phantomcss.getExitStatus()); });

slide-14
SLIDE 14

Javascript Object Instances Available to Test Scripts

  • phantom
  • casper
  • phantomcss
slide-15
SLIDE 15

Author recommended Best Practices for PhantomCSS

  • Does not replace functional testing
  • Don’t use complex CSS3 selectors
  • Name Your Screenshots
  • Don’t try to test all the visuals
  • Full page screenshots are a bad idea
slide-16
SLIDE 16

Limitations of PhantomCSS

  • No Support for Flash
  • May require non-standard font installations on your

testing server

  • May generate false test failures due to spatial

aliasing of antialiased images

  • Some page elements that have display: none on

larger viewports but are visible on smaller viewports are seen as “not visible”

slide-17
SLIDE 17

Let’s look at a test site

slide-18
SLIDE 18

Fixed Header and Nav Bar

Nav bar Items are Mega Menus

Front Page Slider Pre Content Blocks

Blocks have mouseover color change on background

Two column content area Fixed Footer

slide-19
SLIDE 19

Test Suite for Test Site

  • Homepage
  • Homepage with each

Megamenu displayed

  • Each Megamenu

element

  • Header, Nav bar,

footer

  • Pre-content blocks
  • Pre-content blocks

with each in “hover” state

  • Content areas (left and

right) 20 images in all

slide-20
SLIDE 20

Let’s switch to the actual site and run a demo

slide-21
SLIDE 21

Documentation

  • casperjs.readthedocs.org
  • casperjs.readthedocs.org/en/latest/selectors.html
  • casperjs.readthedocs.org/en/latest/modules/casper.html
  • casperjs.readthedocs.org/en/latest/modules/mouse.html
  • casperjs.readthedocs.org/en/latest/modules/utils.html
  • phantomjs.org/documentation/
  • github.com/Huddle/PhantomCSS/blob/master/

README.md

slide-22
SLIDE 22
  • Lisa Ridley
  • Solutions Architect, Promet Source
  • lisa@prometsource.com
  • drupal: lhridley
  • twitter: lhridley
  • blog: codementality.com

Questions?