From cab656269bc5300458b76151e4cb62b9b9ae62a1 Mon Sep 17 00:00:00 2001 From: Oleksii Korniienko Date: Wed, 17 Jun 2026 16:35:39 +0200 Subject: [PATCH 1/6] Added universal test for all of the editors Signed-off-by: Oleksii Korniienko Assisted-by: Claude Code --- .../StartWorkspaceUsingDesktopEditors.spec.ts | 243 ++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts new file mode 100644 index 00000000000..ea3be9b7bd6 --- /dev/null +++ b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts @@ -0,0 +1,243 @@ +/** ******************************************************************* + * 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 { e2eContainer } from '../../configs/inversify.config'; +import { CLASSES } from '../../configs/inversify.types'; +import { LoginTests } from '../../tests-library/LoginTests'; +import { Dashboard } from '../../pageobjects/dashboard/Dashboard'; +import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; +import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests'; +import { expect } from 'chai'; +import { Logger } from '../../utils/Logger'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; +import { DriverHelper } from '../../utils/DriverHelper'; + +suite('Check all editors with all samples', function (): void { + this.timeout(24000000); + const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); + const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); + const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard); + const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); + const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); + + const vsCodeDesktopSshEditor: string = '//*[@id="editor-selector-card-che-incubator/che-code-sshd/latest"]'; + const useExtensionSwitcher: string = '//label[@class="switch"]'; + const titleXpath: string = '//div[@class="header-title"]'; + + let currentTabHandle: string = 'undefined'; + const pollingForCheckTitleVSCode: number = 100; + const pollingForCheckTitleIntelliJ: number = 500; + + const allEditors: Array<{ xpath: string; name: string; type: 'vscode' | 'intellij' }> = [ + { xpath: vsCodeDesktopSshEditor, name: 'VSCode Desktop SSH', type: 'vscode' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-clion-server/latest"]', name: 'CLion', type: 'intellij' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-goland-server/latest"]', name: 'GoLand', type: 'intellij' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-idea-server/latest"]', name: 'IntelliJ IDEA', type: 'intellij' }, + { + xpath: '//*[@id="editor-selector-card-che-incubator/che-phpstorm-server/latest"]', + name: 'PhpStorm', + type: 'intellij' + }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-pycharm-server/latest"]', name: 'PyCharm', type: 'intellij' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-rider-server/latest"]', name: 'Rider', type: 'intellij' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-rubymine-server/latest"]', name: 'RubyMine', type: 'intellij' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-webstorm-server/latest"]', name: 'WebStorm', type: 'intellij' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd-kiro/latest"]', name: 'Kiro', type: 'vscode' }, + { + xpath: '//*[@id="editor-selector-card-che-incubator/jetbrains-sshd/latest"]', + name: 'JetBrains SSH', + type: 'intellij' + } + ]; + + // filter editors based on environment variable + const selectedEditorsEnv: string = process.env.TS_SELECTED_EDITORS || 'All'; + let editorsForCheck: Array<{ xpath: string; name: string; type: 'vscode' | 'intellij' }>; + + if (selectedEditorsEnv === 'All') { + editorsForCheck = allEditors; + Logger.info('Running tests for all editors'); + } else { + const selectedEditorNames: string[] = selectedEditorsEnv.split(',').map((name: string): string => name.trim()); + editorsForCheck = allEditors.filter((editor): boolean => selectedEditorNames.includes(editor.name)); + Logger.info(`Running tests for selected editors: ${editorsForCheck.map((e): string => e.name).join(', ')}`); + + if (editorsForCheck.length === 0) { + Logger.warn(`No editors matched the selection: ${selectedEditorsEnv}`); + Logger.warn(`Available editors: ${allEditors.map((e): string => e.name).join(', ')}`); + } + } + + const samplesForCheck: string[] = [ + 'Empty Workspace', + 'JBoss EAP 8.0', + 'Java Lombok', + 'Node.js Express', + 'Python', + 'Quarkus REST API', + '.NET', + 'Ansible', + 'C/C++', + 'Go', + 'PHP' + ]; + + const gitRepoUrlsToCheck: string[] = [ + 'https://github.com/crw-qe/quarkus-api-example-public/tree/ubi8-latest', + 'https://github.com/crw-qe/ubi9-based-sample-public/tree/ubi9-minimal' + ]; + + const gitRepoUrlsToCheckAirgap: string[] = [ + 'https://gh.crw-qe.com/test-automation-only/ubi8/tree/ubi8-latest', + 'https://gh.crw-qe.com/test-automation-only/ubi9-based-sample-public/tree/ubi9-minimal' + ]; + + suiteSetup('Login into Che', async function (): Promise { + await loginTests.loginIntoChe(); + }); + + async function clickOnElementByXpath(xpath: string): Promise { + Logger.debug(); + await driverHelper + .getDriver() + .executeScript( + `document.evaluate('${xpath}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();` + ); + } + + function clearCurrentTabHandle(): void { + currentTabHandle = 'undefined'; + } + + async function testWorkspaceStartup( + editorXpath: string, + editorType: 'vscode' | 'intellij', + sampleNameOrUrl: string, + isUrl: boolean + ): Promise { + await dashboard.openDashboard(); + currentTabHandle = await browserTabsUtil.getCurrentWindowHandle(); + await dashboard.clickCreateWorkspaceButton(); + + const pollingForCheckTitle: number = editorType === 'vscode' ? pollingForCheckTitleVSCode : pollingForCheckTitleIntelliJ; + + if (isUrl) { + await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndGitUrl( + editorXpath, + sampleNameOrUrl, + titleXpath, + pollingForCheckTitle + ); + } else { + await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndSample( + editorXpath, + sampleNameOrUrl, + titleXpath, + pollingForCheckTitle + ); + } + + if (editorType === 'vscode') { + // read page + const pageTextBeforeUseExtensionSwitcher: string = await driverHelper + .getDriver() + .executeScript('return document.body.innerText;'); + + // click on "Use Extension" switcher + await clickOnElementByXpath(useExtensionSwitcher); + + // read page + const pageTextAfterUseExtensionSwitcher: string = await driverHelper + .getDriver() + .executeScript('return document.body.innerText;'); + + // checks for "Install extensions" state + expect(pageTextBeforeUseExtensionSwitcher).contains('Install the following VS Code extensions'); + Logger.info('"Install the following VS Code extensions" was found in page before "Use Extension" clicked'); + + expect(pageTextBeforeUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); + Logger.info( + 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found before "Use Extension" clicked' + ); + + // checks for SSH state + expect(pageTextAfterUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); + Logger.info( + 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found after "Use Extension" clicked' + ); + + expect(pageTextAfterUseExtensionSwitcher).contains('oc port-forward -n admin-devspaces'); + Logger.info('"oc port-forward -n admin-devspaces" was found after "Use Extension" clicked'); + + expect(pageTextAfterUseExtensionSwitcher) + .contains('-----BEGIN OPENSSH PRIVATE KEY-----') + .and.contains('-----END OPENSSH PRIVATE KEY-----'); + Logger.info('SSH private key (BEGIN and END markers) was found after "Use Extension" clicked'); + + expect(pageTextAfterUseExtensionSwitcher) + .contains('HostName') + .and.contains('User') + .and.contains('Port') + .and.contains('IdentityFile') + .and.contains('UserKnownHostsFile'); + Logger.info( + 'SSH config parameters (HostName, User, Port, IdentityFile, UserKnownHostsFile) were found after "Use Extension" clicked' + ); + } else { + // check title for IntelliJ editors + const headerText: string = await workspaceHandlingTests.getTextFromUIElementByXpath(titleXpath); + expect('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running').equal(headerText); + Logger.info('Workspace title verified for IntelliJ editor: ' + headerText); + } + } + + editorsForCheck.forEach((editor): void => { + samplesForCheck.forEach((sampleName): void => { + test(`Test start of ${editor.name} with sample: ${sampleName}`, async function (): Promise { + await testWorkspaceStartup(editor.xpath, editor.type, sampleName, false); + }); + }); + }); + + editorsForCheck.forEach((editor): void => { + if (BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()) { + Logger.info('Test cluster is disconnected. Using url for airgap cluster.'); + gitRepoUrlsToCheckAirgap.forEach((url): void => { + test(`Test start of ${editor.name} with ubi url: ${url}`, async function (): Promise { + await testWorkspaceStartup(editor.xpath, editor.type, url, true); + }); + }); + } else { + gitRepoUrlsToCheck.forEach((url): void => { + test(`Test start of ${editor.name} with ubi url: ${url}`, async function (): Promise { + await testWorkspaceStartup(editor.xpath, editor.type, url, true); + }); + }); + } + }); + + teardown('Delete DevWorkspace', async function (): Promise { + Logger.info('Delete DevWorkspace. After each test.'); + if (currentTabHandle !== 'undefined') { + await browserTabsUtil.switchToWindow(currentTabHandle); + } + + await dashboard.openDashboard(); + await browserTabsUtil.closeAllTabsExceptCurrent(); + + if (WorkspaceHandlingTests.getWorkspaceName() !== 'undefined') { + Logger.info('Workspace name is defined. Deleting workspace...'); + await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName()); + } + + WorkspaceHandlingTests.clearWorkspaceName(); + clearCurrentTabHandle(); + }); +}); From 11c792b8fe76543e84a16e8f3fd38c012ec4ef01 Mon Sep 17 00:00:00 2001 From: Oleksii Korniienko Date: Wed, 17 Jun 2026 17:19:43 +0200 Subject: [PATCH 2/6] Reworked StartWorkspaceUsingDesktopEditors test Signed-off-by: Oleksii Korniienko Assisted-by: Claude Code --- .../StartWorkspaceUsingDesktopEditors.spec.ts | 51 ++++++++----------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts index ea3be9b7bd6..7276ba824c9 100644 --- a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts +++ b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts @@ -27,7 +27,6 @@ suite('Check all editors with all samples', function (): void { const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); - const vsCodeDesktopSshEditor: string = '//*[@id="editor-selector-card-che-incubator/che-code-sshd/latest"]'; const useExtensionSwitcher: string = '//label[@class="switch"]'; const titleXpath: string = '//div[@class="header-title"]'; @@ -35,43 +34,37 @@ suite('Check all editors with all samples', function (): void { const pollingForCheckTitleVSCode: number = 100; const pollingForCheckTitleIntelliJ: number = 500; - const allEditors: Array<{ xpath: string; name: string; type: 'vscode' | 'intellij' }> = [ - { xpath: vsCodeDesktopSshEditor, name: 'VSCode Desktop SSH', type: 'vscode' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-clion-server/latest"]', name: 'CLion', type: 'intellij' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-goland-server/latest"]', name: 'GoLand', type: 'intellij' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-idea-server/latest"]', name: 'IntelliJ IDEA', type: 'intellij' }, - { - xpath: '//*[@id="editor-selector-card-che-incubator/che-phpstorm-server/latest"]', - name: 'PhpStorm', - type: 'intellij' - }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-pycharm-server/latest"]', name: 'PyCharm', type: 'intellij' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-rider-server/latest"]', name: 'Rider', type: 'intellij' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-rubymine-server/latest"]', name: 'RubyMine', type: 'intellij' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-webstorm-server/latest"]', name: 'WebStorm', type: 'intellij' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd-kiro/latest"]', name: 'Kiro', type: 'vscode' }, - { - xpath: '//*[@id="editor-selector-card-che-incubator/jetbrains-sshd/latest"]', - name: 'JetBrains SSH', - type: 'intellij' - } + const allEditors: Array<{ xpath: string; name: string; type: 'vscode' | 'intellij'; environmentId: string }> = [ + { xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd/latest"]', name: 'VSCode Desktop SSH', type: 'vscode', environmentId: 'VSCODE_DESKTOP_SSH' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-clion-server/latest"]', name: 'CLion', type: 'intellij', environmentId: 'CLION' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-goland-server/latest"]', name: 'GoLand', type: 'intellij', environmentId: 'GOLAND' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-idea-server/latest"]', name: 'IntelliJ IDEA', type: 'intellij', environmentId: 'INTELLIJ_IDEA' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-phpstorm-server/latest"]', name: 'PhpStorm', type: 'intellij', environmentId: 'PHPSTORM' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-pycharm-server/latest"]', name: 'PyCharm', type: 'intellij', environmentId: 'PYCHARM' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-rider-server/latest"]', name: 'Rider', type: 'intellij', environmentId: 'RIDER' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-rubymine-server/latest"]', name: 'RubyMine', type: 'intellij', environmentId: 'RUBYMINE' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-webstorm-server/latest"]', name: 'WebStorm', type: 'intellij', environmentId: 'WEBSTORM' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd-kiro/latest"]', name: 'Kiro', type: 'vscode', environmentId: 'KIRO' }, + { xpath: '//*[@id="editor-selector-card-che-incubator/jetbrains-sshd/latest"]', name: 'JetBrains SSH', type: 'intellij', environmentId: 'JETBRAINS_SSH' } ]; - // filter editors based on environment variable - const selectedEditorsEnv: string = process.env.TS_SELECTED_EDITORS || 'All'; + // filter editors based on environment variables + const selectAllEditors: boolean = process.env.SELECT_ALL_EDITORS === 'true'; let editorsForCheck: Array<{ xpath: string; name: string; type: 'vscode' | 'intellij' }>; - if (selectedEditorsEnv === 'All') { + if (selectAllEditors) { editorsForCheck = allEditors; - Logger.info('Running tests for all editors'); + Logger.info('SELECT_ALL_EDITORS is true - running tests for all editors'); } else { - const selectedEditorNames: string[] = selectedEditorsEnv.split(',').map((name: string): string => name.trim()); - editorsForCheck = allEditors.filter((editor): boolean => selectedEditorNames.includes(editor.name)); + editorsForCheck = allEditors.filter((editor): boolean => { + const envValue: string | undefined = process.env[editor.environmentId]; + return envValue === 'true'; + }); Logger.info(`Running tests for selected editors: ${editorsForCheck.map((e): string => e.name).join(', ')}`); if (editorsForCheck.length === 0) { - Logger.warn(`No editors matched the selection: ${selectedEditorsEnv}`); - Logger.warn(`Available editors: ${allEditors.map((e): string => e.name).join(', ')}`); + Logger.warn('No editors selected via environment variables'); + Logger.warn(`Available environment variables: ${allEditors.map((e): string => e.environmentId).join(', ')}`); } } From 7dc4e585eb4eaae7c4e4728f1f0dfab457d48afa Mon Sep 17 00:00:00 2001 From: Oleksii Korniienko Date: Thu, 18 Jun 2026 15:47:47 +0200 Subject: [PATCH 3/6] Small fix for intellij landing page header Signed-off-by: Oleksii Korniienko --- .../StartWorkspaceUsingDesktopEditors.spec.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts index 7276ba824c9..e972eb77a82 100644 --- a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts +++ b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts @@ -28,7 +28,8 @@ suite('Check all editors with all samples', function (): void { const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); const useExtensionSwitcher: string = '//label[@class="switch"]'; - const titleXpath: string = '//div[@class="header-title"]'; + const intellijTitleXpath: string = '/html/body/h1'; + const vsCodeTitleXpath: string = '//div[@class="header-title"]'; let currentTabHandle: string = 'undefined'; const pollingForCheckTitleVSCode: number = 100; @@ -84,12 +85,14 @@ suite('Check all editors with all samples', function (): void { const gitRepoUrlsToCheck: string[] = [ 'https://github.com/crw-qe/quarkus-api-example-public/tree/ubi8-latest', - 'https://github.com/crw-qe/ubi9-based-sample-public/tree/ubi9-minimal' + 'https://github.com/crw-qe/ubi9-based-sample-public/tree/ubi9-minimal', + 'https://github.com/crw-qe/ubi10-based-sample-public/tree/main' ]; const gitRepoUrlsToCheckAirgap: string[] = [ 'https://gh.crw-qe.com/test-automation-only/ubi8/tree/ubi8-latest', - 'https://gh.crw-qe.com/test-automation-only/ubi9-based-sample-public/tree/ubi9-minimal' + 'https://gh.crw-qe.com/test-automation-only/ubi9-based-sample-public/tree/ubi9-minimal', + 'https://gh.crw-qe.com/test-automation-only/ubi10-based-sample-public/tree/main' ]; suiteSetup('Login into Che', async function (): Promise { @@ -120,6 +123,7 @@ suite('Check all editors with all samples', function (): void { await dashboard.clickCreateWorkspaceButton(); const pollingForCheckTitle: number = editorType === 'vscode' ? pollingForCheckTitleVSCode : pollingForCheckTitleIntelliJ; + const titleXpath: string = editorType === 'vscode' ? vsCodeTitleXpath : intellijTitleXpath; if (isUrl) { await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndGitUrl( From b635a711a9589ca4fa92fe0c3a5eb0d1d6864546 Mon Sep 17 00:00:00 2001 From: Oleksii Korniienko Date: Thu, 18 Jun 2026 18:45:08 +0200 Subject: [PATCH 4/6] Removed Intellij and VS Code related tests. Added EDITOR_CONSTANTS. Signed-off-by: Oleksii Korniienko Assisted-by: Claude Code --- tests/e2e/constants/EDITOR_CONSTANTS.ts | 120 ++++++++++++ tests/e2e/index.ts | 1 + .../StartWorkspaceUsingDesktopEditors.spec.ts | 42 ++-- ...rtWorkspaceUsingIntellijIdeaEditor.spec.ts | 154 --------------- ...rkspaceUsingVSCodeDesktopSshEditor.spec.ts | 180 ------------------ 5 files changed, 134 insertions(+), 363 deletions(-) create mode 100644 tests/e2e/constants/EDITOR_CONSTANTS.ts delete mode 100644 tests/e2e/specs/dashboard-samples/StartWorkspaceUsingIntellijIdeaEditor.spec.ts delete mode 100644 tests/e2e/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.ts diff --git a/tests/e2e/constants/EDITOR_CONSTANTS.ts b/tests/e2e/constants/EDITOR_CONSTANTS.ts new file mode 100644 index 00000000000..c567570e24e --- /dev/null +++ b/tests/e2e/constants/EDITOR_CONSTANTS.ts @@ -0,0 +1,120 @@ +/** ******************************************************************* + * 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 + **********************************************************************/ + +export type EditorType = 'vscode' | 'intellij'; + +export interface EditorConfig { + readonly environmentId: string; + readonly xpath: string; + readonly name: string; + readonly type: EditorType; +} + +export const ALL_EDITORS: Map = new Map([ + [ + 'VSCODE_DESKTOP_SSH_EDITOR', + { + environmentId: 'VSCODE_DESKTOP_SSH_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd/latest"]', + name: 'VSCode Desktop SSH', + type: 'vscode' + } + ], + [ + 'CLION_EDITOR', + { + environmentId: 'CLION_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-clion-server/latest"]', + name: 'CLion', + type: 'intellij' + } + ], + [ + 'GOLAND_EDITOR', + { + environmentId: 'GOLAND_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-goland-server/latest"]', + name: 'GoLand', + type: 'intellij' + } + ], + [ + 'INTELLIJ_IDEA_EDITOR', + { + environmentId: 'INTELLIJ_IDEA_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-idea-server/latest"]', + name: 'IntelliJ IDEA', + type: 'intellij' + } + ], + [ + 'PHPSTORM_EDITOR', + { + environmentId: 'PHPSTORM_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-phpstorm-server/latest"]', + name: 'PhpStorm', + type: 'intellij' + } + ], + [ + 'PYCHARM_EDITOR', + { + environmentId: 'PYCHARM_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-pycharm-server/latest"]', + name: 'PyCharm', + type: 'intellij' + } + ], + [ + 'RIDER_EDITOR', + { + environmentId: 'RIDER_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-rider-server/latest"]', + name: 'Rider', + type: 'intellij' + } + ], + [ + 'RUBYMINE_EDITOR', + { + environmentId: 'RUBYMINE_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-rubymine-server/latest"]', + name: 'RubyMine', + type: 'intellij' + } + ], + [ + 'WEBSTORM_EDITOR', + { + environmentId: 'WEBSTORM_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-webstorm-server/latest"]', + name: 'WebStorm', + type: 'intellij' + } + ], + [ + 'KIRO_EDITOR', + { + environmentId: 'KIRO_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd-kiro/latest"]', + name: 'Kiro', + type: 'vscode' + } + ], + [ + 'JETBRAINS_SSH_EDITOR', + { + environmentId: 'JETBRAINS_SSH_EDITOR', + xpath: '//*[@id="editor-selector-card-che-incubator/jetbrains-sshd/latest"]', + name: 'JetBrains SSH', + type: 'intellij' + } + ] +]); diff --git a/tests/e2e/index.ts b/tests/e2e/index.ts index 72c2834aa0f..99713138654 100644 --- a/tests/e2e/index.ts +++ b/tests/e2e/index.ts @@ -57,6 +57,7 @@ export * from './tests-library/WorkspaceHandlingTests'; export * from './constants/API_TEST_CONSTANTS'; export * from './constants/BASE_TEST_CONSTANTS'; export * from './constants/CHROME_DRIVER_CONSTANTS'; +export * from './constants/EDITOR_CONSTANTS'; export * from './constants/FACTORY_TEST_CONSTANTS'; export * from './constants/MOCHA_CONSTANTS'; export * from './constants/MONACO_CONSTANTS'; diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts index e972eb77a82..4fb7537554f 100644 --- a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts +++ b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts @@ -14,10 +14,11 @@ import { LoginTests } from '../../tests-library/LoginTests'; import { Dashboard } from '../../pageobjects/dashboard/Dashboard'; import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests'; -import { expect } from 'chai'; +import { assert, expect } from 'chai'; import { Logger } from '../../utils/Logger'; import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; import { DriverHelper } from '../../utils/DriverHelper'; +import { EditorConfig, ALL_EDITORS } from '../../constants/EDITOR_CONSTANTS'; suite('Check all editors with all samples', function (): void { this.timeout(24000000); @@ -35,37 +36,22 @@ suite('Check all editors with all samples', function (): void { const pollingForCheckTitleVSCode: number = 100; const pollingForCheckTitleIntelliJ: number = 500; - const allEditors: Array<{ xpath: string; name: string; type: 'vscode' | 'intellij'; environmentId: string }> = [ - { xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd/latest"]', name: 'VSCode Desktop SSH', type: 'vscode', environmentId: 'VSCODE_DESKTOP_SSH' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-clion-server/latest"]', name: 'CLion', type: 'intellij', environmentId: 'CLION' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-goland-server/latest"]', name: 'GoLand', type: 'intellij', environmentId: 'GOLAND' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-idea-server/latest"]', name: 'IntelliJ IDEA', type: 'intellij', environmentId: 'INTELLIJ_IDEA' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-phpstorm-server/latest"]', name: 'PhpStorm', type: 'intellij', environmentId: 'PHPSTORM' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-pycharm-server/latest"]', name: 'PyCharm', type: 'intellij', environmentId: 'PYCHARM' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-rider-server/latest"]', name: 'Rider', type: 'intellij', environmentId: 'RIDER' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-rubymine-server/latest"]', name: 'RubyMine', type: 'intellij', environmentId: 'RUBYMINE' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-webstorm-server/latest"]', name: 'WebStorm', type: 'intellij', environmentId: 'WEBSTORM' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/che-code-sshd-kiro/latest"]', name: 'Kiro', type: 'vscode', environmentId: 'KIRO' }, - { xpath: '//*[@id="editor-selector-card-che-incubator/jetbrains-sshd/latest"]', name: 'JetBrains SSH', type: 'intellij', environmentId: 'JETBRAINS_SSH' } - ]; - // filter editors based on environment variables const selectAllEditors: boolean = process.env.SELECT_ALL_EDITORS === 'true'; - let editorsForCheck: Array<{ xpath: string; name: string; type: 'vscode' | 'intellij' }>; + let editorsForCheck: EditorConfig[]; if (selectAllEditors) { - editorsForCheck = allEditors; + editorsForCheck = Array.from(ALL_EDITORS.values()); Logger.info('SELECT_ALL_EDITORS is true - running tests for all editors'); } else { - editorsForCheck = allEditors.filter((editor): boolean => { + editorsForCheck = Array.from(ALL_EDITORS.values()).filter((editor): boolean => { const envValue: string | undefined = process.env[editor.environmentId]; return envValue === 'true'; }); Logger.info(`Running tests for selected editors: ${editorsForCheck.map((e): string => e.name).join(', ')}`); if (editorsForCheck.length === 0) { - Logger.warn('No editors selected via environment variables'); - Logger.warn(`Available environment variables: ${allEditors.map((e): string => e.environmentId).join(', ')}`); + assert.fail('No editors selected via environment variables'); } } @@ -157,26 +143,26 @@ suite('Check all editors with all samples', function (): void { // checks for "Install extensions" state expect(pageTextBeforeUseExtensionSwitcher).contains('Install the following VS Code extensions'); - Logger.info('"Install the following VS Code extensions" was found in page before "Use Extension" clicked'); + Logger.debug('"Install the following VS Code extensions" was found in page before "Use Extension" clicked'); expect(pageTextBeforeUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); - Logger.info( + Logger.debug( 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found before "Use Extension" clicked' ); // checks for SSH state expect(pageTextAfterUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); - Logger.info( + Logger.debug( 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found after "Use Extension" clicked' ); expect(pageTextAfterUseExtensionSwitcher).contains('oc port-forward -n admin-devspaces'); - Logger.info('"oc port-forward -n admin-devspaces" was found after "Use Extension" clicked'); + Logger.debug('"oc port-forward -n admin-devspaces" was found'); expect(pageTextAfterUseExtensionSwitcher) .contains('-----BEGIN OPENSSH PRIVATE KEY-----') .and.contains('-----END OPENSSH PRIVATE KEY-----'); - Logger.info('SSH private key (BEGIN and END markers) was found after "Use Extension" clicked'); + Logger.debug('SSH private key (BEGIN and END markers) was found'); expect(pageTextAfterUseExtensionSwitcher) .contains('HostName') @@ -184,14 +170,12 @@ suite('Check all editors with all samples', function (): void { .and.contains('Port') .and.contains('IdentityFile') .and.contains('UserKnownHostsFile'); - Logger.info( - 'SSH config parameters (HostName, User, Port, IdentityFile, UserKnownHostsFile) were found after "Use Extension" clicked' - ); + Logger.debug('SSH config parameters (HostName, User, Port, IdentityFile, UserKnownHostsFile) were found'); } else { // check title for IntelliJ editors const headerText: string = await workspaceHandlingTests.getTextFromUIElementByXpath(titleXpath); expect('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running').equal(headerText); - Logger.info('Workspace title verified for IntelliJ editor: ' + headerText); + Logger.debug('Workspace title verified for IntelliJ editor: ' + headerText); } } diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingIntellijIdeaEditor.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingIntellijIdeaEditor.spec.ts deleted file mode 100644 index fe65d976f48..00000000000 --- a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingIntellijIdeaEditor.spec.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** ******************************************************************* - * 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 { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor'; -import fs from 'fs'; -import path from 'path'; -import YAML from 'yaml'; -import { e2eContainer } from '../../configs/inversify.config'; -import { CLASSES } from '../../configs/inversify.types'; -import { LoginTests } from '../../tests-library/LoginTests'; -import { Dashboard } from '../../pageobjects/dashboard/Dashboard'; -import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; -import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests'; -import { expect } from 'chai'; -import { Logger } from '../../utils/Logger'; -import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; - -suite('Check Intellij IDE desktop Editor with all samples', function (): void { - this.timeout(24000000); - const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); - const pathToSampleFile: string = path.resolve('resources/default-devfile.yaml'); - const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name; - const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get( - CLASSES.KubernetesCommandLineToolsExecutor - ); - kubernetesCommandLineToolsExecutor.workspaceName = workspaceName; - const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); - const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard); - const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); - - const titleXpath: string = '/html/body/h1'; - let currentTabHandle: string = 'undefined'; - - const pollingForCheckTitle: number = 500; - - const editorsForCheck: string[] = [ - '//*[@id="editor-selector-card-che-incubator/che-clion-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/che-goland-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/che-idea-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/che-phpstorm-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/che-pycharm-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/che-rider-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/che-rubymine-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/che-webstorm-server/latest"]', - '//*[@id="editor-selector-card-che-incubator/jetbrains-sshd/latest"]' - ]; - - const samplesForCheck: string[] = [ - 'Empty Workspace', - 'JBoss EAP 8.0', - 'Java Lombok', - 'Node.js Express', - 'Python', - 'Quarkus REST API', - '.NET', - 'Ansible', - 'C/C++', - 'Go', - 'PHP' - ]; - - const gitRepoUrlsToCheck: string[] = [ - 'https://github.com/crw-qe/quarkus-api-example-public/tree/ubi8-latest', - 'https://github.com/crw-qe/ubi9-based-sample-public/tree/ubi9-minimal' - ]; - - const gitRepoUrlsToCheckAirgap: string[] = [ - 'https://gh.crw-qe.com/test-automation-only/ubi8/tree/ubi8-latest', - 'https://gh.crw-qe.com/test-automation-only/ubi9-based-sample-public/tree/ubi9-minimal' - ]; - - function clearCurrentTabHandle(): void { - currentTabHandle = 'undefined'; - } - - suiteSetup('Login into Che', async function (): Promise { - await loginTests.loginIntoChe(); - }); - - async function testWorkspaceStartup(editorXpath: string, sampleNameOrUrl: string, isUrl: boolean): Promise { - await dashboard.openDashboard(); - currentTabHandle = await browserTabsUtil.getCurrentWindowHandle(); - await dashboard.clickCreateWorkspaceButton(); - - if (isUrl) { - await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndGitUrl( - editorXpath, - sampleNameOrUrl, - titleXpath, - pollingForCheckTitle - ); - } else { - await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndSample( - editorXpath, - sampleNameOrUrl, - titleXpath, - pollingForCheckTitle - ); - } - - // check title - const headerText: string = await workspaceHandlingTests.getTextFromUIElementByXpath(titleXpath); - expect('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running').equal(headerText); - } - - editorsForCheck.forEach((editorXpath): void => { - samplesForCheck.forEach((sampleName): void => { - test(`Test start of Editor with xPath: ${editorXpath} and with sample name: ${sampleName}`, async function (): Promise { - await testWorkspaceStartup(editorXpath, sampleName, false); - }); - }); - }); - - editorsForCheck.forEach((editorXpath): void => { - if (BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()) { - gitRepoUrlsToCheckAirgap.forEach((gitUbiUrl): void => { - test(`Test start of Editor with xPath: ${editorXpath} and with ubi url: ${gitUbiUrl}`, async function (): Promise { - await testWorkspaceStartup(editorXpath, gitUbiUrl, true); - }); - }); - } else { - gitRepoUrlsToCheck.forEach((gitUbiUrl): void => { - test(`Test start of Editor with xPath: ${editorXpath} and with ubi url: ${gitUbiUrl}`, async function (): Promise { - await testWorkspaceStartup(editorXpath, gitUbiUrl, true); - }); - }); - } - }); - - teardown('Delete DevWorkspace', async function (): Promise { - Logger.info('Delete DevWorkspace. After each test.'); - if (currentTabHandle !== 'undefined') { - await browserTabsUtil.switchToWindow(currentTabHandle); - } - - await dashboard.openDashboard(); - await browserTabsUtil.closeAllTabsExceptCurrent(); - - if (WorkspaceHandlingTests.getWorkspaceName() !== 'undefined') { - Logger.info('Workspace name is defined. Deleting workspace...'); - await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName()); - } - - WorkspaceHandlingTests.clearWorkspaceName(); - clearCurrentTabHandle(); - }); -}); diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.ts deleted file mode 100644 index 808b65adfc8..00000000000 --- a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.ts +++ /dev/null @@ -1,180 +0,0 @@ -/** ******************************************************************* - * 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 { e2eContainer } from '../../configs/inversify.config'; -import { CLASSES } from '../../configs/inversify.types'; -import { LoginTests } from '../../tests-library/LoginTests'; -import { Dashboard } from '../../pageobjects/dashboard/Dashboard'; -import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; -import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests'; -import { expect } from 'chai'; -import { Logger } from '../../utils/Logger'; -import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; -import { DriverHelper } from '../../utils/DriverHelper'; - -suite('Check Visual Studio Code (desktop) (SSH) with all samples', function (): void { - this.timeout(6000000); - const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); - const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); - const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard); - const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); - const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); - - const vsCodeDesktopSshEditor: string = '//*[@id="editor-selector-card-che-incubator/che-code-sshd/latest"]'; - const useExtensionSwitcher: string = '//label[@class="switch"]'; - const titlexPath: string = '//div[@class="header-title"]'; - - let currentTabHandle: string = 'undefined'; - const pollingForCheckTitle: number = 100; - - const samplesForCheck: string[] = [ - 'Empty Workspace', - 'JBoss EAP 8.0', - 'Java Lombok', - 'Node.js Express', - 'Python', - 'Quarkus REST API', - '.NET', - 'Ansible', - 'C/C++', - 'Go', - 'PHP' - ]; - - const gitRepoUrlsToCheck: string[] = [ - 'https://github.com/crw-qe/quarkus-api-example-public/tree/ubi8-latest', - 'https://github.com/crw-qe/ubi9-based-sample-public/tree/ubi9-minimal' - ]; - - const gitRepoUrlsToCheckAirgap: string[] = [ - 'https://gh.crw-qe.com/test-automation-only/ubi8/tree/ubi8-latest', - 'https://gh.crw-qe.com/test-automation-only/ubi9-based-sample-public/tree/ubi9-minimal' - ]; - - suiteSetup('Login into Che', async function (): Promise { - await loginTests.loginIntoChe(); - }); - - async function clickOnElementByXpath(xpath: string): Promise { - Logger.debug(); - await driverHelper - .getDriver() - .executeScript( - `document.evaluate('${xpath}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();` - ); - } - - function clearCurrentTabHandle(): void { - currentTabHandle = 'undefined'; - } - - async function testWorkspaceStartup(sampleNameOrUrl: string, isUrl: boolean): Promise { - await dashboard.openDashboard(); - currentTabHandle = await browserTabsUtil.getCurrentWindowHandle(); - await dashboard.clickCreateWorkspaceButton(); - - if (isUrl) { - await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndGitUrl( - vsCodeDesktopSshEditor, - sampleNameOrUrl, - titlexPath, - pollingForCheckTitle - ); - } else { - await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndSample( - vsCodeDesktopSshEditor, - sampleNameOrUrl, - titlexPath, - pollingForCheckTitle - ); - } - - // read page - const pageTextBeforeUseExtensionSwitcher: string = await driverHelper.getDriver().executeScript('return document.body.innerText;'); - - // click on "Use Extension" switcher - await clickOnElementByXpath(useExtensionSwitcher); - - // read page - const pageTextAfterUseExtensionSwitcher: string = await driverHelper.getDriver().executeScript('return document.body.innerText;'); - - // checks for "Install extensions" state - expect(pageTextBeforeUseExtensionSwitcher).contains('Install the following VS Code extensions'); - Logger.info('"Install the following VS Code extensions" was found in page before "Use Extension" clicked'); - - expect(pageTextBeforeUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); - Logger.info( - 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found before "Use Extension" clicked' - ); - - // checks for SSH state - expect(pageTextAfterUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); - Logger.info( - 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found after "Use Extension" clicked' - ); - - expect(pageTextAfterUseExtensionSwitcher).contains('oc port-forward -n admin-devspaces'); - Logger.info('"oc port-forward -n admin-devspaces" was found after "Use Extension" clicked'); - - expect(pageTextAfterUseExtensionSwitcher) - .contains('-----BEGIN OPENSSH PRIVATE KEY-----') - .and.contains('-----END OPENSSH PRIVATE KEY-----'); - Logger.info('SSH private key (BEGIN and END markers) was found after "Use Extension" clicked'); - - expect(pageTextAfterUseExtensionSwitcher) - .contains('HostName') - .and.contains('User') - .and.contains('Port') - .and.contains('IdentityFile') - .and.contains('UserKnownHostsFile'); - Logger.info( - 'SSH config parameters (HostName, User, Port, IdentityFile, UserKnownHostsFile) were found after "Use Extension" clicked' - ); - } - - samplesForCheck.forEach((sampleName): void => { - test('Test start of VSCode (desktop) (SSH) with default Samples', async function (): Promise { - await testWorkspaceStartup(sampleName, false); - }); - }); - - if (BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()) { - Logger.info('Test cluster is disconnected. Using url for airgap cluster.'); - gitRepoUrlsToCheckAirgap.forEach((url): void => { - test('Test start of VSCode (desktop) (SSH) with ubi', async function (): Promise { - await testWorkspaceStartup(url, true); - }); - }); - } else { - gitRepoUrlsToCheck.forEach((url): void => { - test('Test start of VSCode (desktop) (SSH) with ubi', async function (): Promise { - await testWorkspaceStartup(url, true); - }); - }); - } - - teardown('Delete DevWorkspace', async function (): Promise { - Logger.info('Delete DevWorkspace. After each test.'); - if (currentTabHandle !== 'undefined') { - await browserTabsUtil.switchToWindow(currentTabHandle); - } - - await dashboard.openDashboard(); - await browserTabsUtil.closeAllTabsExceptCurrent(); - - if (WorkspaceHandlingTests.getWorkspaceName() !== 'undefined') { - Logger.info('Workspace name is defined. Deleting workspace...'); - await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName()); - } - - WorkspaceHandlingTests.clearWorkspaceName(); - clearCurrentTabHandle(); - }); -}); From ee17c1d359693774b3b0ad695e45394c58fad700 Mon Sep 17 00:00:00 2001 From: Oleksii Korniienko Date: Thu, 18 Jun 2026 19:27:33 +0200 Subject: [PATCH 5/6] Splited verification to different methods. Small changes. Signed-off-by: Oleksii Korniienko Assisted-by: Claude Code --- tests/e2e/constants/EDITOR_CONSTANTS.ts | 2 +- .../StartWorkspaceUsingDesktopEditors.spec.ts | 100 ++++++++++-------- 2 files changed, 54 insertions(+), 48 deletions(-) diff --git a/tests/e2e/constants/EDITOR_CONSTANTS.ts b/tests/e2e/constants/EDITOR_CONSTANTS.ts index c567570e24e..502bfda1057 100644 --- a/tests/e2e/constants/EDITOR_CONSTANTS.ts +++ b/tests/e2e/constants/EDITOR_CONSTANTS.ts @@ -113,7 +113,7 @@ export const ALL_EDITORS: Map = new Map([ { environmentId: 'JETBRAINS_SSH_EDITOR', xpath: '//*[@id="editor-selector-card-che-incubator/jetbrains-sshd/latest"]', - name: 'JetBrains SSH', + name: 'JetBrains Toolbox App', type: 'intellij' } ] diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts index 4fb7537554f..fd32a80ddad 100644 --- a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts +++ b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts @@ -98,6 +98,57 @@ suite('Check all editors with all samples', function (): void { currentTabHandle = 'undefined'; } + async function verifyVSCodeEditor(): Promise { + Logger.debug(); + + const pageTextBeforeUseExtensionSwitcher: string = await driverHelper + .getDriver() + .executeScript('return document.body.innerText;'); + + await clickOnElementByXpath(useExtensionSwitcher); + + const pageTextAfterUseExtensionSwitcher: string = await driverHelper + .getDriver() + .executeScript('return document.body.innerText;'); + + expect(pageTextBeforeUseExtensionSwitcher).contains('Install the following VS Code extensions'); + Logger.debug('"Install the following VS Code extensions" was found in page before "Use Extension" clicked'); + + expect(pageTextBeforeUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); + Logger.debug( + 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found before "Use Extension" clicked' + ); + + expect(pageTextAfterUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); + Logger.debug( + 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found after "Use Extension" clicked' + ); + + expect(pageTextAfterUseExtensionSwitcher).contains('oc port-forward -n admin-devspaces'); + Logger.debug('"oc port-forward -n admin-devspaces" was found'); + + expect(pageTextAfterUseExtensionSwitcher) + .contains('-----BEGIN OPENSSH PRIVATE KEY-----') + .and.contains('-----END OPENSSH PRIVATE KEY-----'); + Logger.debug('SSH private key (BEGIN and END markers) was found'); + + expect(pageTextAfterUseExtensionSwitcher) + .contains('HostName') + .and.contains('User') + .and.contains('Port') + .and.contains('IdentityFile') + .and.contains('UserKnownHostsFile'); + Logger.debug('SSH config parameters (HostName, User, Port, IdentityFile, UserKnownHostsFile) were found'); + } + + async function verifyIntelliJEditor(titleXpath: string): Promise { + Logger.debug(); + + const headerText: string = await workspaceHandlingTests.getTextFromUIElementByXpath(titleXpath); + expect('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running').equal(headerText); + Logger.debug('Workspace title verified for IntelliJ editor: ' + headerText); + } + async function testWorkspaceStartup( editorXpath: string, editorType: 'vscode' | 'intellij', @@ -128,54 +179,9 @@ suite('Check all editors with all samples', function (): void { } if (editorType === 'vscode') { - // read page - const pageTextBeforeUseExtensionSwitcher: string = await driverHelper - .getDriver() - .executeScript('return document.body.innerText;'); - - // click on "Use Extension" switcher - await clickOnElementByXpath(useExtensionSwitcher); - - // read page - const pageTextAfterUseExtensionSwitcher: string = await driverHelper - .getDriver() - .executeScript('return document.body.innerText;'); - - // checks for "Install extensions" state - expect(pageTextBeforeUseExtensionSwitcher).contains('Install the following VS Code extensions'); - Logger.debug('"Install the following VS Code extensions" was found in page before "Use Extension" clicked'); - - expect(pageTextBeforeUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); - Logger.debug( - 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found before "Use Extension" clicked' - ); - - // checks for SSH state - expect(pageTextAfterUseExtensionSwitcher).contains('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running'); - Logger.debug( - 'Workspace name "' + WorkspaceHandlingTests.getWorkspaceName() + ' is running" was found after "Use Extension" clicked' - ); - - expect(pageTextAfterUseExtensionSwitcher).contains('oc port-forward -n admin-devspaces'); - Logger.debug('"oc port-forward -n admin-devspaces" was found'); - - expect(pageTextAfterUseExtensionSwitcher) - .contains('-----BEGIN OPENSSH PRIVATE KEY-----') - .and.contains('-----END OPENSSH PRIVATE KEY-----'); - Logger.debug('SSH private key (BEGIN and END markers) was found'); - - expect(pageTextAfterUseExtensionSwitcher) - .contains('HostName') - .and.contains('User') - .and.contains('Port') - .and.contains('IdentityFile') - .and.contains('UserKnownHostsFile'); - Logger.debug('SSH config parameters (HostName, User, Port, IdentityFile, UserKnownHostsFile) were found'); + await verifyVSCodeEditor(); } else { - // check title for IntelliJ editors - const headerText: string = await workspaceHandlingTests.getTextFromUIElementByXpath(titleXpath); - expect('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running').equal(headerText); - Logger.debug('Workspace title verified for IntelliJ editor: ' + headerText); + await verifyIntelliJEditor(titleXpath); } } From 8f56d33b9bbf83cda6f70a3c35bfa2fa60f2c4f4 Mon Sep 17 00:00:00 2001 From: Oleksii Korniienko Date: Thu, 18 Jun 2026 20:14:17 +0200 Subject: [PATCH 6/6] Prettier fixes Signed-off-by: Oleksii Korniienko --- .../StartWorkspaceUsingDesktopEditors.spec.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts index fd32a80ddad..2bf18cb08a6 100644 --- a/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts +++ b/tests/e2e/specs/dashboard-samples/StartWorkspaceUsingDesktopEditors.spec.ts @@ -101,16 +101,12 @@ suite('Check all editors with all samples', function (): void { async function verifyVSCodeEditor(): Promise { Logger.debug(); - const pageTextBeforeUseExtensionSwitcher: string = await driverHelper - .getDriver() - .executeScript('return document.body.innerText;'); + const pageTextBeforeUseExtensionSwitcher: string = await driverHelper.getDriver().executeScript('return document.body.innerText;'); await clickOnElementByXpath(useExtensionSwitcher); - const pageTextAfterUseExtensionSwitcher: string = await driverHelper - .getDriver() - .executeScript('return document.body.innerText;'); - + const pageTextAfterUseExtensionSwitcher: string = await driverHelper.getDriver().executeScript('return document.body.innerText;'); + expect(pageTextBeforeUseExtensionSwitcher).contains('Install the following VS Code extensions'); Logger.debug('"Install the following VS Code extensions" was found in page before "Use Extension" clicked');