Skip to content

Commit 3e4ea97

Browse files
authored
Merge branch 'eclipse-che:main' into stabilizeRecommendedExtensionsTest
2 parents 1b2555e + 677aa96 commit 3e4ea97

8 files changed

Lines changed: 186 additions & 6 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/tests/e2e"
5+
schedule:
6+
interval: "weekly"

‎.github/workflows/pr-check.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ jobs:
4545
# remove build-in images from the VM because it is not used
4646
docker rmi -f $(docker images -aq) || true
4747
48-
- name: Configuring nodejs 18.x version
48+
- name: Configuring nodejs 22.x version
4949
uses: actions/setup-node@v3
5050
with:
51-
node-version: "18"
51+
node-version: "22"
5252

5353
- name: Check prettier rules
5454
run: |

‎.github/workflows/typescript-publish.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
echo "npm_dist_tag=$DIST_TAG" >> $GITHUB_OUTPUT
6969
- uses: actions/setup-node@v3
7070
with:
71-
node-version: '16'
71+
node-version: '22'
7272
registry-url: 'https://registry.npmjs.org'
7373
scope: '@eclipse-che'
7474
- name: Clone source code

‎.gitignore‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,16 @@ tests/devworkspace-happy-path/workdir
9696
*/.grunt
9797
*/.lock-wscript
9898
*/cypress-tests/dist
99+
100+
# TypeScript build info #
101+
#########################
102+
*.tsbuildinfo
103+
104+
# Editor swap files #
105+
#####################
106+
*.swp
107+
*.swo
108+
109+
# npm cache #
110+
#############
111+
.npm/

‎CLAUDE.md‎

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# CLAUDE.md
2+
3+
## Project Overview
4+
5+
Eclipse Che is an open-source, Kubernetes-native developer workspace platform. This repository contains:
6+
7+
- **`tests/e2e/`** — TypeScript/Mocha/Selenium end-to-end test framework (the main codebase)
8+
- **`tests/performance/`** — Shell-based performance tests
9+
- **`tests/devworkspace-happy-path/`** — Happy-path smoke tests for DevWorkspaces
10+
11+
The e2e suite uses Inversify for dependency injection, Selenium WebDriver with Chrome, and Mocha in TDD style (`suite`/`test`).
12+
13+
## Local Dev Setup
14+
15+
All npm commands run from `tests/e2e/`, not the repo root:
16+
17+
```bash
18+
cd tests/e2e
19+
npm ci # install dependencies
20+
npm run tsc # compile TypeScript
21+
npm run lint # run eslint with --fix
22+
npm run prettier # format with prettier
23+
```
24+
25+
## Running Tests
26+
27+
```bash
28+
# full test suite (lint + compile + run)
29+
npm run test
30+
31+
# run a single test file by name (without .spec.ts)
32+
export USERSTORY=Factory && npm run test
33+
34+
# driver-less tests (no browser, API-only)
35+
USERSTORY=EmptyWorkspaceAPI npm run driver-less-test
36+
```
37+
38+
## Single-File Verification
39+
40+
All commands run from `tests/e2e/`:
41+
42+
```bash
43+
# lint one file
44+
npx eslint --fix specs/factory/Factory.spec.ts
45+
46+
# type-check (whole project, no single-file mode)
47+
npm run tsc
48+
49+
# format one file
50+
npx prettier --config .prettierrc.json --write specs/factory/Factory.spec.ts
51+
```
52+
53+
## Pre-Push Checklist
54+
55+
Run before every push — CI checks these on PRs touching `tests/e2e/**`:
56+
57+
```bash
58+
npm run prettier && npm run tsc && npm run lint
59+
```
60+
61+
## Coding Conventions
62+
63+
- **License header**: EPL-2.0 block comment required on every `.ts` file (enforced by `eslint-plugin-header`)
64+
- **Quotes**: single quotes (`'`), enforced by eslint
65+
- **Return types**: explicit on all functions (`@typescript-eslint/explicit-function-return-type`)
66+
- **Formatting**: prettier enforced — tabs, 140 print width, no trailing commas, LF line endings
67+
- **Comments**: must start lowercase (`capitalized-comments: never`)
68+
- **No arrow functions** in Mocha `suite`/`test`/`suiteSetup`/`suiteTeardown` declarations
69+
- **`@injectable()`** decorator on all page objects and utility classes
70+
- **`Logger.debug()`** at the start of every public method in page objects/utils
71+
- **Locators**: static → `private static readonly NAME: By`; dynamic → private method returning `By`
72+
- **Member ordering**: static fields, public fields, instance fields, constructor, then methods (public → private)
73+
74+
## Pattern References
75+
76+
Use these real files as examples when making common changes:
77+
78+
| Change | Example file |
79+
|---|---|
80+
| Add a new e2e test | `tests/e2e/specs/factory/Factory.spec.ts` |
81+
| Add a new page object | `tests/e2e/pageobjects/dashboard/Dashboard.ts` |
82+
| Add a new utility | `tests/e2e/utils/StringUtil.ts` |
83+
| DI container registration | `tests/e2e/configs/inversify.config.ts` |
84+
| DI type identifiers | `tests/e2e/configs/inversify.types.ts` |
85+
| Timeout constants | `tests/e2e/constants/TIMEOUT_CONSTANTS.ts` |
86+
87+
## Key Configuration Files
88+
89+
| File | Purpose |
90+
|---|---|
91+
| `tests/e2e/tsconfig.json` | TypeScript config — target es2021, commonjs, strict, decorators enabled |
92+
| `tests/e2e/.eslintrc.js` | ESLint rules — extends `@typescript-eslint/recommended-type-checked` + prettier |
93+
| `tests/e2e/.prettierrc.json` | Prettier config — tabs, single quotes, 140 width, no trailing commas |
94+
| `tests/e2e/package.json` | npm scripts and dependencies |
95+
96+
## Environment Variables
97+
98+
| Variable | Description |
99+
|---|---|
100+
| `TS_SELENIUM_BASE_URL` | Che dashboard URL |
101+
| `TS_SELENIUM_OCP_USERNAME` | OpenShift username |
102+
| `TS_SELENIUM_OCP_PASSWORD` | OpenShift password |
103+
| `USERSTORY` | Test file to run (without `.spec.ts`) |
104+
| `TS_PLATFORM` | `openshift` or `kubernetes` |
105+
106+
## Working on E2E tests
107+
108+
Before modifying `tests/e2e/`, read:
109+
- `tests/e2e/CLAUDE.md` for detailed development guidance.
110+
- `tests/e2e/CODE_STYLE.md` for required coding standards.
111+
- `tests/e2e/README.md` for setup and execution prerequisites.
112+
113+
Existing agent workflows:
114+
- `tests/e2e/.claude/skills/e2e-test-developer/SKILL.md`
115+
- `tests/e2e/.claude/commands/run-e2e-test.md`
116+
117+
When adding a page object, register its identifier and binding in
118+
`tests/e2e/configs/inversify.types.ts` and
119+
`tests/e2e/configs/inversify.config.ts`

