Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Functional layout testing with Gemini

Functional layout testing with Gemini

Avatar for Sergey Belov

Sergey Belov

May 21, 2014

Other Decks in Programming

Transcript

  1. Code QA JS code style ⟶ jscs JS code static

    analysis ⟶ JSHint JS code regression testing ⟶ Unit Testing Frameworks (mocha, jasmine) HTML and CSS regression testing ⟶ ??? 5
  2. 6

  3. We want to Test blocks in different browsers
 (Chrome, Firefox,

    IE, Opera, iOS and Android) Take shots of small parts of the page Test blocks in different states Compare with reference images kept in a repository Write tests in JavaScript using convenient test API 7
  4. 8 HTML and CSS QA dpxdt casper + phantom.css huxley

    Many different browsers ✘ ✘ ✘ Page fragment comparison ✘ ✘ Reference images ✘ Many different states ✘ Tests in JavaScript ✘ ✘
  5. 11

  6. 12 button plain hovered Move mouse over button pressed Press

    left mouse button focused Release left mouse button
  7. button.gemimi.js var gemini = require('gemini'); ! gemini.suite('button', function() { suite.setUrl('/some/page.html')

    .setCaptureElements('.button') .before(function(actions, find) { this.button = find('.button'); }) .capture('plain') .capture('hovered', function(actions) { actions.mouseMove(this.button); }) .capture('pressed', function(actions) { actions.mouseDown(this.button); }) .capture('clicked', function(actions) { actions.mouseUp(this.button); }); }); 22
  8. button.gemimi.js var gemini = require('gemini'); ! gemini.suite('button', function() { suite.setUrl('/some/page.html')

    .setCaptureElements('.button') .before(function(actions, find) { this.button = find('.button'); }) .capture('plain') .capture('hovered', function(actions) { actions.mouseMove(this.button); }) .capture('pressed', function(actions) { actions.mouseDown(this.button); }) .capture('clicked', function(actions) { actions.mouseUp(this.button); }); }); 23
  9. .gemini.yml rootUrl: http://example.com/ gridUrl: http://localhost:4444/wd/hub ! browsers: - {name: chrome,

    version: '33.0'} - {name: opera, version: '12.16'} - {name: firefox, version: '25.0'} - {name: ie, version: ’10.0'} 24
  10. Pro Tips Gemini is not a replacement for your JS

    unit-tests Use static data to render your HTML Optimize reference images before commit 26
  11. .travis.yml env: global: # WARNING! use `travis encrypt` to encrypt

    this vars - SAUCE_USERNAME=<your-username> - SAUCE_ACCESS_KEY=<your-access-key> ! addons: sauce_connect: true ! before_script: - sudo apt-get update -qq - sudo apt-get install -y graphicsmagick - npm install http-server - node_modules/.bin/http-server -s -p 8000 & 28
  12. .gemini.yml rootUrl: http://localhost:8000/ gridUrl: http://ondemand.saucelabs.com/wd/hub ! browsers: - {name: chrome,

    version: 33} - {name: opera, version: 12} - {name: firefox, version: 29} - {name: internet explorer, version: 9} 29