Skip to content
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

Add logging of class and method names into Logger #22398

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tests/e2e/configs/inversify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'reflect-metadata';
import { Container } from 'inversify';
import { IDriver } from '../driver/IDriver';
import { ChromeDriver } from '../driver/ChromeDriver';
import { TYPES, CLASSES } from './inversify.types';
import { CLASSES, TYPES } from './inversify.types';
import { TestWorkspaceUtil } from '../utils/workspace/TestWorkspaceUtil';
import { IOcpLoginPage } from '../pageobjects/login/interfaces/IOcpLoginPage';
import { OcpUserLoginPage } from '../pageobjects/login/openshift/OcpUserLoginPage';
Expand Down Expand Up @@ -73,10 +73,10 @@ e2eContainer.bind<ApiUrlResolver>(CLASSES.ApiUrlResolver).to(ApiUrlResolver);
e2eContainer.bind<WorkspaceHandlingTests>(CLASSES.WorkspaceHandlingTests).to(WorkspaceHandlingTests);
e2eContainer.bind<RedHatLoginPage>(CLASSES.RedHatLoginPage).to(RedHatLoginPage);

BaseTestConstants.TS_PLATFORM === Platform.OPENSHIFT ?
OAuthConstants.TS_SELENIUM_VALUE_OPENSHIFT_OAUTH ?
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(RegularUserOcpCheLoginPage) :
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(OcpRedHatLoginPage) :
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(KubernetesLoginPage);
BaseTestConstants.TS_PLATFORM === Platform.OPENSHIFT ?
OAuthConstants.TS_SELENIUM_VALUE_OPENSHIFT_OAUTH ?
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(RegularUserOcpCheLoginPage) :
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(OcpRedHatLoginPage) :
e2eContainer.bind<ICheLoginPage>(TYPES.CheLogin).to(KubernetesLoginPage);

export { e2eContainer };
54 changes: 27 additions & 27 deletions tests/e2e/configs/inversify.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,36 @@
**********************************************************************/

const TYPES: any = {
Driver: Symbol.for('Driver'),
CheLogin: Symbol.for('CheLogin'),
OcpLogin: Symbol.for('OcpLogin'),
WorkspaceUtil: Symbol.for('WorkspaceUtil'),
IAuthorizationHeaderHandler: Symbol.for('IAuthorizationHeaderHandler'),
ITokenHandler: Symbol.for('ITokenHandler')
Driver: Symbol.for('Driver'),
CheLogin: Symbol.for('CheLogin'),
OcpLogin: Symbol.for('OcpLogin'),
WorkspaceUtil: Symbol.for('WorkspaceUtil'),
IAuthorizationHeaderHandler: Symbol.for('IAuthorizationHeaderHandler'),
ITokenHandler: Symbol.for('ITokenHandler')
};

const CLASSES: any = {
DriverHelper: 'DriverHelper',
Dashboard: 'Dashboard',
Workspaces: 'Workspaces',
WorkspaceDetails: 'WorkspaceDetails',
ScreenCatcher: 'ScreenCatcher',
OcpLoginPage: 'OcpLoginPage',
CheApiRequestHandler: 'CheApiRequestHandler',
CreateWorkspace: 'CreateWorkspace',
BrowserTabsUtil: 'BrowserTabsUtil',
ProjectAndFileTests: 'ProjectAndFileTests',
StringUtil: 'StringUtil',
ApiUrlResolver: 'ApiUrlResolver',
LoginTests: 'LoginTests',
WorkspaceHandlingTests: 'WorkspaceHandlingTests',
RedHatLoginPage: 'RedHatLoginPage',
KubernetesLoginPage: 'KubernetesLoginPage',
DexLoginPage: 'DexLoginPage',
OcpRedHatLoginPage: 'OcpRedHatLoginPage',
OcpApplicationPage: 'OcpApplicationPage',
OcpMainPage: 'OcpMainPage',
OcpImportFromGitPage: 'OcpImportFromGitPage'
DriverHelper: 'DriverHelper',
Dashboard: 'Dashboard',
Workspaces: 'Workspaces',
WorkspaceDetails: 'WorkspaceDetails',
ScreenCatcher: 'ScreenCatcher',
OcpLoginPage: 'OcpLoginPage',
CheApiRequestHandler: 'CheApiRequestHandler',
CreateWorkspace: 'CreateWorkspace',
BrowserTabsUtil: 'BrowserTabsUtil',
ProjectAndFileTests: 'ProjectAndFileTests',
StringUtil: 'StringUtil',
ApiUrlResolver: 'ApiUrlResolver',
LoginTests: 'LoginTests',
WorkspaceHandlingTests: 'WorkspaceHandlingTests',
RedHatLoginPage: 'RedHatLoginPage',
KubernetesLoginPage: 'KubernetesLoginPage',
DexLoginPage: 'DexLoginPage',
OcpRedHatLoginPage: 'OcpRedHatLoginPage',
OcpApplicationPage: 'OcpApplicationPage',
OcpMainPage: 'OcpMainPage',
OcpImportFromGitPage: 'OcpImportFromGitPage'
};