‎tests/e2e/build/dockerfiles/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USER root
66

77
RUN apt-get update && apt-get install && \
88
apt-get install -y ftp x11vnc ffmpeg libvpx7 && \
9-
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \
9+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && \
1010
apt-get install -y nodejs && \
1111
npm install -g typescript && \
1212
node -v

‎tests/e2e/specs/factory/SshUrlNoOauthPatFactory.spec.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { DriverHelper } from '../../utils/DriverHelper';
2828
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
2929
import { ViewsMoreActionsButton } from '../../pageobjects/ide/ViewsMoreActionsButton';
3030
import { SourceControlView } from '../../pageobjects/ide/SourceControlView';
31+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
3132

3233
suite(`The SshUrlNoOauthPatFactory userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
3334
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
@@ -109,8 +110,14 @@ suite(`The SshUrlNoOauthPatFactory userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONM
109110
test('Check a project folder has been created', async function (): Promise<void> {
110111
const projectName: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_PROJECT_NAME || StringUtil.getProjectNameFromGitUrl(factoryUrl);
111112
projectSection = await projectAndFileTests.getProjectViewSession();
112-
expect(await projectAndFileTests.getProjectTreeItem(projectSection, projectName), 'Project folder was not imported').not
113-
.undefined;
113+
expect(
114+
await projectAndFileTests.waitForProjectTreeItem(
115+
projectSection,
116+
projectName,
117+
TIMEOUT_CONSTANTS.TS_WAIT_LOADER_ABSENCE_TIMEOUT
118+
),
119+
'Project folder was not imported'
120+
).not.undefined;
114121
});
115122
test('Accept the project as a trusted one', async function (): Promise<void> {
116123
await projectAndFileTests.performTrustDialogs();

‎tests/e2e/tests-library/ProjectAndFileTests.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,41 @@ export class ProjectAndFileTests {
270270
throw new Error(`File "${fileName}" was not opened in the editor after ${maxAttempts} attempts`);
271271
}
272272

273+
/**
274+
* wait for a project tree item to appear with polling and retry.
275+
* useful for slower git providers (e.g. Bitbucket SSH) where cloning
276+
* and indexing may take longer than the default tree item timeout.
277+
* @param projectSection ViewSection with project tree files.
278+
* @param label Label of the item to search for.
279+
* @param timeout Maximum time in ms to wait for the item to appear.
280+
* @param polling Interval in ms between retry attempts.
281+
* @param itemLevel Depth level for findItem lookup, default 2.
282+
* @returns Promise resolving to ViewItem object if found.
283+
* @throws Error if the item is not found within the timeout.
284+
*/
285+
async waitForProjectTreeItem(
286+
projectSection: ViewSection,
287+
label: string,
288+
timeout: number = TIMEOUT_CONSTANTS.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT,
289+
polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING,
290+
itemLevel: number = 2
291+
): Promise<ViewItem> {
292+
Logger.debug(`waiting for project tree item "${label}" with timeout ${timeout}ms`);
293+
294+
const attempts: number = Math.ceil(timeout / polling);
295+
for (let i: number = 0; i < attempts; i++) {
296+
const item: ViewItem | undefined = await this.getProjectTreeItem(projectSection, label, itemLevel);
297+
if (item) {
298+
Logger.debug(`project tree item "${label}" found after ${(i + 1) * polling}ms`);
299+
return item;
300+
}
301+
Logger.trace(`project tree item "${label}" not found, attempt ${i + 1}/${attempts}`);
302+
await this.driverHelper.wait(polling);
303+
}
304+
305+
throw new Error(`Project tree item "${label}" was not found within ${timeout}ms`);
306+
}
307+
273308
async expandProjectTreeItem(projectSection: ViewSection, projectName: string): Promise<void> {
274309
Logger.debug(`${projectName}`);
275310
const projectTreeItem: ViewItem | undefined = await projectSection.findItem(projectName, 2);

0 commit comments

Comments
 (0)