@@ -47,7 +47,9 @@ test.describe("UTM Installation Flow", () => {
4747
4848 test ( "step 1: shows UTM status check heading" , async ( { page } ) => {
4949 const checkView = page . locator ( "utm-check-view" ) ;
50- await expect ( checkView . locator ( "h2" ) ) . toContainText ( "Virtual machine setup" ) ;
50+ await expect ( checkView . locator ( "h2" ) ) . toContainText (
51+ "Virtual machine setup"
52+ ) ;
5153 } ) ;
5254
5355 test ( "step 1: shows warning about testing/evaluation" , async ( { page } ) => {
@@ -136,13 +138,8 @@ test.describe("UTM Installation Flow", () => {
136138 . locator ( "wizard-shell" )
137139 . locator ( ".footer-right wa-button" ) ;
138140
139- // In mock mode, UTM should be detected as installed
140- // Button state depends on whether UTM is installed
141- const isEnabled = await nextButton . isEnabled ( ) ;
142- const isDisabled = await nextButton . isDisabled ( ) ;
143-
144- // Should be either enabled or disabled (one must be true)
145- expect ( isEnabled || isDisabled ) . toBe ( true ) ;
141+ // UTM is installed in mock mode, so the Next button is enabled.
142+ await expect ( nextButton ) . toHaveJSProperty ( "disabled" , false ) ;
146143 } ) ;
147144
148145 test ( "step 1: can navigate to step 2 when UTM is installed" , async ( {
@@ -156,8 +153,7 @@ test.describe("UTM Installation Flow", () => {
156153 . locator ( ".footer-right wa-button" ) ;
157154
158155 // If button is enabled, we can proceed
159- const isEnabled = await nextButton . isEnabled ( ) ;
160- if ( isEnabled ) {
156+ if ( ! ( await buttonDisabled ( nextButton ) ) ) {
161157 await nextButton . click ( ) ;
162158 await expect ( page . locator ( "utm-configure-view" ) ) . toBeVisible ( ) ;
163159 } else {
@@ -264,7 +260,9 @@ test.describe("UTM Installation Flow", () => {
264260 test ( "step 2: can navigate back to step 1" , async ( { page } ) => {
265261 await navigateToUtmStep2 ( page ) ;
266262
267- const backButton = page . locator ( "wizard-shell" ) . locator ( ".header wa-button" ) ;
263+ const backButton = page
264+ . locator ( "wizard-shell" )
265+ . locator ( ".header wa-button" ) ;
268266 await expect ( backButton ) . toHaveJSProperty ( "disabled" , false ) ;
269267 await backButton . click ( ) ;
270268
@@ -317,7 +315,9 @@ test.describe("UTM Installation Flow", () => {
317315 test ( "step 3: can navigate back to step 2" , async ( { page } ) => {
318316 await navigateToUtmStep3 ( page ) ;
319317
320- const backButton = page . locator ( "wizard-shell" ) . locator ( ".header wa-button" ) ;
318+ const backButton = page
319+ . locator ( "wizard-shell" )
320+ . locator ( ".header wa-button" ) ;
321321 await expect ( backButton ) . toHaveJSProperty ( "disabled" , false ) ;
322322 await backButton . click ( ) ;
323323
@@ -365,7 +365,9 @@ test.describe("UTM Installation Flow", () => {
365365 await expect ( wizardShell . locator ( ".footer" ) ) . not . toBeVisible ( ) ;
366366 } ) ;
367367
368- test ( "step 4: back button is hidden during installation" , async ( { page } ) => {
368+ test ( "step 4: back button is hidden during installation" , async ( {
369+ page,
370+ } ) => {
369371 await navigateToUtmStep4 ( page ) ;
370372
371373 const wizardShell = page . locator ( "wizard-shell" ) ;
@@ -479,20 +481,25 @@ test.describe("UTM Installation Flow", () => {
479481 . locator ( "wizard-shell" )
480482 . locator ( ".footer-right wa-button" ) ;
481483
482- const isEnabled = await nextButton . isEnabled ( ) ;
483- if ( ! isEnabled ) {
484+ if ( await buttonDisabled ( nextButton ) ) {
484485 test . skip ( true , "UTM not detected as installed in mock mode" ) ;
485486 }
486487
487488 await nextButton . click ( ) ;
488489
489490 // Step 2: Configure
490491 await expect ( page . locator ( "utm-configure-view" ) ) . toBeVisible ( ) ;
491- await page . locator ( "wizard-shell" ) . locator ( ".footer-right wa-button" ) . click ( ) ;
492+ await page
493+ . locator ( "wizard-shell" )
494+ . locator ( ".footer-right wa-button" )
495+ . click ( ) ;
492496
493497 // Step 3: Confirm - click Install (no confirmation dialog for VM flow)
494498 await expect ( page . locator ( "utm-confirm-view" ) ) . toBeVisible ( ) ;
495- await page . locator ( "wizard-shell" ) . locator ( ".footer-right wa-button" ) . click ( ) ;
499+ await page
500+ . locator ( "wizard-shell" )
501+ . locator ( ".footer-right wa-button" )
502+ . click ( ) ;
496503
497504 // Step 4: Progress (proceeds directly, no dialog)
498505 await expect ( page . locator ( "utm-progress-view" ) ) . toBeVisible ( ) ;
@@ -503,11 +510,23 @@ test.describe("UTM Installation Flow", () => {
503510 } ) ;
504511
505512 // Return to welcome
506- await page . locator ( "wizard-shell" ) . locator ( ".footer-right wa-button" ) . click ( ) ;
513+ await page
514+ . locator ( "wizard-shell" )
515+ . locator ( ".footer-right wa-button" )
516+ . click ( ) ;
507517 await expect ( page . locator ( "welcome-view" ) ) . toBeVisible ( ) ;
508518 } ) ;
509519} ) ;
510520
521+ // Playwright's isEnabled()/isDisabled() only understand native/ARIA disabled
522+ // state, not a custom element's `disabled` property. Read wa-button's property
523+ // directly instead.
524+ function buttonDisabled ( locator : any ) : Promise < boolean > {
525+ return locator . evaluate (
526+ ( el : HTMLElement & { disabled : boolean } ) => el . disabled
527+ ) ;
528+ }
529+
511530// Helper functions to navigate to specific steps
512531async function navigateToUtmStep2 ( page : any ) {
513532 // Wait for UTM check to complete
@@ -518,8 +537,7 @@ async function navigateToUtmStep2(page: any) {
518537 . locator ( ".footer-right wa-button" ) ;
519538
520539 // Check if we can proceed (UTM must be installed)
521- const isEnabled = await nextButton . isEnabled ( ) ;
522- if ( ! isEnabled ) {
540+ if ( await buttonDisabled ( nextButton ) ) {
523541 throw new Error ( "Cannot navigate to step 2: UTM not installed" ) ;
524542 }
525543
0 commit comments