Skip to content
This repository was archived by the owner on Feb 11, 2023. It is now read-only.

Commit eec99ac

Browse files
committed
Add E2E tests using files in examples directory
* Add tests * Unignore JS test files * Run tests in CI * Add test:e2e script * Add TestCafe plugins for linting * Add start:e2e script for E2E tests * Install testcafe + configuration * Serve examples at localhost using servor * Run E2E tests before release creation
1 parent 53644b0 commit eec99ac

11 files changed

+6635
-379
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
2-
extends: 'eslint:recommended',
2+
extends: ['eslint:recommended', 'plugin:testcafe/recommended'],
33
parser: '@typescript-eslint/parser',
4-
plugins: ['@typescript-eslint'],
4+
plugins: ['@typescript-eslint', 'testcafe'],
55
parserOptions: {
66
sourceType: 'module',
77
},

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
.coverage
1010
.rpt2_cache
1111
dist
12-
.env
13-
tests/**/*.js
12+
.env

.release-it.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
releaseNotes: null,
1212
},
1313
hooks: {
14-
'before:init': ['npm test'],
14+
'before:init': ['npm test', 'npm run test:e2e'],
1515
'after:bump': 'npm run build && npm run banner',
1616
'after:release':
1717
'echo Successfully released ${name} v${version} to ${repo.repository}.',

.testcaferc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"browsers": [
3+
"browserstack:firefox@95:Windows 10",
4+
"browserstack:edge@96:Windows 10"
5+
],
6+
"hostname": "localhost",
7+
"src": "**/*.e2e.js",
8+
"appCommand": "npm run start:e2e"
9+
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ node_js:
44
script:
55
- npm test
66
- npm run build # ensure it builds
7+
- npm run test:e2e
78
after_success: 'npm run coveralls'

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,11 @@ Run tests:
190190
npm install
191191
npm test
192192
```
193+
194+
### E2E Tests
195+
196+
The following runs E2E tests on the files in the examples folder.
197+
198+
```
199+
npm run test:e2e
200+
```

examples/scroll-to-element.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<!-- update the path to scroll script below -->
5555
<script type="module">
56-
import { scrollTo, scrollIntoView } from './dist/scroll.min.js';
56+
import { scrollTo, scrollIntoView } from '../dist/scroll.min.js';
5757
const scrollButton = document.getElementById('scroll-btn');
5858
const greenBox = document.querySelector('.green');
5959
const pink = document.querySelector('.pink');

examples/vertical-scroll.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
<!-- update the path to scroll script below -->
5353
<script type="module">
54-
import { scrollTo } from './dist/scroll.min.js';
54+
import { scrollTo } from '../dist/scroll.min.js';
5555
const scrollButton = document.getElementById('scroll-btn');
5656

5757
// when the scroll button is clicked, scroll down 2000 pixels

0 commit comments

Comments
 (0)