File tree Expand file tree Collapse file tree 3 files changed +45
-7
lines changed
packages/playwright-core/src Expand file tree Collapse file tree 3 files changed +45
-7
lines changed Original file line number Diff line number Diff line change @@ -248,13 +248,25 @@ if (!process.env.PW_CLI_TARGET_LANG) {
248
248
require ( playwrightTestPackagePath ) . addTestCommand ( program ) ;
249
249
require ( playwrightTestPackagePath ) . addShowReportCommand ( program ) ;
250
250
} else {
251
- const command = program . command ( 'test' ) . allowUnknownOption ( true ) ;
252
- command . description ( 'Run tests with Playwright Test. Available in @playwright/test package.' ) ;
253
- command . action ( async ( ) => {
254
- console . error ( 'Please install @playwright/test package to use Playwright Test.' ) ;
255
- console . error ( ' npm install -D @playwright/test' ) ;
256
- process . exit ( 1 ) ;
257
- } ) ;
251
+ {
252
+ const command = program . command ( 'test' ) . allowUnknownOption ( true ) ;
253
+ command . description ( 'Run tests with Playwright Test. Available in @playwright/test package.' ) ;
254
+ command . action ( async ( ) => {
255
+ console . error ( 'Please install @playwright/test package to use Playwright Test.' ) ;
256
+ console . error ( ' npm install -D @playwright/test' ) ;
257
+ process . exit ( 1 ) ;
258
+ } ) ;
259
+ }
260
+
261
+ {
262
+ const command = program . command ( 'show-report' ) . allowUnknownOption ( true ) ;
263
+ command . description ( 'Show Playwright Test HTML report. Available in @playwright/test package.' ) ;
264
+ command . action ( async ( ) => {
265
+ console . error ( 'Please install @playwright/test package to use Playwright Test.' ) ;
266
+ console . error ( ' npm install -D @playwright/test' ) ;
267
+ process . exit ( 1 ) ;
268
+ } ) ;
269
+ }
258
270
}
259
271
}
260
272
Original file line number Diff line number Diff line change @@ -466,6 +466,24 @@ a.no-decorations {
466
466
}
467
467
}
468
468
469
+ .needs-server-message {
470
+ max-width : 500px ;
471
+ margin : auto;
472
+ height : 100% ;
473
+ display : flex;
474
+ flex-direction : column;
475
+ justify-content : center;
476
+ }
477
+
478
+ .bash-snippet {
479
+ margin-top : 10px ;
480
+ font-family : monospace;
481
+ background : var (--color-fg-default );
482
+ color : var (--color-canvas-default );
483
+ border-radius : 6px ;
484
+ padding : 20px ;
485
+ }
486
+
469
487
@media only screen and (max-width : 600px ) {
470
488
.chip-header {
471
489
border-radius : 0 !important ;
Original file line number Diff line number Diff line change @@ -42,6 +42,14 @@ export const Report: React.FC = () => {
42
42
} ) ( ) ;
43
43
} , [ report , expandedFiles ] ) ;
44
44
45
+ if ( window . location . protocol === 'file:' ) {
46
+ return < div className = 'needs-server-message' >
47
+ Playwright report needs to be served as a web page. Consider the following options to view it locally:
48
+ < div className = 'bash-snippet' > npx node-static playwright-report</ div >
49
+ < div className = 'bash-snippet' > cd playwright-report && python -m SimpleHTTPServer</ div >
50
+ </ div > ;
51
+ }
52
+
45
53
return < div className = 'vbox columns' >
46
54
{ ! fetchError && < div className = 'flow-container' >
47
55
< Route params = '' >
You can’t perform that action at this time.
0 commit comments