Skip to content
Merged
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
2 changes: 2 additions & 0 deletions tests/e2e/configs/inversify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { NotificationHandler } from '../pageobjects/ide/NotificationHandler';
import { SourceControlView } from '../pageobjects/ide/SourceControlView';
import { GitHubExtensionDialog } from '../pageobjects/ide/GitHubExtensionDialog';
import { AiCodeSignInDialog } from '../pageobjects/ide/AiCodeSignInDialog';
import { RestartWorkspaceDialog } from '../pageobjects/ide/RestartWorkspaceDialog';

const e2eContainer: Container = new Container({ defaultScope: 'Transient', skipBaseClassChecks: true });

Expand Down Expand Up @@ -111,6 +112,7 @@ e2eContainer.bind<NotificationHandler>(CLASSES.NotificationHandler).to(Notificat
e2eContainer.bind<SourceControlView>(CLASSES.SourceControlView).to(SourceControlView);
e2eContainer.bind<GitHubExtensionDialog>(CLASSES.GitHubExtensionDialog).to(GitHubExtensionDialog);
e2eContainer.bind<AiCodeSignInDialog>(CLASSES.AiCodeSignInDialog).to(AiCodeSignInDialog);
e2eContainer.bind<RestartWorkspaceDialog>(CLASSES.RestartWorkspaceDialog).to(RestartWorkspaceDialog);

if (BASE_TEST_CONSTANTS.TS_PLATFORM === Platform.OPENSHIFT) {
if (OAUTH_CONSTANTS.TS_SELENIUM_VALUE_OPENSHIFT_OAUTH) {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/configs/inversify.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ const CLASSES: any = {
NotificationHandler: 'NotificationHandler',
SourceControlView: 'SourceControlView',
GitHubExtensionDialog: 'GitHubExtensionDialog',
AiCodeSignInDialog: 'AiCodeSignInDialog'
AiCodeSignInDialog: 'AiCodeSignInDialog',
RestartWorkspaceDialog: 'RestartWorkspaceDialog'
};

const EXTERNAL_CLASSES: any = {
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export * from './pageobjects/ide/ExplorerView';
export * from './pageobjects/ide/ExtensionsView';
export * from './pageobjects/ide/GitHubExtensionDialog';
export * from './pageobjects/ide/NotificationHandler';
export * from './pageobjects/ide/RestartWorkspaceDialog';
export * from './pageobjects/ide/RestrictedModeButton';
export * from './pageobjects/ide/SourceControlView';
export * from './pageobjects/ide/ViewsMoreActionsButton';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export class WorkspaceDetails {
private static readonly ENABLED_SAVE_BUTTON: By = By.css('button[name="save-button"][aria-disabled="false"]');
private static readonly WORKSPACE_DETAILS_LOADER: By = By.css('workspace-details-overview md-progress-linear');
private static readonly STORAGE_TYPE_INFO_BUTTON: By = By.css('span[aria-label="More info for storage type"]');
private static readonly STORAGE_TYPE_VALUE: By = By.xpath(
'//span[@aria-label="More info for storage type"]/ancestor::div[contains(@class, "pf-v6-c-form__group")]' +
'//div[contains(@class, "pf-v6-c-form__group-control")]/span'
);
private static readonly CLOSE_STORAGE_TYPE_INFO_BUTTON: By = By.xpath('//button[@aria-label="Close"]');
private static readonly STORAGE_TYPE_DOC_LINK: By = By.xpath('//div/p/a');
private static readonly DEVFILE_DOC_LINK: By = By.xpath('//a[text()="Devfile Documentation"]');
Expand Down Expand Up @@ -126,6 +130,12 @@ export class WorkspaceDetails {
await this.clickOnTab(tabTitle, timeout);
}

async getStorageTypeValue(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<string> {
Logger.debug();

return await this.driverHelper.waitAndGetText(WorkspaceDetails.STORAGE_TYPE_VALUE, timeout);
}

async clickStorageTypeInfo(): Promise<void> {
Logger.debug();

Expand Down
74 changes: 74 additions & 0 deletions tests/e2e/pageobjects/ide/RestartWorkspaceDialog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/** *******************************************************************
* copyright (c) 2026 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
import { inject, injectable } from 'inversify';
import { CLASSES } from '../../configs/inversify.types';
import { By, Key, WebElement } from 'selenium-webdriver';
import { DriverHelper } from '../../utils/DriverHelper';
import { Logger } from '../../utils/Logger';
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';

@injectable()
export class RestartWorkspaceDialog {
private static readonly RESTART_BUTTON: By = By.xpath('//div[@class="dialog-buttons"]//a[text()="Restart"]');
private static readonly RESTART_WORKSPACE_BUTTON: By = By.xpath('//div[@class="dialog-buttons"]//a[text()="Restart your workspace"]');
private static readonly RESTART_WITH_DEFAULT_DEVFILE_BUTTON: By = By.xpath('//span[text()="Restart with default devfile"]');
private static readonly ERROR_DIALOG_TEXT: By = By.xpath('//*[@class="dialog-message-text"]');
private static readonly ERROR_DIALOG_DETAIL: By = By.xpath('//*[@class="dialog-message-detail"]');

constructor(
@inject(CLASSES.DriverHelper)
private readonly driverHelper: DriverHelper
) {}

async restartFromLocalDevfile(projectName: string): Promise<void> {
Logger.debug();

await this.driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys('p').keyUp(Key.CONTROL).perform();
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING);

await this.driverHelper.getDriver().actions().sendKeys('>Dev Spaces: Restart Workspace from Local Devfile').perform();
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING);
await this.driverHelper.getDriver().actions().sendKeys(Key.ENTER).perform();
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING);

await this.driverHelper.getDriver().actions().sendKeys(`/projects/${projectName}/devfile.yaml`).perform();
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING);
await this.driverHelper.getDriver().actions().sendKeys(Key.ENTER).perform();
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING);

await this.driverHelper.waitAndClick(RestartWorkspaceDialog.RESTART_BUTTON);
}

async confirmRestartWorkspace(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_PLUGIN_TEST_TIMEOUT): Promise<void> {
Logger.debug();

await this.driverHelper.waitAndClick(RestartWorkspaceDialog.RESTART_WORKSPACE_BUTTON, timeout);
}

async clickRestartWithDefaultDevfile(timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_START_WORKSPACE_TIMEOUT): Promise<void> {
Logger.debug();

await this.driverHelper.waitAndClick(RestartWorkspaceDialog.RESTART_WITH_DEFAULT_DEVFILE_BUTTON, timeout);
}

async getErrorDialogText(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_PLUGIN_TEST_TIMEOUT): Promise<string> {
Logger.debug();

const element: WebElement = await this.driverHelper.waitVisibility(RestartWorkspaceDialog.ERROR_DIALOG_TEXT, timeout);
return element.getText();
}

async getErrorDetailText(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_PLUGIN_TEST_TIMEOUT): Promise<string> {
Logger.debug();

const element: WebElement = await this.driverHelper.waitVisibility(RestartWorkspaceDialog.ERROR_DIALOG_DETAIL, timeout);
return element.getText();
}
}
Loading
Loading