-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Test] Update "Create a workspace with the same name of an existing workspace from Git URL" test script #23633
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
+183
−4
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bfca672
create CreateWorkspaceWithExistedName e2e test
SkorikSergey 3fbf6f7
run lint
SkorikSergey 98549ce
fix lint error
SkorikSergey 5d44e1e
rename test, change policies.create=perclick to new
SkorikSergey cc3376f
update suites with new test name
SkorikSergey 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
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
150 changes: 150 additions & 0 deletions
150
tests/e2e/specs/miscellaneous/CreateWorkspaceWithExistingNameFromGitUrl.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,150 @@ | ||
| /** ******************************************************************* | ||
| * copyright (c) 2020-2025 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 { ViewSection } from 'monaco-page-objects'; | ||
| import { CLASSES } from '../../configs/inversify.types'; | ||
| import { expect } from 'chai'; | ||
| import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests'; | ||
| import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests'; | ||
| import { LoginTests } from '../../tests-library/LoginTests'; | ||
| import { registerRunningWorkspace } from '../MochaHooks'; | ||
| import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; | ||
| import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; | ||
| import { Dashboard } from '../../pageobjects/dashboard/Dashboard'; | ||
| import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS'; | ||
| import { CreateWorkspace } from '../../pageobjects/dashboard/CreateWorkspace'; | ||
| import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS'; | ||
|
|
||
| const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || 'python-hello-world'; | ||
|
|
||
| suite(`"Start workspace with existed workspace name" test ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { | ||
| const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); | ||
| const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); | ||
| const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); | ||
| const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); | ||
| const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard); | ||
| const createWorkspace: CreateWorkspace = e2eContainer.get(CLASSES.CreateWorkspace); | ||
|
|
||
| let projectSection: ViewSection; | ||
| let firstWorkspaceName: string; | ||
| let secondWorkspaceName: string; | ||
| const factoryUrl: string = BASE_TEST_CONSTANTS.IS_CLUSTER_DISCONNECTED() | ||
| ? FACTORY_TEST_CONSTANTS.TS_SELENIUM_AIRGAP_FACTORY_GIT_REPO_URL || 'https://gh.crw-qe.com/test-automation-only/python-hello-world' | ||
| : FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL || 'https://github.com/crw-qe/python-hello-world'; | ||
|
|
||
| suiteSetup('Login', async function (): Promise<void> { | ||
| await loginTests.loginIntoChe(); | ||
| }); | ||
|
|
||
| async function waitDashboardPage(): Promise<void> { | ||
| await dashboard.openDashboard(); | ||
| await dashboard.waitPage(); | ||
| await browserTabsUtil.closeAllTabsExceptCurrent(); | ||
|
|
||
| await dashboard.clickCreateWorkspaceButton(); | ||
| await createWorkspace.waitPage(); | ||
| expect(await createWorkspace.isCreateNewWorkspaceCheckboxChecked()).to.be.true; | ||
| } | ||
|
|
||
| async function waitWorkspaceReadiness(): Promise<void> { | ||
| const originalWindowHandle: string = await browserTabsUtil.getCurrentWindowHandle(); | ||
| await browserTabsUtil.waitAndSwitchToAnotherWindow(originalWindowHandle, TIMEOUT_CONSTANTS.TS_IDE_LOAD_TIMEOUT); | ||
|
|
||
| await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); | ||
|
|
||
| registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName()); | ||
|
|
||
| await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); | ||
| projectSection = await projectAndFileTests.getProjectViewSession(); | ||
| expect(await projectAndFileTests.getProjectTreeItem(projectSection, projectName), 'Project folder was not imported').not.undefined; | ||
| expect( | ||
| await projectAndFileTests.getProjectTreeItem(projectSection, BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME), | ||
| 'Project files were not imported' | ||
| ).not.undefined; | ||
| } | ||
|
|
||
| test('Verify "Create New" is off and a new workspace is created', async function (): Promise<void> { | ||
| await waitDashboardPage(); | ||
|
|
||
| await createWorkspace.setGitRepositoryUrl(factoryUrl); | ||
| expect(await createWorkspace.isCreateNewWorkspaceCheckboxChecked()).to.be.false; | ||
| expect(await createWorkspace.getGitRepositoryUrl()).to.be.equal(factoryUrl); | ||
| await createWorkspace.clickOnCreateAndOpenButton(); | ||
| await createWorkspace.performTrustAuthorPopup(); | ||
|
|
||
| await waitWorkspaceReadiness(); | ||
|
|
||
| firstWorkspaceName = WorkspaceHandlingTests.getWorkspaceName(); | ||
| }); | ||
|
|
||
| test('Verify existing workspace opens instead of creating a duplicate', async function (): Promise<void> { | ||
| await waitDashboardPage(); | ||
|
|
||
| await createWorkspace.setGitRepositoryUrl(factoryUrl); | ||
| expect(await createWorkspace.getGitRepositoryUrl()).to.be.equal(factoryUrl); | ||
| await createWorkspace.clickOnCreateAndOpenButton(); | ||
| await createWorkspace.performTrustAuthorPopup(); | ||
|
|
||
| await waitWorkspaceReadiness(); | ||
|
|
||
| expect(WorkspaceHandlingTests.getWorkspaceName()).to.be.equal(firstWorkspaceName); | ||
| }); | ||
|
|
||
| test('Ensure `new` is appended and a new workspace is created without warnings', async function (): Promise<void> { | ||
| await waitDashboardPage(); | ||
|
|
||
| await createWorkspace.setGitRepositoryUrl(factoryUrl); | ||
| await createWorkspace.setCreateNewWorkspaceCheckbox(true); | ||
|
|
||
| expect(await createWorkspace.getGitRepositoryUrl()).to.be.equal(factoryUrl + '?new'); | ||
|
|
||
| await createWorkspace.clickOnCreateAndOpenButton(); | ||
| await createWorkspace.performTrustAuthorPopup(); | ||
|
|
||
| await waitWorkspaceReadiness(); | ||
|
|
||
| secondWorkspaceName = WorkspaceHandlingTests.getWorkspaceName(); | ||
| // validate workspace name follows pattern: firstWorkspaceName + "-xxxx" (4 alphanumeric chars) | ||
| expect(secondWorkspaceName).to.match(new RegExp(`^${firstWorkspaceName}-[a-z0-9]{4}$`)); | ||
| }); | ||
|
|
||
| test('Verify warning appears with list of existing workspaces and open the first created workspace', async function (): Promise<void> { | ||
| await waitDashboardPage(); | ||
|
|
||
| await createWorkspace.setGitRepositoryUrl(factoryUrl); | ||
| await createWorkspace.clickOnCreateAndOpenButton(); | ||
| await createWorkspace.performTrustAuthorPopup(); | ||
| const originalWindowHandle: string = await browserTabsUtil.getCurrentWindowHandle(); | ||
| await browserTabsUtil.waitAndSwitchToAnotherWindow(originalWindowHandle, TIMEOUT_CONSTANTS.TS_IDE_LOAD_TIMEOUT); | ||
|
|
||
| await dashboard.waitExistingWorkspaceFoundAlert(); | ||
| await dashboard.startExistedWorkspace(firstWorkspaceName); | ||
|
|
||
| await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); | ||
| registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName()); | ||
|
|
||
| await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); | ||
| projectSection = await projectAndFileTests.getProjectViewSession(); | ||
| expect(await projectAndFileTests.getProjectTreeItem(projectSection, projectName), 'Project folder was not imported').not.undefined; | ||
| expect( | ||
| await projectAndFileTests.getProjectTreeItem(projectSection, BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME), | ||
| 'Project files were not imported' | ||
| ).not.undefined; | ||
| }); | ||
|
|
||
| suiteTeardown('Stop and delete all created workspaces', async function (): Promise<void> { | ||
| await workspaceHandlingTests.stopAndRemoveWorkspace(firstWorkspaceName); | ||
| await workspaceHandlingTests.stopAndRemoveWorkspace(secondWorkspaceName); | ||
| }); | ||
|
|
||
| suiteTeardown('Unregister running workspace', function (): void { | ||
| registerRunningWorkspace(''); | ||
| }); | ||
| }); |
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
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.