Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Jan 16, 2024
1 parent 8207439 commit e5f5060
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,24 @@ Separated metadata file (Already included in the above HTML and compressed, it c
```

## View Trace Online
> The [Trace Viewer](https://trace.playwright.dev/) requires that the trace file must be loaded over the http:// or https:// protocols without [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS) issue, try following start a local web server:
> The [Trace Viewer](https://trace.playwright.dev/) requires that the trace file must be loaded over the http:// or https:// protocols without [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS) issue.
- Start a local web server with following CLI:
```sh
# serve and open report
npx monocart show-report <path-to-report>

# serve report
npx monocart serve-report <path-to-report>
```
It works with `http://localhost:port/` or `http://127.0.0.1:port/`, but to successfully load from other `IP` or `domain`, you must start web server with `https`:
The server add the http header `Access-Control-Allow-Origin: *` to [allow requesting from any origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin), it works with `http://localhost:port/` or `http://127.0.0.1:port/`
- To successfully work with other `IP` or `domain`, you can start web server with `https`:
```sh
npx monocart show-report <path-to-report> --ssl <path-to-key,path-to-cert>
# For example: npx monocart show-report test-results/index.html --ssl ssl/key.pem,ssl/cert.pem
# You can create and install local CA with 'mkcert', see: https://mkcert.dev
```
Or customize your own trace viewer url with option `traceViewerUrl`
For example: `npx monocart show-report test-results/index.html --ssl ssl/key.pem,ssl/cert.pem`

You can create and install local CA with [mkcert](https://mkcert.dev)
- Using your own trace viewer url with option `traceViewerUrl`:
```js
// reporter options
{
Expand Down

0 comments on commit e5f5060

Please sign in to comment.