11const { expect } = require ( '@playwright/test' ) ;
22const { log, args, createPage, closePage, takeScreenshot, waitForServerReady, dismissDevmode, execCommand, compileAndReload } = require ( './test-utils' ) ;
3- // When using playwright in lib mode we cannot use expect, thus we use regular asserts
4- const assert = require ( 'assert' ) ;
53
6- const { spawn } = require ( 'child_process' ) ;
74const fs = require ( 'fs' ) ;
8- const Net = require ( 'net' ) ;
9- const isWin = / ^ w i n / . test ( process . platform ) ;
105
116( async ( ) => {
127 const arg = args ( ) ;
@@ -25,7 +20,7 @@ const isWin = /^win/.test(process.platform);
2520 if ( arg . mode == 'prod' ) {
2621 log ( "Skipping creating views for production mode" ) ;
2722 const text = page . getByText ( 'Could not navigate' ) ;
28- assert . ok ( await text . isVisible ( ) ) ;
23+ await expect ( text ) . toBeVisible ( ) ;
2924 } else {
3025 const linkText = / r e a c t / . test ( arg . name ) ?
3126 'Create a view for coding the UI in TypeScript with Hilla and React' :
@@ -38,7 +33,7 @@ const isWin = /^win/.test(process.platform);
3833 await takeScreenshot ( page , __filename , 'view-created' ) ;
3934 await waitForServerReady ( page , arg . url , { maxRetries : 30 , retryInterval : 2000 } ) ;
4035 const view = ( await execCommand ( `find src/main/frontend src/main/java -name '${ viewName } '` ) ) . stdout . trim ( ) ;
41- assert . ok ( fs . existsSync ( view ) ) ;
36+ expect ( fs . existsSync ( view ) ) . toBeTruthy ( ) ;
4237
4338 // Compile the application so as spring-devtools watches the changes
4439 await compileAndReload ( page , arg . url , { waitTime : 10000 } ) ;
@@ -66,7 +61,7 @@ const isWin = /^win/.test(process.platform);
6661 await takeScreenshot ( page , __filename , 'view-reloaded-after-compiling' ) ;
6762
6863 const text = page . getByText ( 'Welcome' ) ;
69- assert . ok ( await text . isVisible ( ) ) ;
64+ await expect ( text ) . toBeVisible ( ) ;
7065
7166 log ( `Removing the view ${ view } ` ) ;
7267 fs . unlinkSync ( view ) ;
0 commit comments