# Spectrum CSS Testing Asset

A repo to generate and store BackstopJS visual regression testing assets for [spectrum-css](https://github.com/adobe/spectrum-css).

## Prerequisites

1. Install docker from [here](https://hub.docker.com/search/?type=edition&offering=community&architecture=amd64).

2. Make sure Docker is running as below on MacOS. ![example](https://user-images.githubusercontent.com/447033/42773728-fef034f4-88e2-11e8-9956-d58a7d432402.png)

## Rebuild BackstopJS Bitmaps

Accepts two command line parameters

1. `--repo` to specify github repository url. Default value as https://github.com/adobe/spectrum-css.git
2. `--branch` to specify code branch that the test run against. Default value as `master`.

### Examples

#### Run test on branch `fix_button_margin` of default Spectrum-CSS repository

`./build.sh rebuild_reference --branch=fix_button_margin`

#### Run test on branch `feat_card` of repo - https://github.com/jianliao/spectrum-css.git

`./build.sh rebuild_reference --branch=feat_card --repo=https://github.com/jianliao/spectrum-css.git`

#### Run all the test scenarios on branch `master` of default Spectrum-CSS repository

All the test scenarios is about 2000+ and takes about 30 mins.

`./build.sh rebuild_all_reference`

## Review the result

Once rebuild_reference done, a browser window will be opened to show the result for you to review.

![result](https://camo.githubusercontent.com/5c25a01f68b8442311b94cb1a1a16add1fee665f/687474703a2f2f6761727269732e6769746875622e696f2f4261636b73746f704a532f6173736574732f6f7352656e646572446966666572656e63652e706e67)

## Update BackstopJS Bitmaps Reference

If all the failure scenarios are expected, run the following command to update the bitmaps reference in folder - `bitmaps_reference/`.

`./build.sh update_reference`

## Publish @adobe/spectrum-css-test-asset

1. Bump up the version number in package.json
2. Git push the change to the repository
3. Publish the new package by `npm publish`