export { TYPES, CLASSES };
42 changes: 21 additions & 21 deletions tests/e2e/configs/mocharc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
import { TimeoutConstants } from '../constants/TimeoutConstants';

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:
// variable MOCHA_DIRECTORY uses in command "test-all-devfiles" and sets up automatically.
// you can set it up to run files from specific directory with export environmental variable.
process.env.MOCHA_DIRECTORY ?
// to run one file (name without extension). uses in "test", "test-all-devfiles".
process.env.USERSTORY ?
`dist/specs/${process.env.MOCHA_DIRECTORY}/${process.env.USERSTORY}.spec.js`
: `dist/specs/${process.env.MOCHA_DIRECTORY}/**.spec.js`
: process.env.USERSTORY ?
[`dist/specs/**/${process.env.USERSTORY}.spec.js`, `dist/specs/${process.env.USERSTORY}.spec.js`]
: [`dist/specs/**/**.spec.js`, `dist/specs/**.spec.js`],
retries: TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
timeout: 1200000,
reporter: 'dist/utils/CheReporter.js',
ui: 'tdd',
require: [
'dist/specs/MochaHooks.js',
'ts-node/register',
],
bail: true,
'full-trace': true,
spec:
// variable MOCHA_DIRECTORY uses in command "test-all-devfiles" and sets up automatically.
// you can set it up to run files from specific directory with export environmental variable.
process.env.MOCHA_DIRECTORY ?
// to run one file (name without extension). uses in "test", "test-all-devfiles".
process.env.USERSTORY ?
`dist/specs/${process.env.MOCHA_DIRECTORY}/${process.env.USERSTORY}.spec.js`
: `dist/specs/${process.env.MOCHA_DIRECTORY}/**.spec.js`
: process.env.USERSTORY ?
[`dist/specs/**/${process.env.USERSTORY}.spec.js`, `dist/specs/${process.env.USERSTORY}.spec.js`]
: [`dist/specs/**/**.spec.js`, `dist/specs/**.spec.js`],
retries: TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS
};
77 changes: 39 additions & 38 deletions tests/e2e/constants/APITestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,47 @@
import { BaseTestConstants } from './BaseTestConstants';

export enum KubernetesCommandLineTool {
OC = 'oc',
KUBECTL = 'kubectl',
OC = 'oc',
KUBECTL = 'kubectl',
}

