Skip to content

Commit 3ef621a

Browse files
committed
Add an example test config, update README
1 parent 725e2ad commit 3ef621a

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ html-report
1212
/typings
1313
.grunt
1414
npm-debug.log
15-
visual-test
15+
visual-test/
16+
example-test/

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ $ npm install intern @theintern/visual-plugin --save-dev
7474

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

79-
To run our visual regression tests:
79+
To run the example tests:
8080

8181
1. Clone this project
8282
1. Install package dependencies
@@ -85,9 +85,14 @@ To run our visual regression tests:
8585
```
8686
1. Run the tests
8787
```
88-
npm test
88+
npm test config=@example
8989
```
9090
91+
If you want to see what an error looks like, modify the HTML file used by the
92+
tests, in `_tests/tests/support/pages/basic.html`. For example, change the
93+
paragraph text, or change the background color from pink to green. Then re-run
94+
the test. It will fail, and a report will be generated in `visual-tests/report`.
95+
9196
## API and architecture
9297
9398
This plugin has three main exports:

intern.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@
5555
],
5656
"tunnel": "browserstack",
5757
"maxConcurrency": 1
58+
},
59+
60+
"example": {
61+
"environments": "chrome",
62+
"functionalSuites": "_tests/tests/example/**/*.js",
63+
"coverage": [],
64+
"reporters": "runner",
65+
"plugins": {
66+
"script": "_tests/src",
67+
"options": {
68+
"directory": "example-test"
69+
}
70+
}
5871
}
5972
}
6073
}

tests/example/tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ registerSuite('example tests', {
1414
url: basicPageUrl,
1515
width: 640,
1616
height: 480,
17-
missingBaseline: 'ignore'
17+
missingBaseline: 'snapshot'
1818
}),
1919

2020
'custom visual test'() {
@@ -24,7 +24,7 @@ registerSuite('example tests', {
2424
.takeScreenshot()
2525
.then(
2626
assertVisuals(this, {
27-
missingBaseline: 'ignore'
27+
missingBaseline: 'snapshot'
2828
})
2929
);
3030
}

0 commit comments

Comments
 (0)