Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/e2e/constants/TIMEOUT_CONSTANTS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ export const TIMEOUT_CONSTANTS: {
// -------------------------------------------- PROJECT TREE --------------------------------------------

/**
* expand item in project tree, "8 000" by default.
* expand item in project tree, "10 000" by default.
*/
TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT: Number(process.env.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT) || 8_000,
TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT: Number(process.env.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT) || 10_000,

// -------------------------------------------- EDITOR --------------------------------------------

Expand Down
37 changes: 19 additions & 18 deletions tests/e2e/pageobjects/dashboard/CreateWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ import { TrustAuthorPopup } from './TrustAuthorPopup';

@injectable()
export class CreateWorkspace {
private static readonly FACTORY_URL: By = By.xpath('//input[@id="git-repo-url"]');
private static readonly FACTORY_URL: By = By.id('git-repo-url');
private static readonly GIT_REPO_OPTIONS: By = By.xpath('//span[text()="Git Repo Options"]');
private static readonly GIT_BRANCH_NAME: By = By.xpath(
'//div[text()="Select the branch of the Git Repository"]/preceding-sibling::div'
);
private static readonly GIT_BRANCH_SEARCH_FIELD: By = By.css('input[type="search"]');
private static readonly PATH_TO_DEVFILE: By = By.xpath('//input[@aria-label="Path to Devfile"]');
private static readonly CREATE_AND_OPEN_BUTTON: By = By.xpath('//button[@id="create-and-open-button"]');
private static readonly CREATE_NEW_WORKPACE_CHECKBOX: By = By.xpath('//label[@for="create-new-if-exist-switch"]');
private static readonly CREATE_NEW_WORKPACE_CHECKBOX_VALUE: By = By.xpath('//input[@id="create-new-if-exist-switch"]');

private static readonly GIT_BRANCH_SELECT_FIELD: By = By.xpath('//span[text()="Select the branch of the Git Repository"]');
private static readonly GIT_FILTER_BRANCHES: By = By.css('input[placeholder="Filter branches"]');
private static readonly CREATE_AND_OPEN_BUTTON: By = By.id('create-and-open-button');
private static readonly CREATE_NEW_WORKPACE_CHECKBOX: By = By.css('label[for="create-new-if-exist-switch"]');
private static readonly CREATE_NEW_WORKPACE_CHECKBOX_VALUE: By = By.id('create-new-if-exist-switch');

constructor(
@inject(CLASSES.DriverHelper)
Expand Down Expand Up @@ -87,23 +85,23 @@ export class CreateWorkspace {

if (branchName) {
await this.driverHelper.waitAndClick(CreateWorkspace.GIT_REPO_OPTIONS, timeout);

await this.driverHelper.waitAndClick(CreateWorkspace.GIT_BRANCH_NAME, timeout);

await this.driverHelper.waitVisibility(CreateWorkspace.GIT_BRANCH_SEARCH_FIELD, timeout);
await this.driverHelper.type(CreateWorkspace.GIT_BRANCH_SEARCH_FIELD, Key.chord(branchName), timeout);
await this.driverHelper.waitAndClick(CreateWorkspace.GIT_BRANCH_SELECT_FIELD, timeout);
await this.driverHelper.waitAndClick(CreateWorkspace.GIT_FILTER_BRANCHES, timeout);
await this.driverHelper.type(CreateWorkspace.GIT_FILTER_BRANCHES, Key.chord(branchName), timeout);
await this.driverHelper.waitAndClick(this.getGitBranchListItemLocator(branchName), timeout);
}

await this.driverHelper.waitAndClick(CreateWorkspace.CREATE_AND_OPEN_BUTTON, timeout);

await this.performTrustAuthorPopup();
}

async setGitRepositoryUrl(factoryUrl: string, timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
Logger.debug(`factoryUrl: "${factoryUrl}"`);
await this.driverHelper.waitVisibility(CreateWorkspace.FACTORY_URL, timeout);
await this.driverHelper.type(CreateWorkspace.FACTORY_URL, Key.chord(factoryUrl), timeout);
await this.driverHelper.type(CreateWorkspace.FACTORY_URL, factoryUrl, timeout);

const actualFactoryUrl: string = await this.getGitRepositoryUrl(timeout);
Logger.info(`[INFO] Git repository URL set to "${actualFactoryUrl}"`);
}

async getGitRepositoryUrl(timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<string> {
Expand Down Expand Up @@ -184,7 +182,10 @@ export class CreateWorkspace {

// click to change state
Logger.debug(`Checkbox is ${isCurrentlyChecked ? 'set' : 'unset'}, ${checked ? 'setting' : 'unsetting'} it now`);
await this.driverHelper.scrollToAndClick(CreateWorkspace.CREATE_NEW_WORKPACE_CHECKBOX, timeout);
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_WAIT_FOR_URL); // wait for any potential UI updates before clicking
await this.driverHelper.scrollToAndClick(CreateWorkspace.CREATE_NEW_WORKPACE_CHECKBOX, timeout); // scroll to checkbox to ensure it's in view
await this.driverHelper.scrollTo(CreateWorkspace.CREATE_AND_OPEN_BUTTON, timeout);
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_WAIT_FOR_URL); // wait for state change to take effect
}

private getEditorsDropdownListLocator(sampleName: string): By {
Expand Down Expand Up @@ -217,6 +218,6 @@ export class CreateWorkspace {
}

private getGitBranchListItemLocator(branchName: string): By {
return By.css(`li[id="${branchName}"] button.pf-c-select__menu-item`);
return By.xpath(`//ul[@role="listbox"]//span[text()="${branchName}"]`);
}
}
7 changes: 3 additions & 4 deletions tests/e2e/pageobjects/dashboard/Dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** *******************************************************************
* copyright (c) 2019-2024 Red Hat, Inc.
* copyright (c) 2019-2026 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -32,7 +32,6 @@ export class Dashboard {
'//div[text()="Several workspaces created from the same repository have been found. Should you want to open one of the existing workspaces or create a new one, please choose the corresponding action."]'
);
private static readonly EXISTING_WORKSPACE_FOUND_LIST: By = By.xpath('//button//span[text()="Open the existing workspace"]');
private static readonly EXISTING_WORKSPACE_NAME: By = By.xpath('//li//a[text()="python-hello-world"]"]');
private static readonly CREATE_NEW_WORKSPACE_LINK: By = By.xpath('//button[text()="Create a new workspace"]');
private static readonly ABOUT_DIALOG_ITEM_DATA_TEST_IDS: any = {
serverVersion: 'server-version',
Expand Down Expand Up @@ -191,7 +190,7 @@ export class Dashboard {
await this.driverHelper.waitVisibility(Dashboard.EXISTING_WORKSPACE_FOUND_LIST);
const element: WebElement = await this.driverHelper.waitPresence(Dashboard.EXISTING_WORKSPACE_FOUND_LIST);
await this.driverHelper.getDriver().executeScript('arguments[0].click();', element);
await this.driverHelper.waitAndClick(By.xpath(`//li//a[text()="${workspaceName}"]`));
await this.driverHelper.waitAndClick(By.xpath(`//li//span[text()="${workspaceName}"]`));
}

async clickOnCreateNewWorkspaceButton(timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
Expand Down Expand Up @@ -239,7 +238,7 @@ export class Dashboard {
}

private getAboutMenuItemButtonLocator(text: string): By {
return By.xpath(`//li/button[text()="${text}"]`);
return By.xpath(`//li//span[text()="${text}"]`);
}

private getAboutDialogWindowItemLocator(itemDataTestId: string): By {
Expand Down
26 changes: 13 additions & 13 deletions tests/e2e/pageobjects/dashboard/UserPreferences.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** *******************************************************************
* copyright (c) 2019-2025 Red Hat, Inc.
* copyright (c) 2019-2026 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -21,13 +21,13 @@ import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
@injectable()
export class UserPreferences {
private static readonly USER_SETTINGS_DROPDOWN: By = By.xpath('//header//button/span[text()!=""]//parent::button');
private static readonly USER_PREFERENCES_BUTTON: By = By.xpath('//button[text()="User Preferences"]');
private static readonly USER_PREFERENCES_BUTTON: By = By.xpath('//span[text()="User Preferences"]');
private static readonly USER_PREFERENCES_PAGE: By = By.xpath('//h1[text()="User Preferences"]');

private static readonly CONTAINER_REGISTRIES_TAB: By = By.xpath('//button[text()="Container Registries"]');

private static readonly GIT_SERVICES_TAB: By = By.xpath('//button[text()="Git Services"]');
private static readonly GIT_SERVICES_REVOKE_BUTTON: By = By.xpath('//button[text()="Revoke"]');
private static readonly GIT_SERVICES_TAB: By = By.css('button[id*="GitServices"]');
private static readonly GIT_SERVICES_REVOKE_BUTTON: By = By.css('button[data-testid*="revoke-button"]');

private static readonly PAT_TAB: By = By.xpath('//button[text()="Personal Access Tokens"]');
private static readonly ADD_NEW_PAT_BUTTON: By = By.xpath('//button[text()="Add Personal Access Token"]');
Expand All @@ -38,21 +38,21 @@ export class UserPreferences {
private static readonly GIT_CONFIG_SAVE_BUTTON: By = By.css('[data-testid="button-save"]');

private static readonly SSH_KEY_TAB: By = By.xpath('//button[text()="SSH Keys"]');
private static readonly ADD_NEW_SSH_KEY_BUTTON: By = By.xpath('//button[text()="Add SSH Key"]');
private static readonly ADD_NEW_SSH_KEY_BUTTON: By = By.css('button[aria-label="Add SSH Key"]');
private static readonly ADD_SSH_KEYS_POPUP: By = By.xpath('//span[text()="Add SSH Keys"]');
private static readonly PASTE_PRIVATE_SSH_KEY_FIELD: By = By.css('textarea[name="ssh-private-key"]');
private static readonly PASTE_PUBLIC_SSH_KEY_FIELD: By = By.css('textarea[name="ssh-public-key"]');
private static readonly PASTE_SSH_KEY_PASSPHRASE_FIELD: By = By.xpath('//input[@placeholder="Enter passphrase (optional)"]');
private static readonly ADD_SSH_KEYS_BUTTON: By = By.css('.pf-c-button.pf-m-primary');
private static readonly PASTE_PRIVATE_SSH_KEY_FIELD: By = By.id('ssh-private-key');
private static readonly PASTE_PUBLIC_SSH_KEY_FIELD: By = By.id('ssh-public-key');
private static readonly PASTE_SSH_KEY_PASSPHRASE_FIELD: By = By.css('input[placeholder="Enter passphrase (optional)"]');
private static readonly ADD_SSH_KEYS_BUTTON: By = By.xpath('//span[text()="Add"]');
private static readonly GIT_SSH_KEY_NAME: By = By.css('[data-testid="title"]');
private static readonly GIT_SSH_KEY_ACTIONS_BUTTON: By = By.css('section[id*="SshKeys-user-preferences"] button[aria-label="Actions"]');
private static readonly DELETE_BUTTON: By = By.xpath('//button[text()="Delete"]');
private static readonly DELETE_BUTTON: By = By.xpath('//span[text()="Delete"]');
private static readonly CONFIRM_DELETE_SSH_KEYS_POPUP: By = By.css('div[id^="pf-modal-part"][role="dialog"]');
private static readonly CONFIRM_DELETE_SSH_KEYS_CHECKBOX: By = By.id('delete-ssh-keys-warning-checkbox');

private static readonly CONFIRMATION_WINDOW: By = By.xpath('//span[text()="Revoke Git Service"]');
private static readonly DELETE_CONFIRMATION_CHECKBOX: By = By.xpath('//input[@data-testid="warning-info-checkbox"]');
private static readonly DELETE_ITEM_BUTTON_ENABLED: By = By.xpath('//button[@data-testid="revoke-button" and not(@disabled)]');
private static readonly DELETE_CONFIRMATION_CHECKBOX: By = By.id('revoke-warning-info-check');
private static readonly DELETE_ITEM_BUTTON_ENABLED: By = By.css('button[data-testid="revoke-button"]:not([disabled])');

constructor(
@inject(CLASSES.DriverHelper)
Expand Down Expand Up @@ -146,7 +146,7 @@ export class UserPreferences {

await this.driverHelper.waitAttributeValue(
UserPreferences.GIT_CONFIG_SAVE_BUTTON,
'aria-disabled',
'disabled',
'true',
TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT
);
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/pageobjects/dashboard/Workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class Workspaces {
}

private getOpenButtonLocator(workspaceName: string): By {
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName).value}//td[contains(@class, 'openIde')]//span[text()='Open']`);
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName).value}//button/span[text()='Open']`);
}

private getOpenWorkspaceDetailsLinkLocator(workspaceName: string): By {
Expand Down
Loading