|
| 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` |
0 commit comments