Skip to content

Commit 128cacd

Browse files
authored
[Test] Update EmptyWorkspace, SmokeTest, and Factory E2E tests for the User Dashboard UI redesign (#23757)
* Update locators according to new UI Dashboard
1 parent fcb7b09 commit 128cacd

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

tests/e2e/pageobjects/dashboard/CreateWorkspace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class CreateWorkspace {
213213
private getSampleLocator(sampleName: string): By {
214214
Logger.trace(`sampleName: ${sampleName}, used default editor`);
215215

216-
return By.xpath(`//article[contains(@class, 'sample-card')]//div[text()='${sampleName}']`);
216+
return By.xpath(`//div[contains(@id, 'sample-card') and text()='${sampleName}']`);
217217
}
218218

219219
private getGitBranchListItemLocator(branchName: string): By {

tests/e2e/pageobjects/dashboard/TrustAuthorPopup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
@@ -17,7 +17,7 @@ import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
1717

1818
@injectable()
1919
export class TrustAuthorPopup {
20-
private static readonly CONTINUE_BUTTON: By = By.xpath('//button[text()="Continue"]');
20+
private static readonly CONTINUE_BUTTON: By = By.xpath('//span[text()="Continue"]');
2121
private static readonly TRUST_AUTHOR_POPUP_PAGE: By = By.xpath(
2222
'//span[contains(text(), "Do you trust the authors of this repository?")]'
2323
);

tests/e2e/pageobjects/dashboard/Workspaces.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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()
2424
export 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 {

tests/e2e/tests-library/WorkspaceHandlingTests.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
@@ -23,9 +23,9 @@ import { By, error } from 'selenium-webdriver';
2323
@injectable()
2424
export class WorkspaceHandlingTests {
2525
private static WORKSPACE_NAME: By = By.xpath('//h1[contains(.,"Starting workspace ")]');
26-
private static WORKSPACE_STATUS: By = By.xpath('//*/span[@class="pf-c-label__content"]');
27-
private static WORKSPACE_ALERT_TITLE: By = By.xpath('//h4[@class="pf-c-alert__title"]');
28-
private static WORKSPACE_ALERT_DESCRIPTION: By = By.xpath('//*/div[@class="pf-c-alert__description"]');
26+
private static WORKSPACE_STATUS: By = By.css('span[class*="label__content"]');
27+
private static WORKSPACE_ALERT_TITLE: By = By.css('h4[class*="alert__title"]');
28+
private static WORKSPACE_ALERT_DESCRIPTION: By = By.css('div[class*="alert__description"]');
2929
private static workspaceName: string = 'undefined';
3030
private static parentGUID: string;
3131

0 commit comments

Comments
 (0)