@@ -58,10 +58,6 @@ export class DagCalendarTab extends BasePage {
5858 return colors ;
5959 }
6060
61- public async getActiveCellCount ( ) : Promise < number > {
62- return this . activeCells . count ( ) ;
63- }
64-
6561 public async getManualRunStates ( ) : Promise < Array < string > > {
6662 const count = await this . activeCells . count ( ) ;
6763 const states : Array < string > = [ ] ;
@@ -88,7 +84,7 @@ export class DagCalendarTab extends BasePage {
8884 public async navigateToCalendar ( dagId : string ) {
8985 await expect ( async ( ) => {
9086 await this . safeGoto ( `/dags/${ dagId } /calendar` ) ;
91- await this . page . getByTestId ( "dag-calendar-root" ) . waitFor ( { state : "visible" , timeout : 5000 } ) ;
87+ await expect ( this . page . getByTestId ( "dag-calendar-root" ) ) . toBeVisible ( { timeout : 5000 } ) ;
9288 } ) . toPass ( { intervals : [ 2000 ] , timeout : 60_000 } ) ;
9389 await this . waitForCalendarReady ( ) ;
9490 }
@@ -100,7 +96,7 @@ export class DagCalendarTab extends BasePage {
10096 public async switchToHourly ( ) {
10197 await this . hourlyToggle . click ( ) ;
10298
103- await this . page . getByTestId ( "calendar-hourly-view" ) . waitFor ( { state : "visible" , timeout : 30_000 } ) ;
99+ await expect ( this . page . getByTestId ( "calendar-hourly-view" ) ) . toBeVisible ( { timeout : 30_000 } ) ;
104100 }
105101
106102 public async switchToTotalView ( ) {
@@ -112,22 +108,14 @@ export class DagCalendarTab extends BasePage {
112108 }
113109
114110 private async waitForCalendarReady ( ) : Promise < void > {
115- await this . page . getByTestId ( "dag-calendar-root" ) . waitFor ( { state : "visible" , timeout : 120_000 } ) ;
116-
117- await this . page . getByTestId ( "calendar-current-period" ) . waitFor ( { state : "visible" , timeout : 120_000 } ) ;
111+ await expect ( this . page . getByTestId ( "dag-calendar-root" ) ) . toBeVisible ( { timeout : 120_000 } ) ;
118112
119- const overlay = this . page . getByTestId ( "calendar-loading-overlay" ) ;
120-
121- if ( await overlay . isVisible ( ) . catch ( ( ) => false ) ) {
122- await overlay . waitFor ( { state : "hidden" , timeout : 120_000 } ) ;
123- }
113+ await expect ( this . page . getByTestId ( "calendar-current-period" ) ) . toBeVisible ( { timeout : 120_000 } ) ;
124114
125- await this . page . getByTestId ( "calendar-grid" ) . waitFor ( { state : "visible" , timeout : 120_000 } ) ;
115+ await expect ( this . page . getByTestId ( "calendar-loading-overlay" ) ) . toBeHidden ( { timeout : 120_000 } ) ;
126116
127- await this . page . waitForFunction ( ( ) => {
128- const cells = document . querySelectorAll ( '[data-testid="calendar-cell"]' ) ;
117+ await expect ( this . page . getByTestId ( "calendar-grid" ) ) . toBeVisible ( { timeout : 120_000 } ) ;
129118
130- return cells . length > 0 ;
131- } ) ;
119+ await expect ( this . calendarCells . first ( ) ) . toBeVisible ( { timeout : 120_000 } ) ;
132120 }
133121}
0 commit comments