-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add start workspace using VSCode Desktop SSH Editor test #23679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
olkornii
wants to merge
17
commits into
eclipse-che:main
Choose a base branch
from
olkornii:CRW-9705
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+188
−1
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f45fbdd
added EditorSample test for VS Code.
olkornii 509fb39
small fixes + prettier
olkornii 619c6a0
fixed lint error
olkornii 3edcefd
one more lint error fix
olkornii 3bab796
Merge branch 'eclipse-che:main' into CRW-9705
olkornii 6c542b1
Resolved small issues
olkornii 4bc3eda
removed extra logs
olkornii 19a72d5
fixed lint errors
olkornii 98c111d
test suite teardown
olkornii 8696611
added urls for airgap cluster + reworked teardown method.
olkornii fe9c981
Merge branch 'eclipse-che:main' into CRW-9705
olkornii 0d0b9b4
Merge remote-tracking branch 'refs/remotes/origin/CRW-9705' into CRW-…
olkornii 7496707
reworked suiteTeardown. Added try/catch.
olkornii fdbee5a
prettier fixes
olkornii fbf3791
replaced stop and delete to just delete for suiteTeardown.
olkornii 0def659
reworked suiteTeardown and deleteDevworkspace
olkornii c78f37f
small fixes
olkornii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
tests/e2e/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| /** ******************************************************************* | ||
| * 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 Visual Studio Code (desktop) (SSH) with all samples', function (): void { | ||
| this.timeout(6000000); | ||
| 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 vsCodeDesktopSshEditor: string = '//*[@id="editor-selector-card-che-incubator/che-code-sshd/latest"]'; | ||
| const titlexPath: string = '/html/body/h1'; | ||
| const ocPortForwardxPath: string = '//*[@id="port-forward"]'; | ||
| const sshKeyxPath: string = '//*[@id="key"]'; | ||
| const sshKonfigxPath: string = '//*[@id="config"]'; | ||
|
|
||
| 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' | ||
| ]; | ||
|
|
||
| async function deleteWorkspace(): Promise<void> { | ||
| await dashboard.openDashboard(); | ||
| await browserTabsUtil.closeAllTabsExceptCurrent(); | ||
| await dashboard.stopAndRemoveWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName()); | ||
| WorkspaceHandlingTests.clearWorkspaceName(); | ||
| } | ||
|
|
||
| suiteSetup('Login into Che', async function (): Promise<void> { | ||
| await loginTests.loginIntoChe(); | ||
| }); | ||
|
|
||
| async function testWorkspaceStartup(sampleNameOrUrl: string, isUrl: boolean): Promise<void> { | ||
| await dashboard.openDashboard(); | ||
| if (isUrl) { | ||
| await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndGitUrl( | ||
| vsCodeDesktopSshEditor, | ||
| sampleNameOrUrl, | ||
| titlexPath | ||
| ); | ||
| } else { | ||
| await workspaceHandlingTests.createAndOpenWorkspaceWithSpecificEditorAndSample( | ||
| vsCodeDesktopSshEditor, | ||
| sampleNameOrUrl, | ||
| titlexPath | ||
| ); | ||
| } | ||
|
|
||
| // check title | ||
| const headerText: string = await workspaceHandlingTests.getTextFromUIElementByXpath(titlexPath); | ||
| expect('Workspace ' + WorkspaceHandlingTests.getWorkspaceName() + ' is running').equal(headerText); | ||
| // check oc-port-forwarding | ||
| const ocPortForward: string = await workspaceHandlingTests.getTextFromUIElementByXpath(ocPortForwardxPath); | ||
| expect(ocPortForward).contains('oc port-forward -n admin-devspaces'); | ||
| // check ssh key | ||
| const sshKey: string = await workspaceHandlingTests.getTextFromUIElementByXpath(sshKeyxPath); | ||
| expect(sshKey).contains('-----BEGIN OPENSSH PRIVATE KEY-----').and.contains('-----END OPENSSH PRIVATE KEY-----'); | ||
| // check .ssh/kofig | ||
| const sshKonfig: string = await workspaceHandlingTests.getTextFromUIElementByXpath(sshKonfigxPath); | ||
| expect(sshKonfig) | ||
| .contains('HostName') | ||
| .and.contains('User') | ||
| .and.contains('Port') | ||
| .and.contains('IdentityFile') | ||
| .and.contains('UserKnownHostsFile'); | ||
|
|
||
| await deleteWorkspace(); | ||
| } | ||
|
|
||
| test('Test start of VSCode (desktop) (SSH) with default Samples', async function (): Promise<void> { | ||
| for (const sampleName of samplesForCheck) { | ||
| await testWorkspaceStartup(sampleName, false); | ||
| } | ||
| }); | ||
|
|
||
| test('Test start of VSCode (desktop) (SSH) with ubi', async function (): Promise<void> { | ||
| if (BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()) { | ||
| Logger.info('Test cluster is disconnected. Using url for airgap cluster.'); | ||
| for (const url of gitRepoUrlsToCheckAirgap) { | ||
| await testWorkspaceStartup(url, true); | ||
| } | ||
| } else { | ||
| for (const url of gitRepoUrlsToCheck) { | ||
| await testWorkspaceStartup(url, true); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| suiteTeardown('Delete DevWorkspace', async function (): Promise<void> { | ||
| Logger.info('Deleting DevWorkspace... After all.'); | ||
| await dashboard.openDashboard(); | ||
| await browserTabsUtil.closeAllTabsExceptCurrent(); | ||
| if (WorkspaceHandlingTests.getWorkspaceName() !== 'undefined') { | ||
| await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName()); | ||
| } | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.