export const SupportedDevfilesRegistries: any = {
INBUILT_APPLICATION_DEVFILE_REGISTRY_URL: () => `${BaseTestConstants.TS_SELENIUM_BASE_URL}/devfile-registry/devfiles/`,
GIT_HUB_CHE_DEVFILE_REGISTRY_URL: `https://api.github.com/repos/eclipse-che/che-devfile-registry/contents/devfiles/`,
INBUILT_APPLICATION_DEVFILE_REGISTRY_URL: () => `${BaseTestConstants.TS_SELENIUM_BASE_URL}/devfile-registry/devfiles/`,
GIT_HUB_CHE_DEVFILE_REGISTRY_URL: `https://api.github.com/repos/eclipse-che/che-devfile-registry/contents/devfiles/`
};
export const APITestConstants: any = {
/**
* Possible values "oc" or "kubectl"
*/
TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL: process.env.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL || KubernetesCommandLineTool.OC,

/**
* 'quay.io/devfile/universal-developer-image:latest'
* is default assigned by DevWorkspaceConfigurationHelper.generateDevfileContext() using @eclipse-che/che-devworkspace-generator
*/
TS_API_TEST_UDI_IMAGE: process.env.TS_API_TEST_UDI_IMAGE || undefined,

/**
* https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml
* is default assigned by DevWorkspaceConfigurationHelper.generateDevfileContext() using @eclipse-che/che-devworkspace-generator
*/
TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI: process.env.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI || undefined,

/**
* https://eclipse-che.github.io/che-plugin-registry/main/v3
* is default assigned by DevWorkspaceConfigurationHelper.generateDevfileContext() using @eclipse-che/che-devworkspace-generator
*/
TS_API_TEST_PLUGIN_REGISTRY_URL: process.env.TS_API_TEST_PLUGIN_REGISTRY_URL || undefined,

/**
* Namespace on openshift platform
*/
TS_API_TEST_NAMESPACE: process.env.TS_API_TEST_NAMESPACE || undefined,

/**
* to run all devfile from registry. used in DevfileAcceptanceTestAPI.suite.ts
*/
TS_API_ACCEPTANCE_TEST_REGISTRY_URL(): string {
return process.env.TS_API_ACCEPTANCE_TEST_REGISTRY_URL || SupportedDevfilesRegistries.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL();
},
/**
* Possible values "oc" or "kubectl"
*/
TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL: process.env.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL || KubernetesCommandLineTool.OC,

/**
* 'quay.io/devfile/universal-developer-image:latest'
* is default assigned by DevWorkspaceConfigurationHelper.generateDevfileContext() using @eclipse-che/che-devworkspace-generator
*/
TS_API_TEST_UDI_IMAGE: process.env.TS_API_TEST_UDI_IMAGE || undefined,

/**
* https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml
* is default assigned by DevWorkspaceConfigurationHelper.generateDevfileContext() using @eclipse-che/che-devworkspace-generator
*/
TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI: process.env.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI || undefined,

/**
* https://eclipse-che.github.io/che-plugin-registry/main/v3
* is default assigned by DevWorkspaceConfigurationHelper.generateDevfileContext() using @eclipse-che/che-devworkspace-generator
*/
TS_API_TEST_PLUGIN_REGISTRY_URL: process.env.TS_API_TEST_PLUGIN_REGISTRY_URL || undefined,

/**
* Namespace on openshift platform
*/
TS_API_TEST_NAMESPACE: process.env.TS_API_TEST_NAMESPACE || undefined,

/**
* to run all devfile from registry. used in DevfileAcceptanceTestAPI.suite.ts
*/
TS_API_ACCEPTANCE_TEST_REGISTRY_URL(): string {
return process.env.TS_API_ACCEPTANCE_TEST_REGISTRY_URL || SupportedDevfilesRegistries.INBUILT_APPLICATION_DEVFILE_REGISTRY_URL();
}
};
87 changes: 44 additions & 43 deletions tests/e2e/constants/BaseTestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,59 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
export enum Platform {
OPENSHIFT = 'openshift',
KUBERNETES = 'kubernetes',
OPENSHIFT = 'openshift',
KUBERNETES = 'kubernetes',
}

