Skip to content

Commit

Permalink
Clean up Che Theia specific tests and page objects from Eclipse Che t…
Browse files Browse the repository at this point in the history
…ypescript functional tests #22043

Signed-off-by: mdolhalo <mdolhalo@redhat.com>
  • Loading branch information
Maryna Dolhalova committed Mar 9, 2023
1 parent 2ea6d4c commit 9e32c78
Show file tree
Hide file tree
Showing 160 changed files with 462 additions and 8,525 deletions.
2 changes: 1 addition & 1 deletion .devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2022 Red Hat, Inc.
# Copyright (c) 2022-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/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/contributing-repositories-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020 Red Hat, Inc.
# 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/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typescript-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021 Red Hat, Inc.
# Copyright (c) 2021-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/
Expand Down
2 changes: 1 addition & 1 deletion .repositories-update-contributing.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (c) 2020 Red Hat, Inc.
# 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/
Expand Down
2 changes: 1 addition & 1 deletion make-release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2021 Red Hat, Inc.
# Copyright (c) 2021-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/
Expand Down
2 changes: 1 addition & 1 deletion tests/devworkspace-happy-path/common.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2012-2021 Red Hat, Inc.
# Copyright (c) 2012-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/
Expand Down
2 changes: 1 addition & 1 deletion tests/devworkspace-happy-path/launch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2012-2021 Red Hat, Inc.
# Copyright (c) 2012-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/
Expand Down
2 changes: 1 addition & 1 deletion tests/devworkspace-happy-path/remote-launch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2012-2021 Red Hat, Inc.
# Copyright (c) 2012-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/
Expand Down
88 changes: 88 additions & 0 deletions tests/e2e/configs/inversify.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*********************************************************************
* Copyright (c) 2019-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 'reflect-metadata';
import { Container } from 'inversify';
import { IDriver } from '../driver/IDriver';
import { ChromeDriver } from '../driver/ChromeDriver';
import { TYPES, CLASSES } from './inversify.types';
import { TestWorkspaceUtil } from '../utils/workspace/TestWorkspaceUtil';
import { IOcpLoginPage } from '../pageobjects/login/IOcpLoginPage';
import { OcpUserLoginPage } from '../pageobjects/login/OcpUserLoginPage';
import { TestConstants } from '../constants/TestConstants';
import { ICheLoginPage } from '../pageobjects/login/ICheLoginPage';
import { RegularUserOcpCheLoginPage } from '../pageobjects/login/RegularUserOcpCheLoginPage';
import { MultiUserLoginPage } from '../pageobjects/login/MultiUserLoginPage';
import { DriverHelper } from '../utils/DriverHelper';
import { Dashboard } from '../pageobjects/dashboard/Dashboard';
import { Workspaces } from '../pageobjects/dashboard/Workspaces';
import { WorkspaceDetails } from '../pageobjects/dashboard/workspace-details/WorkspaceDetails';
import { WorkspaceDetailsPlugins } from '../pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins';
import { ScreenCatcher } from '../utils/ScreenCatcher';
import { OcpLoginPage } from '../pageobjects/openshift/OcpLoginPage';
import { CheLoginPage } from '../pageobjects/openshift/CheLoginPage';
import { IAuthorizationHeaderHandler } from '../utils/request-handlers/headers/IAuthorizationHeaderHandler';
import { CheMultiuserAuthorizationHeaderHandler } from '../utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler';
import { CheMultiuserTokenHandler } from '../utils/request-handlers/tokens/CheMultiuserTokenHandler';
import { ITokenHandler } from '../utils/request-handlers/tokens/ITokenHandler';
import { CheApiRequestHandler } from '../utils/request-handlers/CheApiRequestHandler';
import { CheGitApi } from '../utils/vsc/CheGitApi';
import { GitHubUtil } from '../utils/vsc/github/GitHubUtil';
import { CreateWorkspace } from '../pageobjects/dashboard/CreateWorkspace';
import { UpdateAccountInformationPage } from '../pageobjects/login/UpdateAccountInformationPage';
import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
import { WorkspaceHandlingTests } from '../tests-library/WorkspaceHandlingTests';
import { GitLoginPage } from '../pageobjects/third-parties/GitLoginPage';
import { GitOauthAppsSettings } from '../pageobjects/third-parties/GitOauthAppsSettings';
import { WorkspaceNameHandler } from '../utils/WorkspaceNameHandler';
import { Sanitizer } from '../utils/Sanitizer';
import { ApiUrlResolver } from '../utils/workspace/ApiUrlResolver';
import { ITestWorkspaceUtil } from '../utils/workspace/ITestWorkspaceUtil';
import { ProjectAndFileTests } from '../tests-library/ProjectAndFileTests';
import { LoginTests } from '../tests-library/LoginTests';

const e2eContainer: Container = new Container({ defaultScope: 'Transient' });

