File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed
frontend/src/components/App Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ export class HeadlampPage {
2222 this . page . click ( 'button:has-text("Authenticate")' ) ,
2323 ] ) ;
2424 }
25+
26+ await this . page . waitForLoadState ( 'load' ) ;
2527 }
2628
2729 async navigateToCluster ( name : string , token ?: string ) {
@@ -77,11 +79,16 @@ export class HeadlampPage {
7779
7880 async logout ( ) {
7981 // Click on the account button to open the user menu
80- await this . page . click ( 'button[aria-label="Account of current user"]' ) ;
82+ const userButton = await this . page . waitForSelector ( '[data-testid="user-account-button"]' , {
83+ state : 'visible' ,
84+ } ) ;
85+
86+ await userButton . click ( ) ;
8187
8288 // Wait for the logout option to be visible and click on it
83- await this . page . waitForSelector ( 'a.MuiMenuItem-root:has-text("Log out")' ) ;
84- await this . page . click ( 'a.MuiMenuItem-root:has-text("Log out")' ) ;
89+ await this . page . waitForSelector ( '[data-testid="logout-menu-item"]' ) ;
90+ await this . page . click ( '[data-testid="logout-menu-item"]' ) ;
91+
8592 await this . page . waitForLoadState ( 'load' ) ;
8693
8794 // Expects the URL to contain c/test/token
Original file line number Diff line number Diff line change @@ -269,6 +269,7 @@ export const PureTopBar = memo(
269269 < Icon icon = "mdi:logout" />
270270 </ ListItemIcon >
271271 < ListItemText
272+ data-testid = "logout-menu-item"
272273 primary = { t ( 'Log out' ) }
273274 secondary = { hasToken ? null : t ( '(No token set up)' ) }
274275 />
@@ -328,6 +329,7 @@ export const PureTopBar = memo(
328329 action : ! ! isClusterContext && (
329330 < MenuItem >
330331 < IconButton
332+ data-testid = "user-account-button"
331333 aria-label = { t ( 'Account of current user' ) }
332334 aria-controls = { userMenuId }
333335 aria-haspopup = "true"
@@ -386,6 +388,7 @@ export const PureTopBar = memo(
386388 id : DefaultAppBarAction . USER ,
387389 action : ! ! isClusterContext && (
388390 < IconButton
391+ data-testid = "user-account-button"
389392 aria-label = { t ( 'Account of current user' ) }
390393 aria-controls = { userMenuId }
391394 aria-haspopup = "true"
Original file line number Diff line number Diff line change 124124 aria-haspopup="true"
125125 aria-label="Account of current user"
126126 class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-sizeMedium css-1jcv3fz-MuiButtonBase-root-MuiIconButton-root"
127+ data-testid="user-account-button"
127128 tabindex="0"
128129 type="button"
129130 >
Original file line number Diff line number Diff line change 143143 aria-haspopup="true"
144144 aria-label="Account of current user"
145145 class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-sizeMedium css-1jcv3fz-MuiButtonBase-root-MuiIconButton-root"
146+ data-testid="user-account-button"
146147 tabindex="0"
147148 type="button"
148149 >
You can’t perform that action at this time.
0 commit comments