export const BaseTestConstants: any = {
/**
* Base URL of the application which should be checked
*/
TS_SELENIUM_BASE_URL: !process.env.TS_SELENIUM_BASE_URL ? 'http://sample-url' : process.env.TS_SELENIUM_BASE_URL.replace(/\/$/, ''),
/**
* Base URL of the application which should be checked
*/
TS_SELENIUM_BASE_URL: !process.env.TS_SELENIUM_BASE_URL ? 'http://sample-url' : process.env.TS_SELENIUM_BASE_URL.replace(/\/$/, ''),

/**
* Choose the platform where "che" application deployed, "openshift" by default.
*/
TS_PLATFORM: process.env.TS_PLATFORM || Platform.OPENSHIFT,
/**
* Choose the platform where "che" application deployed, "openshift" by default.
*/
TS_PLATFORM: process.env.TS_PLATFORM || Platform.OPENSHIFT,

/**
* Editor the tests are running against, "code" by default.
* Possible values: "che-code"
*/
TS_SELENIUM_EDITOR: process.env.TS_SELENIUM_EDITOR || 'che-code',
/**
* Editor the tests are running against, "code" by default.
* Possible values: "che-code"
*/
TS_SELENIUM_EDITOR: process.env.TS_SELENIUM_EDITOR || 'che-code',

/**
* File name to check if project was imported
*/
TS_SELENIUM_PROJECT_ROOT_FILE_NAME: process.env.TS_SELENIUM_PROJECT_ROOT_FILE_NAME || 'devfile.yaml',
/**
* File name to check if project was imported
*/
TS_SELENIUM_PROJECT_ROOT_FILE_NAME: process.env.TS_SELENIUM_PROJECT_ROOT_FILE_NAME || 'devfile.yaml',

/**
* Name of workspace created for 'Happy Path' scenario validation.
*/
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: process.env.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME || 'EmptyWorkspace',
/**
* Name of workspace created for 'Happy Path' scenario validation.
*/
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: process.env.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME || 'EmptyWorkspace',

/**
* This variable specifies that run test is used for load testing and that all artifacts will be sent to ftp client.
*/
TS_LOAD_TESTS: process.env.TS_LOAD_TESTS || 'false',
/**
* This variable specifies that run test is used for load testing and that all artifacts will be sent to ftp client.
*/
TS_LOAD_TESTS: process.env.TS_LOAD_TESTS || 'false',

/**
* Enable Axios request interceptor, false by default
*/
TS_SELENIUM_REQUEST_INTERCEPTOR: process.env.TS_SELENIUM_REQUEST_INTERCEPTOR === 'true',
/**
* Enable Axios request interceptor, false by default
*/
TS_SELENIUM_REQUEST_INTERCEPTOR: process.env.TS_SELENIUM_REQUEST_INTERCEPTOR === 'true',

/**
* Enable Axios response interceptor, false by default
*/
TS_SELENIUM_RESPONSE_INTERCEPTOR: process.env.TS_SELENIUM_RESPONSE_INTERCEPTOR === 'true',
/**
* Enable Axios response interceptor, false by default
*/
TS_SELENIUM_RESPONSE_INTERCEPTOR: process.env.TS_SELENIUM_RESPONSE_INTERCEPTOR === 'true',

/**
* Stop and remove workspace if a test fails.
*/
DELETE_WORKSPACE_ON_FAILED_TEST: process.env.DELETE_WORKSPACE_ON_FAILED_TEST === 'true',
/**
* Stop and remove workspace if a test fails.
*/
DELETE_WORKSPACE_ON_FAILED_TEST: process.env.DELETE_WORKSPACE_ON_FAILED_TEST === 'true',

/**
* Constant, which prolong timeout constants for local debug.
*/
TS_DEBUG_MODE: process.env.TS_DEBUG_MODE === 'true',
/**
* Constant, which prolong timeout constants for local debug.
*/
TS_DEBUG_MODE: process.env.TS_DEBUG_MODE === 'true'
};
58 changes: 29 additions & 29 deletions tests/e2e/constants/ChromeDriverConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,39 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
export const ChromeDriverConstants: any = {
/**
* Remote driver URL.
*/
TS_SELENIUM_REMOTE_DRIVER_URL: process.env.TS_SELENIUM_REMOTE_DRIVER_URL || '',
/**
* Remote driver URL.
*/
TS_SELENIUM_REMOTE_DRIVER_URL: process.env.TS_SELENIUM_REMOTE_DRIVER_URL || '',

/**
* Run browser in "Headless" (hidden) mode, "false" by default.
*/
TS_SELENIUM_HEADLESS: process.env.TS_SELENIUM_HEADLESS === 'true',
/**
* Run browser in "Headless" (hidden) mode, "false" by default.
*/
TS_SELENIUM_HEADLESS: process.env.TS_SELENIUM_HEADLESS === 'true',

/**
* Create instance of chromedriver, "true" by default. Should be "false" to run only API tests.
*/
TS_USE_WEB_DRIVER_FOR_TEST: process.env.TS_USE_WEB_DRIVER_FOR_TEST !== 'false',
/**
* Create instance of chromedriver, "true" by default. Should be "false" to run only API tests.
*/
TS_USE_WEB_DRIVER_FOR_TEST: process.env.TS_USE_WEB_DRIVER_FOR_TEST !== 'false',

/**
* Run browser in "Fullscreen" (kiosk) mode.
* Default to true if undefined
*/
TS_SELENIUM_LAUNCH_FULLSCREEN: (process.env.TS_SELENIUM_LAUNCH_FULLSCREEN !== 'false'),
/**
* Run browser in "Fullscreen" (kiosk) mode.
* Default to true if undefined
*/
TS_SELENIUM_LAUNCH_FULLSCREEN: (process.env.TS_SELENIUM_LAUNCH_FULLSCREEN !== 'false'),

/**
* Run browser with an enabled or disabled W3C protocol (on Chrome 76 and upper, it is enabled by default), "true" by default.
*/
TS_SELENIUM_W3C_CHROME_OPTION: process.env.TS_SELENIUM_W3C_CHROME_OPTION !== 'false',
/**
* Run browser with an enabled or disabled W3C protocol (on Chrome 76 and upper, it is enabled by default), "true" by default.
*/
TS_SELENIUM_W3C_CHROME_OPTION: process.env.TS_SELENIUM_W3C_CHROME_OPTION !== 'false',

/**
* Browser width resolution, "1920" by default.
*/
TS_SELENIUM_RESOLUTION_WIDTH: Number(process.env.TS_SELENIUM_RESOLUTION_WIDTH) || 1920,
/**
* Browser width resolution, "1920" by default.
*/
TS_SELENIUM_RESOLUTION_WIDTH: Number(process.env.TS_SELENIUM_RESOLUTION_WIDTH) || 1920,

/**
* Browser height resolution, "1080" by default.
*/
TS_SELENIUM_RESOLUTION_HEIGHT: Number(process.env.TS_SELENIUM_RESOLUTION_HEIGHT) || 1080,
/**
* Browser height resolution, "1080" by default.
*/
TS_SELENIUM_RESOLUTION_HEIGHT: Number(process.env.TS_SELENIUM_RESOLUTION_HEIGHT) || 1080
};
Loading
Loading