Skip to content

Commit

Permalink
Add an example test config, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jason0x43 committed May 17, 2018
1 parent 725e2ad commit 3ef621a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ html-report
/typings
.grunt
npm-debug.log
visual-test
visual-test/
example-test/
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ $ npm install intern @theintern/visual-plugin --save-dev

Ok! You want to see all the great things visual regression testing can do and
how to do it! See some real test code by looking in the
[tests/visual](./tests/visual) directory.
[tests/example](./tests/example) directory.

To run our visual regression tests:
To run the example tests:

1. Clone this project
1. Install package dependencies
Expand All @@ -85,9 +85,14 @@ To run our visual regression tests:
```
1. Run the tests
```
npm test
npm test config=@example
```

If you want to see what an error looks like, modify the HTML file used by the
tests, in `_tests/tests/support/pages/basic.html`. For example, change the
paragraph text, or change the background color from pink to green. Then re-run
the test. It will fail, and a report will be generated in `visual-tests/report`.

## API and architecture

This plugin has three main exports:
Expand Down
13 changes: 13 additions & 0 deletions intern.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@
],
"tunnel": "browserstack",
"maxConcurrency": 1
},

"example": {
"environments": "chrome",
"functionalSuites": "_tests/tests/example/**/*.js",
"coverage": [],
"reporters": "runner",
"plugins": {
"script": "_tests/src",
"options": {
"directory": "example-test"
}
}
}
}
}
4 changes: 2 additions & 2 deletions tests/example/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ registerSuite('example tests', {
url: basicPageUrl,
width: 640,
height: 480,
missingBaseline: 'ignore'
missingBaseline: 'snapshot'
}),

'custom visual test'() {
Expand All @@ -24,7 +24,7 @@ registerSuite('example tests', {
.takeScreenshot()
.then(
assertVisuals(this, {
missingBaseline: 'ignore'
missingBaseline: 'snapshot'
})
);
}
Expand Down

0 comments on commit 3ef621a

Please sign in to comment.