2017 © Pedro Peláez
 

library behat-perceptual-diff

Modification of zodyac/behat-perceptual-diff-extension which supports SilverStripe CMS ajax handling

image

silverstripe/behat-perceptual-diff

Modification of zodyac/behat-perceptual-diff-extension which supports SilverStripe CMS ajax handling

  • Friday, February 21, 2014
  • by chillu
  • Repository
  • 3 Watchers
  • 6 Stars
  • 78 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Behat Perceptual Diffs for SilverStripe CMS

Enables visual diff regression testing for SilverStripe CMS, through the existing Behat test coverage., (*1)

Builds on the awesome BehatPerceptualDiff extension, which is based on concepts from Huxley. Customizes the extension's StepTester class to wait for jQuery ajax requests to complete before taking the screenshot, which makes the logic a lot more useful to the SilverStripe CMS UI, and avoids error-prone static sleep periods., (*2)

This extension is only required for perceptual diff testing in the SilverStripe CMS UI. For perceptual diffs on websites running SilverStripe, use the underlying BehatPerceptualDiff extension directly., (*3)

Preview of a visual diff, (*4)

Preview of a visual diff from the SilverStripe CMS UI (added buttons in TinyMCE editor), (*5)

Installation

Follow the SilverStripe Behat Extension install instructions to get a basic project set up with Behat., (*6)

Add the perceptual diff extension, (*7)

composer require silverstripe/behat-perceptual-diff

Replace the behat.yml in your project root with the following content. Adjust the base_url accordingly., (*8)

default:
  filters:
    tags: "~@todo"
  formatter:
    name: pretty

  extensions:

    SilverStripe\BehatExtension\MinkExtension:
      base_url:  http://localhost/
      files_path: %behat.paths.base%/framework/tests/behat/features/files/
      default_session: selenium2
      javascript_session: selenium2
      goutte: ~
      selenium2:
        browser: firefox

    SilverStripe\BehatExtension\Extension: ~

    Zodyac\Behat\PerceptualDiffExtension\Extension:
      sleep: 0.3
      path: pdiffs
      fail_on_diff: true
      compare:
        highlight_color: red
        metric: AE
        fuzz: 20

    SilverStripe\Behat\PerceptualDiffExtension\Extension: ~

It is important that Zodyac\Behat\PerceptualDiffExtension\Extension:sleep is set reasonably high (around 0.3s), in order to give the CMS UI time to process ajax responses and render the UI., (*9)

Usage

Run your behat tests as usual, each step will generate a screenshot in the pdiff/ folder. The first run will create a pdiff/baseline/ folder, additional runs will compare against that., (*10)

The Versions

21/02 2014

dev-master

9999999-dev http://silverstripe.org

Modification of zodyac/behat-perceptual-diff-extension which supports SilverStripe CMS ajax handling

  Sources   Download

BSD-3-Clause

The Requires

 

behat silverstripe