Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ax1/a1-test
Test HTML files with zero configuration
https://github.com/ax1/a1-test
Last synced: 27 days ago
JSON representation
Test HTML files with zero configuration
- Host: GitHub
- URL: https://github.com/ax1/a1-test
- Owner: ax1
- License: mit
- Created: 2017-07-07T23:32:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-09T20:50:15.000Z (almost 3 years ago)
- Last Synced: 2024-12-16T23:13:55.133Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# a1-test
> test html files in one line
Testing web apps is a tedius task. Automate web tests can consume a lot of effort. This package saves precious time by allowing a really easy way to test a set of web pages.
The test will take a folder of html pages as input and it will run a headless chrome on them. If any console.error is captured on the page, the test is failed.
The test can also check external urls, use the depth parameter to browse around related pages.
For devs: use https://developers.google.com/web/updates/2017/04/headless-chrome as tutorial and https://chromedevtools.github.io/devtools-protocol as referenceTo test all the html files in a local folder:
```javascript
const test = require('a1-test')
try {
const folder = '/home/steven/myApp' // index.html, landing.html, details/index.html ...
await test.folder(folder) // also test.folder(folder, '/usr/lib/chromium-browser/chromium-browser')
assert.ok(true,'tests passed')
} catch (e) {
assert.fail(e.toString())
}
```
To test url and related pages, use the `url()`. The test will look for related tags, so use a depth parameter to limit the pages to test.
```javascript
const test = require('a1-test')
try {
await test.url('http://google.com', '/usr/lib/chromium-browser/chromium-browser', 1)
assert.ok(true,'tests passed')
} catch (e) {
assert.fail(e.toString())
}
```
For devs:Fork the github project and customize by following these links:
- https://developers.google.com/web/updates/2017/04/headless-chrome
- https://chromedevtools.github.io/devtools-protocol/