e2eContainer.bind<IDriver>(TYPES.Driver).to(ChromeDriver).inSingletonScope();
e2eContainer.bind<ITestWorkspaceUtil>(TYPES.WorkspaceUtil).to(TestWorkspaceUtil);
e2eContainer.bind<IOcpLoginPage>(TYPES.OcpLogin).to(OcpUserLoginPage);
e2eContainer.bind<IAuthorizationHeaderHandler>(TYPES.IAuthorizationHeaderHandler).to(CheMultiuserAuthorizationHeaderHandler);
e2eContainer.bind<ITokenHandler>(TYPES.ITokenHandler).to(CheMultiuserTokenHandler);

if (JSON.parse(TestConstants.TS_SELENIUM_VALUE_OPENSHIFT_OAUTH)) {
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(RegularUserOcpCheLoginPage);
} else {
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(MultiUserLoginPage);
}

e2eContainer.bind<BrowserTabsUtil>(CLASSES.BrowserTabsUtil).to(BrowserTabsUtil);
e2eContainer.bind<DriverHelper>(CLASSES.DriverHelper).to(DriverHelper);
e2eContainer.bind<Dashboard>(CLASSES.Dashboard).to(Dashboard);
e2eContainer.bind<Workspaces>(CLASSES.Workspaces).to(Workspaces);
e2eContainer.bind<WorkspaceDetails>(CLASSES.WorkspaceDetails).to(WorkspaceDetails);
e2eContainer.bind<WorkspaceDetailsPlugins>(CLASSES.WorkspaceDetailsPlugins).to(WorkspaceDetailsPlugins);
e2eContainer.bind<ScreenCatcher>(CLASSES.ScreenCatcher).to(ScreenCatcher);
e2eContainer.bind<OcpLoginPage>(CLASSES.OcpLoginPage).to(OcpLoginPage);
e2eContainer.bind<CheLoginPage>(CLASSES.CheLoginPage).to(CheLoginPage);
e2eContainer.bind<CheApiRequestHandler>(CLASSES.CheApiRequestHandler).to(CheApiRequestHandler);
e2eContainer.bind<CheGitApi>(CLASSES.CheGitApi).to(CheGitApi);
e2eContainer.bind<GitHubUtil>(CLASSES.GitHubUtil).to(GitHubUtil);
e2eContainer.bind<CreateWorkspace>(CLASSES.CreateWorkspace).to(CreateWorkspace);
e2eContainer.bind<UpdateAccountInformationPage>(CLASSES.UpdateAccountInformationPage).to(UpdateAccountInformationPage);
e2eContainer.bind<ProjectAndFileTests>(CLASSES.ProjectAndFileTests).to(ProjectAndFileTests);
e2eContainer.bind<LoginTests>(CLASSES.LoginTests).to(LoginTests);
e2eContainer.bind<WorkspaceNameHandler>(CLASSES.WorkspaceNameHandler).to(WorkspaceNameHandler);
e2eContainer.bind<GitLoginPage>(CLASSES.GitLoginPage).to(GitLoginPage);
e2eContainer.bind<GitOauthAppsSettings>(CLASSES.GitOauthAppsSettings).to(GitOauthAppsSettings);
e2eContainer.bind<Sanitizer>(CLASSES.Sanitizer).to(Sanitizer);
e2eContainer.bind<ApiUrlResolver>(CLASSES.ApiUrlResolver).to(ApiUrlResolver);
e2eContainer.bind<WorkspaceHandlingTests>(CLASSES.WorkspaceHandlingTests).to(WorkspaceHandlingTests);

export { e2eContainer };
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
* Copyright (c) 2019-2023 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -9,6 +8,7 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/


