Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically generate documentation and upload it #47

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Generate documentation
on:
push:
branches:
- master
- upload-docs

jobs:
doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Build documentation
run: |
npm install
make doc

- name: Upload to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
results.*
screenshots
doc/

# Editor
.vscode/
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ lint:
test:
@npm run test --silent

doc: *.js tsconfig.json
./node_modules/.bin/typedoc --out doc --noEmit --excludeNotExported --excludeNotDocumented

lockserver-dev:
node_modules/.bin/nodemon lockserver/lockserver.js

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ module.exports = {

Note that while the above example tests a webpage with [puppeteer](https://github.com/GoogleChrome/puppeteer) and uses pintf's has native support for HTTP requests (in `net_utils`) and email sending (in `email`), tests can be anything – they just have to fail the promise if the test fails.

Have a look in the [API documentation](https://boxine.github.io/pintf/index.html) for various helper functions.

## Configuration

pintf is designed to be run against different configurations, e.g. local/dev/stage/prod. Create JSON files in the `config` subdirectory for each environment. You can also add a programatic configuration by passing a function `defaultConfig` to `pintf.main`; see [pintf's own run](run) for an example.
Expand Down
13 changes: 9 additions & 4 deletions browser_utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
'use strict';
/**
* Browser functions, based upon puppeteer.
* These functions extend [the puppeteer API](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md).
* @packageDocumentation
*/

const assert = require('assert');
const fs = require('fs');
Expand All @@ -11,10 +16,10 @@ const {assertAsyncEventually, wait, remove} = require('./utils');
let tmp_home;

/**
* Launch a new page
* @param {*} config
* @param {string[]} [chrome_args]
* @returns {import('puppeteer').Page}
* Launch a new browser, with a new page (=Tab)
* @param {*} config The pintf configuration
* @param {string[]} [chrome_args] Additional arguments for Chrome (optional)
* @returns {import('puppeteer').Page} The puppeteer page handle.
*/
async function newPage(config, chrome_args=[]) {
let puppeteer;
Expand Down
192 changes: 192 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"nodemon": "^1.18.11",
"puppeteer": "^2.1.1",
"rimraf": "^3.0.2",
"typedoc": "^0.17.3",
"typescript": "^3.8.3"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"module": "CommonJS",
"allowJs": true,
"alwaysStrict": true,
"declaration": true,
"emitDeclarationOnly": true,
},
Expand Down