Skip to content

Commit

Permalink
Merge branch 'main' of github.com:eclipse/che into update-factory
Browse files Browse the repository at this point in the history
  • Loading branch information
artaleks9 committed Jan 29, 2025
2 parents c778cab + 49bdfa2 commit 5cdd931
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 64 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ body:
label: Che version
description: if workspace is running, version can be obtained with help/about menu
options:
- "7.97@latest"
- "7.98@latest"
- "next (development version)"
- "7.97"
- "7.96"
- "7.95"
- "7.94"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.98.0-next
7.99.0-next
4 changes: 2 additions & 2 deletions tests/e2e/CODE_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Automated lint checking and code format performs with ESLint and Prettier tools
pre-commit hook.
Full set of rules can be found:

- [.eslintrc](.eslintrc.js)
- [.prettierrc](.prettierrc.json)
- [.eslintrc](.eslintrc.js)
- [.prettierrc](.prettierrc.json)

### Preferable code style

Expand Down
74 changes: 37 additions & 37 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@

## Requirements

- node 16.x
- "Chrome" browser 114.x or later
- deployed Che 7 with accessible URL
- node 16.x
- "Chrome" browser 114.x or later
- deployed Che 7 with accessible URL

## Before launch

**Perform commands:**

- `export TS_SELENIUM_BASE_URL=<Che7 URL>`
- `npm ci`
- `export TS_SELENIUM_BASE_URL=<Che7 URL>`
- `npm ci`

Note: If there is any modifications in package.json, manually execute the `npm install` to update the package-lock.json. So that errors can be avoided while executing npm ci

## Default launch

- Provide connection credentials:
- `export TS_SELENIUM_OCP_USERNAME=<username>`
- `export TS_SELENIUM_OCP_PASSWORD=<password>`
- `npm run test`
- Provide connection credentials:
- `export TS_SELENIUM_OCP_USERNAME=<username>`
- `export TS_SELENIUM_OCP_PASSWORD=<password>`
- `npm run test`

## Custom launch

