File tree 4 files changed +15
-3
lines changed
frontend/src/components/App
4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ export class HeadlampPage {
22
22
this . page . click ( 'button:has-text("Authenticate")' ) ,
23
23
] ) ;
24
24
}
25
+
26
+ await this . page . waitForLoadState ( 'load' ) ;
25
27
}
26
28
27
29
async navigateToCluster ( name : string , token ?: string ) {
@@ -77,11 +79,16 @@ export class HeadlampPage {
77
79
78
80
async logout ( ) {
79
81
// 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 ( ) ;
81
87
82
88
// 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
+
85
92
await this . page . waitForLoadState ( 'load' ) ;
86
93
87
94
// 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(
269
269
< Icon icon = "mdi:logout" />
270
270
</ ListItemIcon >
271
271
< ListItemText
272
+ data-testid = "logout-menu-item"
272
273
primary = { t ( 'Log out' ) }
273
274
secondary = { hasToken ? null : t ( '(No token set up)' ) }
274
275
/>
@@ -328,6 +329,7 @@ export const PureTopBar = memo(
328
329
action : ! ! isClusterContext && (
329
330
< MenuItem >
330
331
< IconButton
332
+ data-testid = "user-account-button"
331
333
aria-label = { t ( 'Account of current user' ) }
332
334
aria-controls = { userMenuId }
333
335
aria-haspopup = "true"
@@ -386,6 +388,7 @@ export const PureTopBar = memo(
386
388
id : DefaultAppBarAction . USER ,
387
389
action : ! ! isClusterContext && (
388
390
< IconButton
391
+ data-testid = "user-account-button"
389
392
aria-label = { t ( 'Account of current user' ) }
390
393
aria-controls = { userMenuId }
391
394
aria-haspopup = "true"
Original file line number Diff line number Diff line change 124
124
aria-haspopup="true"
125
125
aria-label="Account of current user"
126
126
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-sizeMedium css-1jcv3fz-MuiButtonBase-root-MuiIconButton-root"
127
+ data-testid="user-account-button"
127
128
tabindex="0"
128
129
type="button"
129
130
>
Original file line number Diff line number Diff line change 143
143
aria-haspopup="true"
144
144
aria-label="Account of current user"
145
145
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-sizeMedium css-1jcv3fz-MuiButtonBase-root-MuiIconButton-root"
146
+ data-testid="user-account-button"
146
147
tabindex="0"
147
148
type="button"
148
149
>
You can’t perform that action at this time.
0 commit comments