11/** *******************************************************************
2- * copyright (c) 2019-2023 Red Hat, Inc.
2+ * copyright (c) 2019-2026 Red Hat, Inc.
33 *
44 * This program and the accompanying materials are made
55 * available under the terms of the Eclipse Public License 2.0
@@ -22,11 +22,12 @@ export enum WorkspaceStatusUI {
2222
2323@injectable ( )
2424export class Workspaces {
25- private static readonly ADD_WORKSPACE_BUTTON : By = By . xpath ( '// button[text() ="Add Workspace"]') ;
25+ private static readonly ADD_WORKSPACE_BUTTON : By = By . css ( ' button[aria-label ="Add Workspace"]') ;
2626 private static readonly WORKSPACE_ITEM_TABLE_NAME_SECTION : By = By . xpath ( '//td[@data-label="Name"]/span/a' ) ;
2727 private static readonly DELETE_WORKSPACE_BUTTON_ENABLED : By = By . xpath (
2828 '//button[@data-testid="delete-workspace-button" and not(@disabled)]'
2929 ) ;
30+ private static readonly WORKSPACE_ACTION_POPUP : By = By . css ( 'div[class*="workspaceActionSelector"]' ) ;
3031 private static readonly DELETE_CONFIRMATION_CHECKBOX : By = By . xpath ( '//input[@data-testid="confirmation-checkbox"]' ) ;
3132 private static readonly CONFIRMATION_WINDOW : By = By . xpath ( '//div[@aria-label="Delete workspaces confirmation window"]' ) ;
3233 private static readonly LEARN_MORE_DOC_LINK : By = By . xpath ( '//div/p/a' ) ;
@@ -99,7 +100,7 @@ export class Workspaces {
99100 async waitActionsPopup ( workspaceName : string , timeout : number = TIMEOUT_CONSTANTS . TS_COMMON_DASHBOARD_WAIT_TIMEOUT ) : Promise < void > {
100101 Logger . debug ( `of the '${ workspaceName } ' list item` ) ;
101102
102- await this . driverHelper . waitVisibility ( this . getExpandedActionsLocator ( workspaceName ) , timeout ) ;
103+ await this . driverHelper . waitVisibility ( Workspaces . WORKSPACE_ACTION_POPUP , timeout ) ;
103104 }
104105
105106 async openActionsPopup ( workspaceName : string , timeout : number = TIMEOUT_CONSTANTS . TS_COMMON_DASHBOARD_WAIT_TIMEOUT ) : Promise < void > {
@@ -112,19 +113,19 @@ export class Workspaces {
112113 async clickActionsDeleteButton ( workspaceName : string ) : Promise < void > {
113114 Logger . debug ( `for the '${ workspaceName } ' list item` ) ;
114115
115- await this . driverHelper . waitAndClick ( this . getActionsPopupButtonLocator ( workspaceName , 'Delete Workspace' ) ) ;
116+ await this . driverHelper . waitAndClick ( this . getActionsPopupButtonLocator ( 'Delete Workspace' ) ) ;
116117 }
117118
118119 async clickActionsStopWorkspaceButton ( workspaceName : string ) : Promise < void > {
119120 Logger . debug ( `for the '${ workspaceName } ' list item` ) ;
120121 // todo: workaround because of issue CRW-3649
121122 try {
122- await this . driverHelper . waitAndClick ( this . getActionsPopupButtonLocator ( workspaceName , 'Stop Workspace' ) ) ;
123+ await this . driverHelper . waitAndClick ( this . getActionsPopupButtonLocator ( 'Stop Workspace' ) ) ;
123124 } catch ( e ) {
124125 Logger . warn ( `for the '${ workspaceName } ' list item - popup was missed, try to click one more time (issue CRW-3649).` ) ;
125126
126127 await this . driverHelper . waitAndClick ( this . getActionsLocator ( workspaceName ) ) ;
127- await this . driverHelper . waitAndClick ( this . getActionsPopupButtonLocator ( workspaceName , 'Stop Workspace' ) ) ;
128+ await this . driverHelper . waitAndClick ( this . getActionsPopupButtonLocator ( 'Stop Workspace' ) ) ;
128129 }
129130 }
130131
@@ -214,7 +215,7 @@ export class Workspaces {
214215 }
215216
216217 private getWorkspaceListItemLocator ( workspaceName : string ) : By {
217- return By . xpath ( `//tr[td//a [text()='${ workspaceName } ']]` ) ;
218+ return By . xpath ( `//tr[td//span [text()='${ workspaceName } ']]` ) ;
218219 }
219220
220221 private getWorkspaceStatusLocator ( workspaceName : string , workspaceStatus : WorkspaceStatusUI ) : By {
@@ -226,21 +227,21 @@ export class Workspaces {
226227 }
227228
228229 private getActionsLocator ( workspaceName : string ) : By {
229- return By . xpath ( `${ this . getWorkspaceListItemLocator ( workspaceName ) . value } /td/div/ button[@aria-label='Actions']` ) ;
230+ return By . xpath ( `${ this . getWorkspaceListItemLocator ( workspaceName ) . value } /td/button[@aria-label='Actions']` ) ;
230231 }
231232
232- private getExpandedActionsLocator ( workspaceName : string ) : By {
233+ /* private getExpandedActionsLocator(workspaceName: string): By {
233234 return By.xpath(
234235 `${this.getWorkspaceListItemLocator(workspaceName).value}//button[@aria -label='Actions' and @aria-expanded='true']`
235236 );
236- }
237+ }*/
237238
238- private getActionsPopupButtonLocator ( workspaceName : string , buttonText : string ) : By {
239- return By . xpath ( ` ${ this . getWorkspaceListItemLocator ( workspaceName ) . value } // button[text()=' ${ buttonText } ' ]`) ;
239+ private getActionsPopupButtonLocator ( buttonText : string ) : By {
240+ return By . css ( ` button[aria-label="Action: ${ buttonText } " ]`) ;
240241 }
241242
242243 private getOpenButtonLocator ( workspaceName : string ) : By {
243- return By . xpath ( `( ${ this . getWorkspaceListItemLocator ( workspaceName ) . value } //td//button [text()='Open'])[last() ]` ) ;
244+ return By . xpath ( `${ this . getWorkspaceListItemLocator ( workspaceName ) . value } //td[contains(@class, 'openIde')]//span [text()='Open']` ) ;
244245 }
245246
246247 private getOpenWorkspaceDetailsLinkLocator ( workspaceName : string ) : By {
0 commit comments