@@ -1968,6 +1968,26 @@ define(function (require, exports, module) {
19681968 await waitForClickedElement ( false ) ;
19691969 }
19701970
1971+ async function switchToPreviewMode ( ) {
1972+ if ( LiveDevMultiBrowser && LiveDevMultiBrowser . config ) {
1973+ LiveDevMultiBrowser . config . isProUser = false ;
1974+ if ( LiveDevMultiBrowser . updateConfig ) {
1975+ LiveDevMultiBrowser . updateConfig ( JSON . stringify ( LiveDevMultiBrowser . config ) ) ;
1976+ }
1977+ }
1978+ await awaits ( 500 ) ;
1979+ }
1980+
1981+ async function switchToEditMode ( ) {
1982+ if ( LiveDevMultiBrowser && LiveDevMultiBrowser . config ) {
1983+ LiveDevMultiBrowser . config . isProUser = true ;
1984+ if ( LiveDevMultiBrowser . updateConfig ) {
1985+ LiveDevMultiBrowser . updateConfig ( JSON . stringify ( LiveDevMultiBrowser . config ) ) ;
1986+ }
1987+ }
1988+ await awaits ( 500 ) ;
1989+ }
1990+
19711991 it ( "should show info box on hover when elemHighlights is 'hover'" , async function ( ) {
19721992 await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple1.html" ] ) ,
19731993 "SpecRunnerUtils.openProjectFiles simple1.html" ) ;
@@ -2700,6 +2720,86 @@ define(function (require, exports, module) {
27002720
27012721 await endEditModePreviewSession ( ) ;
27022722 } , 30000 ) ;
2723+
2724+ it ( "should hide UI boxes when switching to preview mode and show them when switching back to edit mode" , async function ( ) {
2725+ await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple1.html" ] ) ,
2726+ "SpecRunnerUtils.openProjectFiles simple1.html" ) ;
2727+
2728+ await waitsForLiveDevelopmentToOpenWithEditMode ( 'hover' ) ;
2729+
2730+ // Step 1: Click element to show UI boxes in edit mode
2731+ await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2732+
2733+ // Step 2: Verify boxes are visible
2734+ await waitForMoreOptionsBox ( true ) ;
2735+ await waitForClickedElement ( true ) ;
2736+
2737+ // Step 3: Switch to preview mode
2738+ await switchToPreviewMode ( ) ;
2739+
2740+ // Step 4: Verify boxes are hidden after mode switch
2741+ await waitForMoreOptionsBox ( false ) ;
2742+ await waitForClickedElement ( false ) ;
2743+
2744+ // Step 5: Verify clicking element in preview mode doesn't show boxes
2745+ await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2746+ await awaits ( 300 ) ; // Brief wait to ensure no boxes appear
2747+ await waitForMoreOptionsBox ( false ) ;
2748+ await waitForClickedElement ( false ) ;
2749+
2750+ // Step 6: Switch back to edit mode
2751+ await switchToEditMode ( ) ;
2752+
2753+ // Step 7: Click element again to show boxes in edit mode
2754+ await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2755+
2756+ // Step 8: Verify boxes are visible again
2757+ await waitForMoreOptionsBox ( true ) ;
2758+ await waitForClickedElement ( true ) ;
2759+
2760+ await endEditModePreviewSession ( ) ;
2761+ } , 30000 ) ;
2762+
2763+ it ( "should switch to preview mode when preview (play icon) button is clicked" , async function ( ) {
2764+ await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple1.html" ] ) ,
2765+ "SpecRunnerUtils.openProjectFiles simple1.html" ) ;
2766+
2767+ await waitsForLiveDevelopmentToOpenWithEditMode ( 'hover' ) ;
2768+
2769+ // Step 1: Click element to show UI boxes in edit mode
2770+ await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2771+
2772+ // Step 2: Verify boxes are visible in edit mode
2773+ await waitForMoreOptionsBox ( true ) ;
2774+ await waitForClickedElement ( true ) ;
2775+
2776+ // Step 3: Click the preview (play icon) button in the toolbar
2777+ testWindow . $ ( "#previewModeLivePreviewButton" ) . click ( ) ;
2778+ await awaits ( 1000 ) ; // Wait for mode switch and preference update
2779+
2780+ // Step 4: Verify boxes are hidden after clicking preview button
2781+ await waitForMoreOptionsBox ( false ) ;
2782+ await waitForClickedElement ( false ) ;
2783+
2784+ // Step 5: Verify clicking element in preview mode doesn't show boxes
2785+ await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2786+ await awaits ( 300 ) ;
2787+ await waitForMoreOptionsBox ( false ) ;
2788+ await waitForClickedElement ( false ) ;
2789+
2790+ // Step 6: Click preview button again to toggle back to edit mode
2791+ testWindow . $ ( "#previewModeLivePreviewButton" ) . click ( ) ;
2792+ await awaits ( 1000 ) ; // Wait for mode switch and preference update
2793+
2794+ // Step 7: Click element to verify boxes work again in edit mode
2795+ await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2796+
2797+ // Step 8: Verify boxes are visible again
2798+ await waitForMoreOptionsBox ( true ) ;
2799+ await waitForClickedElement ( true ) ;
2800+
2801+ await endEditModePreviewSession ( ) ;
2802+ } , 30000 ) ;
27032803 } ) ;
27042804 } ) ;
27052805} ) ;
0 commit comments