@@ -36,6 +36,8 @@ test.describe("Visual Regression", () => {
36
36
37
37
// Hide the cell toolbar before capturing the screenshots
38
38
await page . addStyleTag ( { content : '.jp-cell-toolbar { display: none !important; }' } ) ;
39
+ // Hide the file explorer
40
+ await page . keyboard . press ( 'Control+Shift+F' ) ;
39
41
40
42
const captures : ( Buffer | null ) [ ] = [ ] ; // Array to store cell screenshots
41
43
const cellCount = await page . notebook . getCellCount ( ) ;
@@ -109,30 +111,48 @@ test.describe("Visual Regression", () => {
109
111
110
112
await runPreviousCell ( page , cellCount , '(<CodeFlareClusterStatus.UNKNOWN: 6>, False)' ) ;
111
113
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
118
118
119
119
await interactWithWidget ( page , upDownWidgetCellIndex , 'button:has-text("Cluster Up")' , async ( button ) => {
120
120
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 } ) ;
122
122
expect ( successMessage ) . not . toBeNull ( ) ;
123
123
} ) ;
124
124
125
125
const viewClustersCellIndex = 4 ; // 5 on OpenShift
126
126
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
+
127
147
await interactWithWidget ( page , viewClustersCellIndex , 'button:has-text("Open Ray Dashboard")' , async ( button ) => {
128
148
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 } ) ;
130
150
expect ( successMessage ) . not . toBeNull ( ) ;
131
151
} ) ;
132
152
133
153
await interactWithWidget ( page , viewClustersCellIndex , 'button:has-text("View Jobs")' , async ( button ) => {
134
154
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 } ) ;
136
156
expect ( successMessage ) . not . toBeNull ( ) ;
137
157
} ) ;
138
158
@@ -141,7 +161,7 @@ test.describe("Visual Regression", () => {
141
161
142
162
const noClustersMessage = await page . waitForSelector ( `text=No clusters found in the ${ namespace } namespace.` , { timeout : 5000 } ) ;
143
163
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 } ) ;
145
165
expect ( successMessage ) . not . toBeNull ( ) ;
146
166
} ) ;
147
167
0 commit comments