- Use environment variables which described in the "constants" folder
- Use environment variables for setting timeouts if needed. You can see the list in **`'TimeoutConstants.ts'`**. You can see the list of those variables and their value if you set the `'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'`
- To test one specification export file name as `export USERSTORY=<spec-file-name-without-extension> && npm run test` (example: `-e USERSTORY=Quarkus`)
- To run test without Selenium WebDriver (API tests etc.) use `export USERSTORY=<spec-file-name-without-extension> && npm run driver-less-test` (example: `-e USERSTORY=CloneGitRepoAPI`)
- This project support application testing deployed on Kubernetes or Openshift platform. Openshift is default value. To switch into Kubernetes, please, use `TS_PLATFORM=kubernetes` environmental variable and `TS_SELENIUM_K8S_PASSWORD`, `TS_SELENIUM_K8S_USERNAME` to provide credentials. The sample of test command in this case:
- Use environment variables which described in the "constants" folder
- Use environment variables for setting timeouts if needed. You can see the list in **`'TimeoutConstants.ts'`**. You can see the list of those variables and their value if you set the `'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'`
- To test one specification export file name as `export USERSTORY=<spec-file-name-without-extension> && npm run test` (example: `-e USERSTORY=Quarkus`)
- To run test without Selenium WebDriver (API tests etc.) use `export USERSTORY=<spec-file-name-without-extension> && npm run driver-less-test` (example: `-e USERSTORY=CloneGitRepoAPI`)
- This project support application testing deployed on Kubernetes or Openshift platform. Openshift is default value. To switch into Kubernetes, please, use `TS_PLATFORM=kubernetes` environmental variable and `TS_SELENIUM_K8S_PASSWORD`, `TS_SELENIUM_K8S_USERNAME` to provide credentials. The sample of test command in this case:
```
export TS_PLATFORM=kubernetes && \
export TS_SELENIUM_K8S_USERNAME=<username> && \
Expand All @@ -37,21 +37,21 @@ Note: If there is any modifications in package.json, manually execute the `npm i
npm run test
```
Also, environmental variables can be set in files in "constants" folder.
- Local test results can be represented with Allure reporter `npm run open-allure-dasboard`
- Local test results can be represented with Allure reporter `npm run open-allure-dasboard`
## Docker launch
- open terminal and go to the "e2e" directory
- export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
- run command `"npm run test-docker"`
- open terminal and go to the "e2e" directory
- export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
- run command `"npm run test-docker"`
## Docker launch with changed tests
**For launching tests with local changes perform next steps:**
- open terminal and go to the "e2e" directory
- export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
- run command `"npm run test-docker-mount-e2e"`
- open terminal and go to the "e2e" directory
- export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url
- run command `"npm run test-docker-mount-e2e"`
## Debug docker launch
Expand All @@ -62,27 +62,27 @@ The `'eclipse/che-e2e'` docker image has VNC server installed inside. For connec
**The easiest way to do that is to perform steps which are described in the "Docker launch" paragraph.
For running tests without docker, please perform next steps:**
- Deploy Che on Kubernetes infrastructure by using 'Minikube' and 'Chectl' <https://github.com/eclipse-che/che-server/blob/HEAD/deploy/kubernetes/README.md>
- Create workspace by using 'Chectl' and devfile
- link to 'Chectl' manual <https://github.com/che-incubator/chectl#chectl-workspacestart>
- link to devfile ( **`For successfull test passing, exactly provided devfile should be used`** )
<https://gist.githubusercontent.com/Ohrimenko1988/93f5426f4ebc1705c55feb8ff0396a49/raw/cbea89ad145ba33ed34a151a12c50f045f9f3b78/yaml-ls-bug.yaml>
- Provide the **`'TS_SELENIUM_BASE_URL'`** environment variable as described above
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
- perform command **`export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`**
- Deploy Che on Kubernetes infrastructure by using 'Minikube' and 'Chectl' <https://github.com/eclipse-che/che-server/blob/HEAD/deploy/kubernetes/README.md>
- Create workspace by using 'Chectl' and devfile
- link to 'Chectl' manual <https://github.com/che-incubator/chectl#chectl-workspacestart>
- link to devfile ( **`For successfull test passing, exactly provided devfile should be used`** )
<https://gist.githubusercontent.com/Ohrimenko1988/93f5426f4ebc1705c55feb8ff0396a49/raw/cbea89ad145ba33ed34a151a12c50f045f9f3b78/yaml-ls-bug.yaml>
- Provide the **`'TS_SELENIUM_BASE_URL'`** environment variable as described above
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
- perform command **`export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`**
## Launching the DevWorkspaceHappyPath spec file using Che with oauth authentication
**Setup next environment variables:**
- export TS_SELENIUM_BASE_URL=\<Che-URL\>
- export TS_SELENIUM_OCP_USERNAME=\<cluster-username\>
- export TS_SELENIUM_OCP_PASSWORD=\<cluster-password\>
- export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH="true"
- export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE=\<login-provide-title\>
- export TS_SELENIUM_DEVWORKSPACE_URL=\<devworkspace-url\>
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
- export TS_SELENIUM_BASE_URL=\<Che-URL\>
- export TS_SELENIUM_OCP_USERNAME=\<cluster-username\>
- export TS_SELENIUM_OCP_PASSWORD=\<cluster-password\>
- export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH="true"
- export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE=\<login-provide-title\>
- export TS_SELENIUM_DEVWORKSPACE_URL=\<devworkspace-url\>
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts)
**Execute the npm command:**
- perform command `export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`
- perform command `export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`
4 changes: 2 additions & 2 deletions tests/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eclipse-che/che-e2e",
"version": "7.98.0-next",
"version": "7.99.0-next",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/CppDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ suite('Cpp devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/DotnetDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('Dotnet devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/GoDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ suite('Go devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/JBossEapDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('JBoss EAP devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/LombokDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('Lombok devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/NodeJSMongoDBDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('NodeJS MongoDB devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/api/NodeJsExpressDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('NodeJS Express devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down Expand Up @@ -115,7 +115,7 @@ suite('NodeJS Express devfile API test', function (): void {

// stop app command has single and double quotes in the command line, so it should be escaped properly to run by oc exec command in bash
// stop command -> `node_server_pids=$(pgrep -fx '.*nodemon (--inspect )?app.js' | tr "\\n" " ") && echo "Stopping node server with PIDs: ${node_server_pids}" && kill -15 ${node_server_pids} &>/dev/null && echo 'Done.''`

// prettier changes next line to `replaceAll("'", "'\"'\"'")` that throws an error from eslint.
// prettier-ignore
let runCommandInBash: string = commandLine.replaceAll('\'', '\'\"\'\"\'');
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/PhpDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('PHP devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/PythonDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ suite('Python devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/QuarkusDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('Quarkus devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
9 changes: 0 additions & 9 deletions tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTes
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
import { DriverHelper } from '../../utils/DriverHelper';
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
import { Logger } from '../../utils/Logger';
import { LoginTests } from '../../tests-library/LoginTests';
import { FACTORY_TEST_CONSTANTS, GitProviderType } from '../../constants/FACTORY_TEST_CONSTANTS';
Expand All @@ -53,7 +52,6 @@ suite(
const webCheCodeLocators: Locators = cheCodeLocatorLoader.webCheCodeLocators;
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
const createWorkspace: CreateWorkspace = e2eContainer.get(CLASSES.CreateWorkspace);
Expand All @@ -65,7 +63,6 @@ suite(
let viewsActionsButton: boolean;

// test specific data
let numberOfCreatedWorkspaces: number = 0;
const timeToRefresh: number = 1500;
const changesToCommit: string = new Date().getTime().toString();
const fileToChange: string = 'Date.txt';
Expand All @@ -80,12 +77,6 @@ suite(
await loginTests.loginIntoChe();
});

test('Get number of previously created workspaces', async function (): Promise<void> {
await dashboard.clickWorkspacesButton();
await workspaces.waitPage();
numberOfCreatedWorkspaces = (await workspaces.getAllCreatedWorkspacesNames()).length;
});

test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL());
await createWorkspace.performTrustAuthorPopup();
Expand Down

0 comments on commit 5cdd931

Please sign in to comment.