@@ -36,6 +36,8 @@ test.describe("Visual Regression", () => {
3636
3737 // Hide the cell toolbar before capturing the screenshots
3838 await page . addStyleTag ( { content : '.jp-cell-toolbar { display: none !important; }' } ) ;
39+ // Hide the file explorer
40+ await page . keyboard . press ( 'Control+Shift+F' ) ;
3941
4042 const captures : ( Buffer | null ) [ ] = [ ] ; // Array to store cell screenshots
4143 const cellCount = await page . notebook . getCellCount ( ) ;
@@ -109,30 +111,48 @@ test.describe("Visual Regression", () => {
109111
110112 await runPreviousCell ( page , cellCount , '(<CodeFlareClusterStatus.UNKNOWN: 6>, False)' ) ;
111113
112- // view_clusters table with buttons
113- await interactWithWidget ( page , upDownWidgetCellIndex , 'input[type="checkbox"]' , async ( checkbox ) => {
114- await checkbox . click ( ) ;
115- const isChecked = await checkbox . isChecked ( ) ;
116- expect ( isChecked ) . toBe ( false ) ;
117- } ) ;
114+ // Replace text in ClusterConfiguration to run a new RayCluster
115+ const cell = page . getByText ( 'raytest' ) . first ( ) ;
116+ await cell . fill ( '"raytest-1"' ) ;
117+ await page . notebook . runCell ( cellCount - 3 , true ) ; // Run ClusterConfiguration cell
118118
119119 await interactWithWidget ( page , upDownWidgetCellIndex , 'button:has-text("Cluster Up")' , async ( button ) => {
120120 await button . click ( ) ;
121- const successMessage = await page . waitForSelector ( 'text=Ray Cluster: \'raytest\' has successfully been created' , { timeout : 10000 } ) ;
121+ const successMessage = await page . waitForSelector ( 'text=Ray Cluster: \'raytest-1 \' has successfully been created' , { timeout : 10000 } ) ;
122122 expect ( successMessage ) . not . toBeNull ( ) ;
123123 } ) ;
124124
125125 const viewClustersCellIndex = 4 ; // 5 on OpenShift
126126 await page . notebook . runCell ( cellCount - 2 , true ) ;
127+
128+ // Wait until the RayCluster status in the table updates to "Ready"
129+ await interactWithWidget ( page , viewClustersCellIndex , 'button:has-text("Refresh Data")' , async ( button ) => {
130+ let clusterReady = false ;
131+ const maxRefreshRetries = 24 ; // 24 retries * 5 seconds = 120 seconds
132+ let numRefreshRetries = 0 ;
133+ while ( ! clusterReady && numRefreshRetries < maxRefreshRetries ) {
134+ await button . click ( ) ;
135+ try {
136+ await page . waitForSelector ( 'text=Ready ✓' , { timeout : 5000 } ) ;
137+ clusterReady = true ;
138+ }
139+ catch ( e ) {
140+ console . log ( `Cluster not ready yet. Retrying...` ) ;
141+ numRefreshRetries ++ ;
142+ }
143+ }
144+ expect ( clusterReady ) . toBe ( true ) ;
145+ } ) ;
146+
127147 await interactWithWidget ( page , viewClustersCellIndex , 'button:has-text("Open Ray Dashboard")' , async ( button ) => {
128148 await button . click ( ) ;
129- const successMessage = await page . waitForSelector ( 'text=Opening Ray Dashboard for raytest cluster' , { timeout : 5000 } ) ;
149+ const successMessage = await page . waitForSelector ( 'text=Opening Ray Dashboard for raytest-1 cluster' , { timeout : 5000 } ) ;
130150 expect ( successMessage ) . not . toBeNull ( ) ;
131151 } ) ;
132152
133153 await interactWithWidget ( page , viewClustersCellIndex , 'button:has-text("View Jobs")' , async ( button ) => {
134154 await button . click ( ) ;
135- const successMessage = await page . waitForSelector ( 'text=Opening Ray Jobs Dashboard for raytest cluster' , { timeout : 5000 } ) ;
155+ const successMessage = await page . waitForSelector ( 'text=Opening Ray Jobs Dashboard for raytest-1 cluster' , { timeout : 5000 } ) ;
136156 expect ( successMessage ) . not . toBeNull ( ) ;
137157 } ) ;
138158
@@ -141,7 +161,7 @@ test.describe("Visual Regression", () => {
141161
142162 const noClustersMessage = await page . waitForSelector ( `text=No clusters found in the ${ namespace } namespace.` , { timeout : 5000 } ) ;
143163 expect ( noClustersMessage ) . not . toBeNull ( ) ;
144- const successMessage = await page . waitForSelector ( `text=Cluster raytest in the ${ namespace } namespace was deleted successfully.` , { timeout : 5000 } ) ;
164+ const successMessage = await page . waitForSelector ( `text=Cluster raytest-1 in the ${ namespace } namespace was deleted successfully.` , { timeout : 5000 } ) ;
145165 expect ( successMessage ) . not . toBeNull ( ) ;
146166 } ) ;
147167
0 commit comments