From e5f50603191913ebc4804c43162a201c0ceee3e3 Mon Sep 17 00:00:00 2001 From: cenfun Date: Tue, 16 Jan 2024 13:22:26 +0800 Subject: [PATCH] update README --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 47e40236..fcd58c17 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,8 @@ 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 @@ -179,13 +180,15 @@ npx monocart show-report # serve report npx monocart serve-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 --ssl -# 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 {