visual/css regression testing -- catching the "unintended consequences" of modifying your...

22
Catching the “Unintended Consequences” of Modifying Your Theme Visual/CSS Regression Testing DrupalCamp Colorado Auraria Higher Education Center Sunday, June 22, 2015

Upload: lisa-ridley

Post on 06-Aug-2015

146 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

Catching the “Unintended Consequences” of Modifying Your Theme

Visual/CSS Regression Testing

DrupalCamp Colorado

Auraria Higher Education Center

Sunday, June 22, 2015

Page 2: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

2

Who am I?

Lisa Ridley Solutions Architect, Support Services, Promet Source [email protected] drupal.org: lhridley twitter: @lhridley blog: codementality.com

Page 3: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

3

ABOUT PROMET SOURCE

Promet  realigned  its  core  services  and  solutions  to  be  a  Drupal  development  shop  in  2009.  

With  headquarters  in  Chicago  and  an  office  in  Cebu,  Promet  Source  is  a  comprehensive  Drupal  development  agency  that  offers  custom  design,  custom  implementations  and  full  24x7  support  to  its  clients.

Founded  in  2003,  Promet  Source  is  a  web  design  and  development  company  that  specializes  in  open  source  solutions  for  government,  higher  education  and  association/  nonprofit  clients.  

Page 4: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

What is Regression Testing?

4

Page 5: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

5

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

Page 6: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

6

What if you could take a “before" and “after” picture….

…and could easily compare those pictures to each other?

Page 7: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

7

Enter PhantomCSS

Page 8: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

8

How does it work?

Page 9: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

9

Baseline Comparison

PhantomCSS Diff

What does that look like?

Page 10: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

10

+PhantomJS CasperJS

SlimerJS

PhantomCSS Dependencies

Page 11: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

Other Dependencies for Testing Servers (Linux)

11

FontConfig

FreeType

ttf-dejavu

ttf-mscorefonts-installer

xvfb (SlimerJS)

Page 12: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

12

Skillsets Needed to Write Tests for PhantomCSS

Javascript

Page 13: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

13

casper.start( ‘url-of-web-page’ ); 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()); });

Page 14: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

14

Javascript Object Instances Available to Test Scripts

Lisa Ridley Solutions Architect, Support Services, Promet Source [email protected] drupal.org: lhridley twitter: @lhridley blog: codementality.com

phantom

casper

phantomcss

Page 15: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

15

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

Author Recommended Best Practices for PhantomCSS

Page 16: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

16

Let’s Look at a Test Site

Page 17: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

17

Fixed Header and Nav BarNav bar Items are Mega Menus

Front Page Slider

Pre Content BlocksBlocks have mouseover background color change

Two column content area

Fixed Footer

Page 18: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

18

Test Suite for the Test Site

Home page

Home page with each Megamenu Displayed

Each Megamenu Element

header, nav bar, footer

PreContent Blocks

PreContent Blocks in hover state

Content Areas (left and right)

20 images in all

Page 19: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

Let’s Switch to the Actual Site and Run a Demo

19

Page 20: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

20

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

Documentation

Page 21: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

21

Demo Test Script

http://bit.ly/1I6AtfH

Page 22: Visual/CSS Regression Testing -- Catching the "unintended consequences" of modifying your theme

22

Questions?

Lisa Ridley Solutions Architect, Support Services, Promet Source [email protected] drupal.org: lhridley twitter: @lhridley blog: codementality.com

Lisa Ridley Solutions Architect, Support Services, Promet Source [email protected] drupal.org: lhridley twitter: @lhridley blog: codementality.com