11import type { Locator , Page } from '@playwright/test' ;
22
3+ import { isInViewport } from '../../../utils/dom' ;
34import { VISIBILITY_TIMEOUT } from '../TenantPage' ;
45
56import { ActionsMenu } from './ActionsMenu' ;
@@ -28,6 +29,7 @@ export class ObjectSummary {
2829 private infoExpandButton : Locator ;
2930 private summaryCollapseButton : Locator ;
3031 private summaryExpandButton : Locator ;
32+ private overviewWrapper : Locator ;
3133
3234 constructor ( page : Page ) {
3335 this . tree = page . locator ( '.ydb-object-summary__tree' ) ;
@@ -59,6 +61,7 @@ export class ObjectSummary {
5961 this . summaryExpandButton = page . locator (
6062 '.ydb-object-summary__actions button[title="Expand"]' ,
6163 ) ;
64+ this . overviewWrapper = page . locator ( '.ydb-object-summary__overview-wrapper' ) ;
6265 }
6366
6467 async collapseInfoPanel ( ) : Promise < void > {
@@ -70,8 +73,19 @@ export class ObjectSummary {
7073 }
7174
7275 async isInfoPanelCollapsed ( ) : Promise < boolean > {
73- // When panel is collapsed, expand button should be visible
74- return this . infoExpandButton . isVisible ( ) ;
76+ const expandButtonVisible = await this . infoExpandButton . isVisible ( ) ;
77+ if ( ! expandButtonVisible ) {
78+ return false ;
79+ }
80+
81+ const isVisible = await this . overviewWrapper . isVisible ( ) ;
82+ if ( ! isVisible ) {
83+ return true ;
84+ }
85+
86+ // Check if it's actually in the viewport
87+ const elementInViewport = await isInViewport ( this . overviewWrapper ) ;
88+ return ! elementInViewport ;
7589 }
7690
7791 async isCreateDirectoryModalVisible ( ) : Promise < boolean > {
@@ -242,7 +256,18 @@ export class ObjectSummary {
242256 }
243257
244258 async isSummaryCollapsed ( ) : Promise < boolean > {
245- // When summary is collapsed, expand button should be visible
246- return this . summaryExpandButton . isVisible ( ) ;
259+ const expandButtonVisible = await this . summaryExpandButton . isVisible ( ) ;
260+ if ( ! expandButtonVisible ) {
261+ return false ;
262+ }
263+
264+ const isVisible = await this . tree . isVisible ( ) ;
265+ if ( ! isVisible ) {
266+ return true ;
267+ }
268+
269+ // Check if it's actually in the viewport
270+ const elementInViewport = await isInViewport ( this . tree ) ;
271+ return ! elementInViewport ;
247272 }
248273}
0 commit comments