@@ -50,6 +50,7 @@ test.describe("Widget Functionality", () => {
5050
5151 // Verify widgets render correctly
5252 await waitForWidget ( page , applyDownWidgetCellIndex , 'input[type="checkbox"]' , 30000 ) ;
53+
5354 await waitForWidget ( page , applyDownWidgetCellIndex , 'button:has-text("Cluster Down")' , 10000 ) ;
5455 await waitForWidget ( page , applyDownWidgetCellIndex , 'button:has-text("Cluster Apply")' , 10000 ) ;
5556
@@ -71,7 +72,7 @@ test.describe("Widget Functionality", () => {
7172 } ) ;
7273
7374 // Test Cluster Apply button WITHOUT the wait_ready checkbox checked
74- // This avoids the 300s TLS timeout + dashboard_check issues in KinD
75+ // This avoids the long TLS timeout + dashboard_check issues in KinD
7576 await interactWithWidget ( page , applyDownWidgetCellIndex , 'button:has-text("Cluster Apply")' , async ( button ) => {
7677 await button . click ( ) ;
7778
@@ -81,6 +82,10 @@ test.describe("Widget Functionality", () => {
8182 expect ( successMessage ) . not . toBeNull ( ) ;
8283 } ) ;
8384
85+ // Wait for apply() to complete (widget uses 60s TLS timeout)
86+ // We wait for either success or failure message from the TLS setup phase
87+ await page . waitForSelector ( 'text=/Cluster .widgettest. (is ready|resources applied but TLS setup incomplete)/' , { timeout : 90000 } ) ;
88+
8489 // Test view_clusters widget
8590 const viewClustersCellIndex = 4 ; // 5 on OpenShift
8691 await page . notebook . runCell ( cellCount - 2 , true ) ;
@@ -104,8 +109,8 @@ test.describe("Widget Functionality", () => {
104109 // Test Delete Cluster button to clean up
105110 await interactWithWidget ( page , viewClustersCellIndex , 'button:has-text("Delete Cluster")' , async ( button ) => {
106111 await button . click ( ) ;
107- // Wait for deletion confirmation
108- const successMessage = await page . waitForSelector ( `text=Cluster widgettest in the ${ namespace } namespace was deleted successfully.` , { timeout : 10000 } ) ;
112+ // Wait for deletion confirmation - increase timeout as cluster deletion can take time
113+ const successMessage = await page . waitForSelector ( `text=Cluster widgettest in the ${ namespace } namespace was deleted successfully.` , { timeout : 30000 } ) ;
109114 expect ( successMessage ) . not . toBeNull ( ) ;
110115 } ) ;
111116 } ) ;
@@ -114,18 +119,21 @@ test.describe("Widget Functionality", () => {
114119async function waitForWidget ( page , cellIndex : number , widgetSelector : string , timeout = 5000 ) {
115120 const widgetCell = await page . notebook . getCellOutput ( cellIndex ) ;
116121
117- if ( widgetCell ) {
118- await widgetCell . waitForSelector ( widgetSelector , { timeout } ) ;
122+ if ( ! widgetCell ) {
123+ throw new Error ( `Cell ${ cellIndex } has no output - widgets not rendered. Check if is_notebook() detection is working.` ) ;
119124 }
125+ await widgetCell . waitForSelector ( widgetSelector , { timeout } ) ;
120126}
121127
122128async function interactWithWidget ( page , cellIndex : number , widgetSelector : string , action : ( widget ) => Promise < void > ) {
123129 const widgetCell = await page . notebook . getCellOutput ( cellIndex ) ;
124130
125- if ( widgetCell ) {
126- const widget = await widgetCell . $ ( widgetSelector ) ;
127- if ( widget ) {
128- await action ( widget ) ;
129- }
131+ if ( ! widgetCell ) {
132+ throw new Error ( `Cell ${ cellIndex } has no output - cannot interact with widget.` ) ;
133+ }
134+ const widget = await widgetCell . $ ( widgetSelector ) ;
135+ if ( ! widget ) {
136+ throw new Error ( `Widget '${ widgetSelector } ' not found in cell ${ cellIndex } .` ) ;
130137 }
138+ await action ( widget ) ;
131139}
0 commit comments