-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create CreateWorkspaceWithExistedName e2e test
- Loading branch information
1 parent
a5a0151
commit d99df87
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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
79 changes: 79 additions & 0 deletions
79
tests/e2e/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts
This file contains 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,79 @@ | ||
/** ******************************************************************* | ||
* copyright (c) 2020-2023 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, SideBarView, ViewItem } 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'; | ||
|
||
const stackName: string = BASE_TEST_CONSTANTS.TS_SELENIUM_DASHBOARD_SAMPLE_NAME || 'Python'; | ||
const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || 'python-hello-world'; | ||
|
||
suite(`"Existing workspace found" test`, 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); | ||
let projectSection: ViewSection; | ||
let existedWorkspaceName: string; | ||
|
||
loginTests.loginIntoChe(); | ||
|
||
test(`Create and open new workspace, stack:${stackName}`, async function (): Promise<void> { | ||
await workspaceHandlingTests.createAndOpenWorkspace(stackName); | ||
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); | ||
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName()); | ||
}); | ||
|
||
test('Wait workspace readiness and project folder has been created', async function (): Promise<void> { | ||
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); | ||
projectSection = await new SideBarView().getContent().getSection(projectName); | ||
const isFileImported: ViewItem | undefined = await projectSection.findItem(BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME); | ||
expect(isFileImported).not.eqls(undefined); | ||
}); | ||
|
||
test(`Create new workspace from the same ${stackName} stack`, async function (): Promise<void> { | ||
existedWorkspaceName = WorkspaceHandlingTests.getWorkspaceName(); | ||
|
||
await browserTabsUtil.navigateTo(BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL); | ||
await dashboard.waitPage(); | ||
await workspaceHandlingTests.createAndOpenWorkspaceWithExistedWorkspaceName(stackName); | ||
await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); | ||
registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName()); | ||
}); | ||
|
||
test('Wait the second workspace readiness and project folder has been created', async function (): Promise<void> { | ||
await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); | ||
projectSection = await new SideBarView().getContent().getSection(projectName); | ||
const isFileImported: ViewItem | undefined = await projectSection.findItem(BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME); | ||
expect(isFileImported).not.eqls(undefined); | ||
}); | ||
|
||
test(`Stop all created ${stackName} workspaces`, async function (): Promise<void> { | ||
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName()); | ||
await workspaceHandlingTests.stopWorkspace(existedWorkspaceName); | ||
await browserTabsUtil.closeAllTabsExceptCurrent(); | ||
}); | ||
|
||
test(`Delete all created ${stackName} workspaces`, async function (): Promise<void> { | ||
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName()); | ||
await workspaceHandlingTests.removeWorkspace(existedWorkspaceName); | ||
}); | ||
|
||
loginTests.logoutFromChe(); | ||
}); |
This file contains 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