const TYPES = {
Driver: Symbol.for('Driver'),
CheLogin: Symbol.for('CheLogin'),
Expand Down Expand Up @@ -48,27 +48,24 @@ const CLASSES = {
CheGitApi: 'CheGitApi',
GitPlugin: 'GitPlugin',
NotificationCenter: 'NotificationCenter',
PreferencesHandlerTheia: 'PreferencesHandlerTheia',
CheApiRequestHandler: 'CheApiRequestHandler',
CreateWorkspace: 'CreateWorkspace',
OpenDialogWidget: 'OpenDialogWidget',
UpdateAccountInformationPage: 'UpdateAccountInformationPage',
KubernetesPlugin: 'KubernetesPlugin',
BrowserTabsUtil: 'BrowserTabsUtil',
PluginsView: 'PluginsView',
LanguageServerTestsTheia: 'LanguageServerTestsTheia',
CodeExecutionTestsTheia: 'CodeExecutionTestsTheia',
ProjectAndFileTestsTheia: 'ProjectAndFileTestsTheia',
ProjectAndFileTestsCheCode: 'ProjectAndFileTestsCheCode',
WorkspaceHandlingTests: 'WorkspaceHandlingTests',
ProjectAndFileTests: 'ProjectAndFileTests',
WorkspaceNameHandler: 'WorkspaceNameHandler',
GitHubPullRequestPlugin: 'GitHubPullRequestPlugin',
GitLoginPage: 'GitLoginPage',
GitOauthAppsSettings: 'GitOauthAppsSettings',
AnimationChecker: 'AnimationChecker',
Sanitizer: 'Sanitizer',
NavigationBar: 'NavigationBar',
ApiUrlResolver: 'ApiUrlResolver'
ApiUrlResolver: 'ApiUrlResolver',
LoginTests: 'LoginTests',
WorkspaceHandlingTests: 'WorkspaceHandlingTests'
};

export { TYPES, CLASSES };
14 changes: 14 additions & 0 deletions tests/e2e/configs/mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict'

module.exports = {
timeout: 1200000,
reporter: "./dist/utils/CheReporter.js",
ui: "tdd",
require: [
"./dist/specs/MochaHooks.js",
"ts-node/register"
],
bail: true,
"full-trace": true,
spec: "./dist/specs/**/**.spec.js",
}
33 changes: 33 additions & 0 deletions tests/e2e/configs/sh-scripts/generateIndex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

echo "Generating index.ts file..."
echo "import * as inversifyConfig from './configs/inversify.config';
export { inversifyConfig };
export * from './configs/inversify.types';
export * from './constants/TestConstants';
export * from './constants/TimeoutConstants';" > ./../../index.ts

listOfDirs="driver utils pageobjects tests-library"
listOfExcludes="./../../utils/CheReporter.ts"
for dir in $listOfDirs
do
files=$(find ./../../$dir -type f | sort)
for file in $files
do
case $file in *ts)
for excludedFile in $listOfExcludes
do
if [ $excludedFile == $file ]; then
continue
else
file_without_ending=${file:6:-3}
echo "export * from '$file_without_ending';" >> ./../../index.ts
fi
done
;;
*)
echo "Excluding file $file - not a typescript file"
;;
esac
done
done
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@ launchAllUserstories(){
echo ""
echo "Launching all userstories";
echo ""

npm run lint && npm run tsc && mocha --config mocha-all-devfiles-${TS_SELENIUM_EDITOR}.json ;
cd ../../
npm run lint && npm run tsc && mocha --config mocha --config configs/mocharc.js --spec dist/specs/devfiles/**.spec.js ;
}

launchSingleUserstory(){
echo ""
echo "Launching the \"${USERSTORY}\" userstory";
echo ""

tsc && mocha --config mocha-single-devfile.json --spec dist/tests/login/Login.spec.js --spec dist/tests/devfiles/${TS_SELENIUM_EDITOR}/${USERSTORY}.spec.js ;
tsc && mocha --config mocha-single-devfile.json mocha --config configs/mocharc.js --spec dist/specs/devfiles/${USERSTORY}.spec.js ;
}

checkUserstoryName(){
local checkedName="$(ls tests/devfiles/${TS_SELENIUM_EDITOR} | grep ${USERSTORY}.spec.ts)";
cd ../../
local checkedName="$(ls specs/devfiles | grep ${USERSTORY}.spec.ts)";

if [ -z "$TS_SELENIUM_EDITOR" ]; then
echo ""
echo "Variable TS_SELENIUM_EDITOR is unset."
echo ""
echo "Available values are:"
echo ""
ls tests/devfiles/ | xargs -n1 echo
ls specs/devfiles/ | xargs -n1 echo
echo ""
echo "Please assign the variable to a correct editor value."
echo ""
Expand All @@ -41,7 +42,7 @@ checkUserstoryName(){
echo ""
echo "Current value USERSTORY=\"${USERSTORY}\" doesn't match to any existed test:"
echo ""
echo "$(ls tests/devfiles | sed -e 's/.spec.ts/ /g')"
echo "$(ls specs/devfiles | sed -e 's/.spec.ts/ /g')"
echo ""
echo "Please choose one of the tests above, or unset the \"USERSTORY\" variable for launching all of them."
echo ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
* Copyright (c) 2019-2023 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*********************************************************************
* Copyright (c) 2020 Red Hat, Inc.
* 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
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/driver/ChromeDriver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
* Copyright (c) 2019-2023 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,7 +13,7 @@ import { injectable } from 'inversify';
import { ThenableWebDriver, Builder } from 'selenium-webdriver';
import { IDriver } from './IDriver';
import { Options } from 'selenium-webdriver/chrome';
import { TestConstants } from '../TestConstants';
import { TestConstants } from '../constants/TestConstants';

@injectable()
export class ChromeDriver implements IDriver {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/driver/IDriver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
* Copyright (c) 2019-2023 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down
35 changes: 0 additions & 35 deletions tests/e2e/generateIndex.sh

This file was deleted.

Loading

0 comments on commit 9e32c78

Please sign in to comment.