-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Automates "start workspace using IntelliJ IDEA Editors" test #23765
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
Merged
+175
−8
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4ccb6de
Added option to change polling for waitVisibility
olkornii 019c5a1
added StartWorkspaceUsingIntellijIdeEditor test
olkornii 9587d1b
Small fixes
olkornii 2f15dc1
added all samples to the list
olkornii fe5c205
small fixes
olkornii af3d64a
every test is independent
olkornii 06d8d6b
small fixes
olkornii 06edac1
Small fixes.
olkornii e94d5a2
Removed workspace name related changes from StartWorkspaceUsingIntell…
olkornii 6efdcc6
small fixes
olkornii e80b42a
removed comment
olkornii bc76f2b
removed unnecessary code.
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
154 changes: 154 additions & 0 deletions
154
tests/e2e/specs/dashboard-samples/StartWorkspaceUsingIntellijIdeaEditor.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,154 @@ | ||
| /** ******************************************************************* | ||
| * 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<void> { | ||
| await loginTests.loginIntoChe(); | ||
| }); | ||
|
|
||
| async function testWorkspaceStartup(editorXpath: string, sampleNameOrUrl: string, isUrl: boolean): Promise<void> { | ||
| await dashboard.openDashboard(); | ||
| currentTabHandle = await browserTabsUtil.getCurrentWindowHandle(); | ||
|
|
||
| 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<void> { | ||
| await testWorkspaceStartup(editorXpath, sampleName, false); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| editorsForCheck.forEach((editorXpath): void => { | ||
| if (BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED()) { | ||
| Logger.info('Test cluster is disconnected. Using url for airgap cluster.'); | ||
| gitRepoUrlsToCheckAirgap.forEach((gitUbiUrl): void => { | ||
| test(`Test start of Editor with xPath: ${editorXpath} and with ubi url: ${gitUbiUrl}`, async function (): Promise<void> { | ||
| 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<void> { | ||
| await testWorkspaceStartup(editorXpath, gitUbiUrl, true); | ||
| }); | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| teardown('Delete DevWorkspace', async function (): Promise<void> { | ||
| Logger.info('Delete DevWorkspace. After each test.'); | ||
| if (currentTabHandle !== 'undefined') { | ||
| await browserTabsUtil.switchToWindow(currentTabHandle); | ||
| } | ||
|
dmytro-ndp marked this conversation as resolved.
|
||
|
|
||
| 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(); | ||
| }); | ||
| }); | ||
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
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
Oops, something went wrong.
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.