From f46c04311e66771489b8588678bc3c6d7df92a85 Mon Sep 17 00:00:00 2001 From: Skoryk Serhii Date: Wed, 1 Jan 2025 15:01:49 +0200 Subject: [PATCH 1/2] Check ssh address of private repo with SSH key with no PAT --- .../SshFactoryWithoutPAT.spec.ts | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tests/e2e/specs/miscellaneous/SshFactoryWithoutPAT.spec.ts diff --git a/tests/e2e/specs/miscellaneous/SshFactoryWithoutPAT.spec.ts b/tests/e2e/specs/miscellaneous/SshFactoryWithoutPAT.spec.ts new file mode 100644 index 00000000000..dcb4b276449 --- /dev/null +++ b/tests/e2e/specs/miscellaneous/SshFactoryWithoutPAT.spec.ts @@ -0,0 +1,74 @@ +/** ******************************************************************* + * copyright (c) 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 { ViewSection } from 'monaco-page-objects'; +import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests'; +import { CLASSES } from '../../configs/inversify.types'; +import { e2eContainer } from '../../configs/inversify.config'; +import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests'; +import { registerRunningWorkspace } from '../MochaHooks'; +import { LoginTests } from '../../tests-library/LoginTests'; +import { StringUtil } from '../../utils/StringUtil'; +import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS'; +import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; +import { expect } from 'chai'; +import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS'; +import { Dashboard } from '../../pageobjects/dashboard/Dashboard'; + +suite(`The SshFactoryWithoutPAT userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void { + const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); + const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); + const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests); + const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); + const factoryUrl: string = + FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL.length === 0 + ? BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL + '/dashboard/#/' + 'git@github.com:crw-qe/private-repo-check.git' + : BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL + '/dashboard/#/' + FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL; + + const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard); + + let projectSection: ViewSection; + suite(`Create workspace from factory:${factoryUrl}`, function (): void { + suiteSetup('Login', async function (): Promise { + await loginTests.loginIntoChe(); + }); + + test('Check creating workspace using default devfile', async function (): Promise { + await browserTabsUtil.navigateTo(factoryUrl); + await dashboard.waitLoader(); + await dashboard.clickContinueWithDefaultDevfileButton(); + await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); + registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName()); + await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); + }); + + test('Check a project folder has been created', async function (): Promise { + const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || StringUtil.getProjectNameFromGitUrl(factoryUrl); + projectSection = await projectAndFileTests.getProjectViewSession(); + expect(await projectAndFileTests.getProjectTreeItem(projectSection, projectName), 'Project folder was not imported').not + .undefined; + }); + test('Check the project files was imported', async function (): Promise { + expect( + await projectAndFileTests.getProjectTreeItem(projectSection, BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME), + 'Project files were not imported' + ).not.undefined; + }); + test('Stop the workspace by UI', async function (): Promise { + await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName()); + await browserTabsUtil.closeAllTabsExceptCurrent(); + }); + test('Delete the workspace by UI', async function (): Promise { + await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName()); + }); + suiteTeardown('Unregister running workspace', function (): void { + registerRunningWorkspace(''); + }); + }); +}); From 142f8c8f92f66a0e52f9dd3ab49c3537450cbd44 Mon Sep 17 00:00:00 2001 From: Skoryk Serhii Date: Wed, 1 Jan 2025 15:27:00 +0200 Subject: [PATCH 2/2] increase timeout --- tests/e2e/pageobjects/dashboard/Dashboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/pageobjects/dashboard/Dashboard.ts b/tests/e2e/pageobjects/dashboard/Dashboard.ts index 3bd48875b3f..c2bab7f3fc2 100644 --- a/tests/e2e/pageobjects/dashboard/Dashboard.ts +++ b/tests/e2e/pageobjects/dashboard/Dashboard.ts @@ -185,7 +185,7 @@ export class Dashboard { await this.driverHelper.waitDisappearance(Dashboard.USER_SETTINGS_DROPDOWN, timeout); } - async clickContinueWithDefaultDevfileButton(timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise { + async clickContinueWithDefaultDevfileButton(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise { Logger.debug(); await this.driverHelper.waitAndClick(Dashboard.CONTINUE_WITH_DEFAULT_DEVFILE_BUTTON, timeout);