Skip to content

Commit

Permalink
Improve reports
Browse files Browse the repository at this point in the history
  • Loading branch information
GaelGirodon committed May 18, 2023
1 parent 8555558 commit 3b3cb1e
Show file tree
Hide file tree
Showing 30 changed files with 677 additions and 152 deletions.
88 changes: 63 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,36 +307,48 @@ config:
headless: true
device: "Galaxy S8"
headers: {"X-User":"user"}
timeout: 10000
retries: 3
output: "./reports/"
formats: ["html"]
proxy:
server: "http://myproxy.com:3128"
bypass: ".com, chromium.org, .domain.com"
username: "username"
password: "password"
timeout: 10000
retries: 3
output: "./reports/"
formats: ["html"]
influxdb:
url: "http://localhost:8086"
token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
org: "my-org"
bucket: "my-bucket"
prefix: "eco_"
dryRun: true
verbose: true
```
| Name | Description | Type | Default | Values |
| ------------ | ---------------------------------------------------------------- | --------- | ----------- | --------------------------------------------------- |
| `browser` | Browser to run the audit with | `string` | `chromium` | `msedge`, `chrome`, `chromium`, `firefox`, `webkit` |
| `headless` | Run browser in headless mode | `boolean` | `true` | |
| `device` | Simulate browser behavior for a specific device | `string` | | |
| `headers` | Additional HTTP headers to be sent with every request | `object` | | |
| `timeout` | Maximum time to wait for navigations or actions, in milliseconds | `integer` | | |
| `retries` | Number of retries in case of failure | `integer` | `0` | |
| `output` | Directory to write reports to | `string` | `.` | |
| `formats` | Output report formats | `array` | `html,json` | `html`, `json` |
| `proxy` | Network proxy settings | `object` | | |
| ∟ `server` | Proxy to be used for all requests | `string` | |
| ∟ `bypass` | Comma-separated domains to bypass proxy | `string` | |
| ∟ `username` | Username to use if HTTP proxy requires authentication | `string` | |
| ∟ `password` | Password to use if HTTP proxy requires authentication | `string` | |
| `dryRun` | Simulate the audit without actually running the browser | `boolean` | `false` | |
| `verbose` | Enable verbose output | `boolean` | `false` | |
| Name | Description | Type | Default | Values |
| ------------ | ---------------------------------------------------------------- | --------- | ------------- | --------------------------------------------------- |
| `browser` | Browser to run the audit with | `string` | `chromium` | `msedge`, `chrome`, `chromium`, `firefox`, `webkit` |
| `headless` | Run browser in headless mode | `boolean` | `true` | |
| `device` | Simulate browser behavior for a specific device | `string` | | |
| `headers` | Additional HTTP headers to be sent with every request | `object` | | |
| `proxy` | Network proxy settings | `object` | | |
| ∟ `server` | Proxy to be used for all requests | `string` | | |
| ∟ `bypass` | Comma-separated domains to bypass proxy | `string` | | |
| ∟ `username` | Username to use if HTTP proxy requires authentication | `string` | | |
| ∟ `password` | Password to use if HTTP proxy requires authentication | `string` | | |
| `timeout` | Maximum time to wait for navigations or actions, in milliseconds | `integer` | | |
| `retries` | Number of retries in case of failure | `integer` | `0` | |
| `output` | Directory to write reports to | `string` | `.` | |
| `formats` | Output report formats | `array` | `html,json` | `html`, `json`, `influxdb` |
| `influxdb` | InfluxDB connection configuration | `object` | | |
| ∟ `url` | Base URL | `string` | | |
| ∟ `token` | Authentication token | `string` | | |
| ∟ `org` | Destination organisation for writes | `string` | | |
| ∟ `bucket` | Destination bucket for writes | `string` | | |
| ∟ `prefix` | Measurement name prefix | `string` | `ecojourney_` | |
| `dryRun` | Simulate the audit without actually running the browser | `boolean` | `false` | |
| `verbose` | Enable verbose output | `boolean` | `false` | |
#### Actions
Expand Down Expand Up @@ -688,10 +700,36 @@ Audit results can be exported using various report formats that can be specified
using the `formats` CLI flag, environment variable or manifest configuration
key.
| Format | Description |
| ------ | ---------------------------------------------------------------------------------------------------------- |
| `html` | Export analysis results to an HTML report file<br>→ Recommended for simple analysis result visualisation |
| `json` | Export analysis results to a JSON report file<br>→ Recommended for further data analysis and visualisation |
#### HTML
Export analysis results to an HTML report file.
➡️ Recommended for simple analysis result visualisation
#### JSON
Export analysis results to a JSON report file.
➡️ Recommended for further data analysis and visualisation
#### InfluxDB
Write analysis results to an InfluxDB time-series database via 2 measurements:
- `{prefix}issues`: number of issues by severity for each audit, scenario and
page, with analysis duration
- `{prefix}measure`: main metrics for each audit, scenario and page
Published data is more or less the same as the data visible on the HTML report
without opening collapsible elements, thus, some data (issues list, secondary
measures, rules and metrics list, etc.) are not written because they doesn't fit
well in a TSDB or are not relevant enough to be worth tracking on a dashboard.
➡️ Recommended to keep track of analysis results over time on a Grafana
dashboard
✔️ Don't forget to set a retention time for the target bucket to enable
automatic deletion of old data.
### Continuous Integration
Expand Down
80 changes: 40 additions & 40 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@
"@types/ejs": "^3.1.2",
"@types/express": "^4.17.17",
"@types/mocha": "^10.0.1",
"@types/node": "^18.16.9",
"@types/node": "^18.16.13",
"@types/prompts": "^2.4.4",
"@types/sinon": "^10.0.15",
"c8": "^7.13.0",
"express": "^4.18.2",
"jsonpath-plus": "^7.2.0",
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.2.0",
"rome": "^12.1.0",
"sinon": "^15.0.4",
"rome": "^12.1.2",
"sinon": "^15.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ <h2 id="{%= s.id %}" class="title is-4">
<div class="tags">
<span class="tag">
<span class="tag-label">Time</span>
{%= new Date(s.time).toLocaleString() %}
{%= new Date(s.startTime).toLocaleString() %}
</span>
</div>
<!-- Scenario > Measures -->
Expand Down Expand Up @@ -340,7 +340,7 @@ <h3 id="{%= p.id %}" class="title is-5">
</span>
<span class="tag">
<span class="tag-label">Time</span>
{%= new Date(p.time).toLocaleString() %}
{%= new Date(p.startTime).toLocaleString() %}
</span>
</div>
<!-- Page > Measures -->
Expand Down
4 changes: 2 additions & 2 deletions scripts/templates/manifest.md.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ config:
| Name | Description | Type | Default | Values |
| ---- | ----------- | ---- | ------- | ------ |
<% for (const [k, v] of Object.entries(config.properties)) { -%>
| `<%- k %>` | <%- v.description %> | `<%- v.type %>` | <% if (k in defaultConfig) { %>`<%- defaultConfig[k] %>` <% } %> | <%- (v.items?.enum ?? v.enum ?? []).map(e => `\`${e}\``).join(", ") %> |
| `<%- k %>` | <%- v.description %> | `<%- v.type %>` | <% if (k in defaultConfig && v.type !== "object") { %>`<%- defaultConfig[k] %>` <% } %> | <%- (v.items?.enum ?? v.enum ?? []).map(e => `\`${e}\``).join(", ") %> |
<% if (v.type === "object" && v.properties) { -%>
<% for (const [sk, sv] of Object.entries(v.properties)) { -%>
|`<%- sk %>` | <%- sv.description %> | `<%- sv.type %>` | <%- (sv.items?.enum ?? sv.enum ?? []).map(e => `\`${e}\``).join(", ") %> |
|`<%- sk %>` | <%- sv.description %> | `<%- sv.type %>` | <% if (k in defaultConfig && sk in defaultConfig[k]) { %>`<%- defaultConfig[k][sk] %>` <% } %> | <%- (sv.items?.enum ?? sv.enum ?? []).map(e => `\`${e}\``).join(", ") %> |
<% } -%>
<% } -%>
<% } -%>
Expand Down
Loading

0 comments on commit 3b3cb1e

Please sign in to comment.