File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
11
11
import { existsSync , readFileSync , writeFileSync } from 'fs' ;
12
12
import { join } from 'path' ;
13
13
14
- const SERVE_PORT = 3535 ;
14
+ let SERVE_PORT = 3535 ;
15
15
beforeAll ( ( ) => {
16
16
const config = scaffoldQwikProject ( ) ;
17
17
global . tmpDir = config . tmpDir ;
43
43
}
44
44
) ;
45
45
46
+ test ( 'Should preview the app' , { timeout : DEFAULT_TIMEOUT } , async ( ) => {
47
+ // the port doesn't clear immediately after the previous test
48
+ SERVE_PORT ++ ;
49
+ const host = `http://localhost:${ SERVE_PORT } /` ;
50
+ await assertHostUnused ( host ) ;
51
+ const p = await runCommandUntil (
52
+ `npm run preview -- --port ${ SERVE_PORT } ` ,
53
+ global . tmpDir ,
54
+ ( output ) => {
55
+ return output . includes ( host ) ;
56
+ }
57
+ ) ;
58
+ assert . equal ( existsSync ( global . tmpDir ) , true ) ;
59
+
60
+ await expectHtmlOnARootPage ( host ) ;
61
+
62
+ await promisifiedTreeKill ( p . pid ! , 'SIGKILL' ) ;
63
+ } ) ;
64
+
46
65
async function expectHtmlOnARootPage ( host : string ) {
47
66
expect ( ( await getPageHtml ( host ) ) . querySelector ( '.container h1' ) ?. textContent ) . toBe (
48
67
`So fantasticto have you here`
You can’t perform that action at this time.
0 commit comments