@eclipse-che/che-e2e 7.115.0-next-c2e9cd1 → 7.115.0-next-0acf8c1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/run-e2e-test.md +573 -0
- package/.claude/settings.local.json +13 -0
- package/.claude/skills/e2e-test-developer/SKILL.md +456 -0
- package/CLAUDE.md +150 -0
- package/README.md +1 -1
- package/constants/TIMEOUT_CONSTANTS.ts +6 -0
- package/dist/constants/TIMEOUT_CONSTANTS.js +4 -0
- package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +9 -1
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.js +123 -0
- package/dist/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.js.map +1 -0
- package/dist/tests-library/ProjectAndFileTests.js +1 -1
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +26 -0
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/package.json +1 -1
- package/pageobjects/dashboard/Dashboard.ts +13 -1
- package/specs/dashboard-samples/StartWorkspaceUsingVSCodeDesktopSshEditor.spec.ts +143 -0
- package/tests-library/ProjectAndFileTests.ts +1 -1
- package/tests-library/WorkspaceHandlingTests.ts +32 -0
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
# Run E2E Tests - Unified Command
|
|
2
|
+
|
|
3
|
+
Run E2E tests against **Eclipse Che** or **Red Hat OpenShift Dev Spaces** using either a **local Chrome browser** or **Podman container**.
|
|
4
|
+
|
|
5
|
+
## Arguments: $ARGUMENTS
|
|
6
|
+
|
|
7
|
+
**Usage:** `/run-e2e-test [URL USERNAME PASSWORD [TESTNAME]]`
|
|
8
|
+
|
|
9
|
+
**Examples:**
|
|
10
|
+
|
|
11
|
+
- `/run-e2e-test` - Interactive mode (recommended)
|
|
12
|
+
- `/run-e2e-test https://devspaces.apps.cluster.example.com/ admin mypassword SmokeTest npm`
|
|
13
|
+
- `/run-e2e-test https://che.apps.cluster.example.com/ admin mypassword EmptyWorkspace podman`
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Execution Flow
|
|
18
|
+
|
|
19
|
+
1. **Parse arguments** - Extract parameters from `$ARGUMENTS`
|
|
20
|
+
2. **Prompt if missing** - Collect missing values via AskUserQuestion
|
|
21
|
+
3. **Auto-detect platform** - Determine Eclipse Che vs Dev Spaces from URL
|
|
22
|
+
4. **Detect local changes** - Check if rebuild is needed based on git status
|
|
23
|
+
5. **Detect test-specific parameters** - Read spec file for required env vars
|
|
24
|
+
6. **Generate bash commands** - Build appropriate bash commands
|
|
25
|
+
7. **Execute** - Run the test after user confirmation
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## ⚠️ MANDATORY RULES
|
|
30
|
+
|
|
31
|
+
1. **Never print bash commands with `&& \` or multi-line continuations using `\`** - Commands using line continuation characters (`\`) or chained with `&& \` cannot be copy-pasted properly from the terminal. Instead, present commands as separate lines or use semicolons for simple chains.
|
|
32
|
+
|
|
33
|
+
❌ **Wrong (line continuations):**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd /path/to/dir && \
|
|
37
|
+
npm ci && \
|
|
38
|
+
npm run test
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
❌ **Wrong (backslash continuations):**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
podman run -it \
|
|
45
|
+
--shm-size=2g \
|
|
46
|
+
-p 5920:5920 \
|
|
47
|
+
quay.io/eclipse/che-e2e:next
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
✅ **Correct (separate lines):**
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cd /path/to/dir
|
|
54
|
+
npm ci
|
|
55
|
+
npm run test
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
✅ **Correct (single line for podman):**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
podman run -it --shm-size=2g -p 5920:5920 quay.io/eclipse/che-e2e:next
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Step 1: Parse Arguments
|
|
67
|
+
|
|
68
|
+
Parse `$ARGUMENTS` to extract positional parameters:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
$ARGUMENTS = "URL USERNAME PASSWORD [TESTNAME]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Parsing logic:**
|
|
75
|
+
|
|
76
|
+
1. Split `$ARGUMENTS` by whitespace
|
|
77
|
+
2. Assign to variables: `URL`, `USERNAME`, `PASSWORD`, `TESTNAME`, `RUN_METHOD`
|
|
78
|
+
3. If `TESTNAME` is not provided, default to `EmptyWorkspace`
|
|
79
|
+
|
|
80
|
+
**Example:**
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Input: "https://devspaces.apps.example.com/ admin secret123 SmokeTest npm"
|
|
84
|
+
Result:
|
|
85
|
+
- URL = "https://devspaces.apps.example.com/"
|
|
86
|
+
- USERNAME = "admin"
|
|
87
|
+
- PASSWORD = "secret123"
|
|
88
|
+
- TESTNAME = "SmokeTest"
|
|
89
|
+
- RUN_METHOD = "npm"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Step 2: Prompt for Missing Values
|
|
95
|
+
|
|
96
|
+
If `$ARGUMENTS` is empty or incomplete, use **AskUserQuestion** to collect missing parameters.
|
|
97
|
+
|
|
98
|
+
### Question 1 - Run Method (header: "Method")
|
|
99
|
+
|
|
100
|
+
- "How do you want to run the test?"
|
|
101
|
+
- Options:
|
|
102
|
+
- Option 1: "npm run in local browser (Recommended)" - "Uses local Chrome and Node.js - faster, see browser in real-time"
|
|
103
|
+
- Option 2: "Podman container" - "Isolated environment with VNC support at localhost:5920"
|
|
104
|
+
|
|
105
|
+
### Question 2 - Execution Mode (header: "Build")
|
|
106
|
+
|
|
107
|
+
- "How should local changes be handled?"
|
|
108
|
+
- Options:
|
|
109
|
+
- Option 1: "Build and run (Recommended)" - "Compare to origin/main, rebuild if any changes exist"
|
|
110
|
+
- Option 2: "Just run" - "Skip build, assume code is already compiled"
|
|
111
|
+
|
|
112
|
+
### Question 3 - Test Name (header: "Test")
|
|
113
|
+
|
|
114
|
+
- "Which test do you want to run?"
|
|
115
|
+
- Options:
|
|
116
|
+
- Option 1: "EmptyWorkspace (Recommended)" - "Basic workspace creation test"
|
|
117
|
+
- Option 2: "SmokeTest" - "Quick validation of core functionality"
|
|
118
|
+
- Option 3: "Factory" - "Factory URL workspace creation with git operations"
|
|
119
|
+
- Option 4: "EmptyWorkspaceAPI" - "API-only test (no browser needed)"
|
|
120
|
+
|
|
121
|
+
### For URL - Ask in plain text:
|
|
122
|
+
|
|
123
|
+
> "What is the dashboard URL? (e.g., https://devspaces.apps.cluster.example.com/ or https://che.apps.cluster.example.com/)"
|
|
124
|
+
|
|
125
|
+
### For Username and Password - Ask in plain text:
|
|
126
|
+
|
|
127
|
+
> "Please provide your credentials:
|
|
128
|
+
>
|
|
129
|
+
> - **Username**: (e.g., admin, user)
|
|
130
|
+
> - **Password**: your password"
|
|
131
|
+
|
|
132
|
+
Wait for the user's response before proceeding.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Step 3: Auto-detect Testing Product from URL
|
|
137
|
+
|
|
138
|
+
Analyze the URL to determine which product is being tested and set appropriate defaults:
|
|
139
|
+
|
|
140
|
+
| URL Pattern | Product | Auto-configured Settings |
|
|
141
|
+
| ---------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
142
|
+
| Contains `devspaces` | **Red Hat OpenShift Dev Spaces** | `TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=true`, `TS_OCP_LOGIN_PAGE_PROVIDER_TITLE=htpasswd` `TS_PLATFORM=openshift` |
|
|
143
|
+
| Contains `eclipse-che` | **Eclipse Che** | May need OAuth config based on deployment. I host contains `crw-qe.com` - it is `TS_PLATFORM=openshift`. Otherwise ask user for platform: openshift or kubernetes |
|
|
144
|
+
|
|
145
|
+
**Detection logic:**
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
if [[ "$URL" == *"devspaces"* ]]; then
|
|
149
|
+
PRODUCT="devspaces"
|
|
150
|
+
TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=true
|
|
151
|
+
TS_OCP_LOGIN_PAGE_PROVIDER_TITLE="htpasswd"
|
|
152
|
+
elif [[ "$URL" == *"eclipse-che"* ]]; then
|
|
153
|
+
PRODUCT="che"
|
|
154
|
+
fi
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Step 4: Detect Local Changes
|
|
160
|
+
|
|
161
|
+
Check the git status to determine if code needs to be rebuilt before running tests.
|
|
162
|
+
|
|
163
|
+
**Important:** Ignore changes to documentation and Claude configuration files:
|
|
164
|
+
|
|
165
|
+
- `CLAUDE.md`
|
|
166
|
+
- `.claude/**/*`
|
|
167
|
+
- `*.md` files (documentation)
|
|
168
|
+
|
|
169
|
+
### For Local Browser Method:
|
|
170
|
+
|
|
171
|
+
**Smart rebuild based on all changes vs origin/main** - rebuild when there are any test code modifications compared to origin/main.
|
|
172
|
+
|
|
173
|
+
**Logic:**
|
|
174
|
+
|
|
175
|
+
1. Compare working tree to `origin/main` to detect all changes (committed, staged, and unstaged)
|
|
176
|
+
2. Rebuild if any test code changes exist compared to `origin/main` (excluding docs/config files)
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
NEEDS_REBUILD=false
|
|
180
|
+
|
|
181
|
+
# Get current branch name for informational purposes
|
|
182
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
183
|
+
echo "Current branch: $CURRENT_BRANCH"
|
|
184
|
+
|
|
185
|
+
# Check for any changes compared to origin/main (committed, staged, and unstaged)
|
|
186
|
+
# Excludes docs and Claude config files
|
|
187
|
+
CODE_CHANGES=$(git diff --name-only origin/main -- . 2>/dev/null | grep -v -E '(CLAUDE\.md|\.claude/|README\.md|\.md$)')
|
|
188
|
+
|
|
189
|
+
if [[ -n "$CODE_CHANGES" ]]; then
|
|
190
|
+
echo "Code changes detected compared to origin/main:"
|
|
191
|
+
echo "$CODE_CHANGES"
|
|
192
|
+
NEEDS_REBUILD=true
|
|
193
|
+
else
|
|
194
|
+
echo "No test code changes compared to origin/main - no rebuild needed"
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
echo "Rebuild needed: $NEEDS_REBUILD"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### For Podman Container Method:
|
|
201
|
+
|
|
202
|
+
**Smart mounting based on all changes vs origin/main** - mount full directory when there are any test code modifications compared to origin/main.
|
|
203
|
+
|
|
204
|
+
**Logic:**
|
|
205
|
+
|
|
206
|
+
1. Compare working tree to `origin/main` to detect all changes (committed, staged, and unstaged)
|
|
207
|
+
2. Mount full directory if any test code changes exist compared to `origin/main` (excluding docs/config files)
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
E2E_IMAGE="quay.io/eclipse/che-e2e:next"
|
|
211
|
+
MOUNT_FULL_CODE=false
|
|
212
|
+
|
|
213
|
+
# Get current branch name for informational purposes
|
|
214
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
215
|
+
echo "Current branch: $CURRENT_BRANCH"
|
|
216
|
+
|
|
217
|
+
# Check for any changes compared to origin/main (committed, staged, and unstaged)
|
|
218
|
+
# Excludes docs and Claude config files
|
|
219
|
+
CODE_CHANGES=$(git diff --name-only origin/main -- . 2>/dev/null | grep -v -E '(CLAUDE\.md|\.claude/|README\.md|\.md$)')
|
|
220
|
+
|
|
221
|
+
if [[ -n "$CODE_CHANGES" ]]; then
|
|
222
|
+
echo "Code changes detected compared to origin/main:"
|
|
223
|
+
echo "$CODE_CHANGES"
|
|
224
|
+
MOUNT_FULL_CODE=true
|
|
225
|
+
PODMAN_MOUNT="-v $(pwd):/tmp/e2e:Z"
|
|
226
|
+
else
|
|
227
|
+
echo "No test code changes compared to origin/main - using published image code"
|
|
228
|
+
PODMAN_MOUNT="-v $(pwd)/report:/tmp/e2e/report:Z"
|
|
229
|
+
fi
|
|
230
|
+
|
|
231
|
+
echo "Mount strategy: $PODMAN_MOUNT"
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Step 5: Detect Test-Specific Parameters
|
|
237
|
+
|
|
238
|
+
After getting the test name, read the test spec file to identify additional required environment variables.
|
|
239
|
+
|
|
240
|
+
### Find and read the spec file:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Find the test file
|
|
244
|
+
SPEC_FILE=$(find specs -name "${USERSTORY}.spec.ts" 2>/dev/null | head -1)
|
|
245
|
+
|
|
246
|
+
if [[ -n "$SPEC_FILE" ]]; then
|
|
247
|
+
echo "Found test file: $SPEC_FILE"
|
|
248
|
+
# Read the file to identify required environment variables
|
|
249
|
+
cat "$SPEC_FILE"
|
|
250
|
+
fi
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Platform-Specific Configurations
|
|
254
|
+
|
|
255
|
+
#### OpenShift
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
export TS_PLATFORM=openshift
|
|
259
|
+
export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=true
|
|
260
|
+
export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE="htpasswd"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### Kubernetes
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
export TS_PLATFORM=kubernetes
|
|
267
|
+
export TS_SELENIUM_K8S_USERNAME=che@eclipse.org
|
|
268
|
+
export TS_SELENIUM_K8S_PASSWORD=admin
|
|
269
|
+
export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=false
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Test-specific parameters by category:
|
|
273
|
+
|
|
274
|
+
#### Factory URL Tests (Factory, RefusedOAuthFactory, NoSetupRepoFactory, etc.)
|
|
275
|
+
|
|
276
|
+
These tests navigate directly to a factory URL to create a workspace.
|
|
277
|
+
**Ask for these additional parameters:**
|
|
278
|
+
|
|
279
|
+
- **Git Repository URL** (`TS_SELENIUM_FACTORY_GIT_REPO_URL`) - Repository to clone
|
|
280
|
+
- **Git Provider** (`TS_SELENIUM_FACTORY_GIT_PROVIDER`) - `github`, `gitlab`, `bitbucket`, `azure-devops`
|
|
281
|
+
- **OAuth Enabled** (`TS_SELENIUM_GIT_PROVIDER_OAUTH`) - `true` or `false`
|
|
282
|
+
|
|
283
|
+
#### Git Repo Import Form Tests (FactoryWithGitRepoOptions, CreateWorkspaceWithExistingNameFromGitUrl, etc.)
|
|
284
|
+
|
|
285
|
+
These tests use the Dashboard's "Create Workspace" form.
|
|
286
|
+
**Ask for these additional parameters:**
|
|
287
|
+
|
|
288
|
+
- **Git Repository URL** (`TS_SELENIUM_FACTORY_GIT_REPO_URL`) - Repository URL
|
|
289
|
+
- **Branch Name** (`TS_SELENIUM_FACTORY_GIT_REPO_BRANCH`) - Optional (default: `main`)
|
|
290
|
+
- **Project Name** (`TS_SELENIUM_PROJECT_NAME`) - Optional
|
|
291
|
+
|
|
292
|
+
#### API Tests (EmptyWorkspaceAPI, ContainerOverridesAPI, etc.)
|
|
293
|
+
|
|
294
|
+
**Ask for these additional parameters:**
|
|
295
|
+
|
|
296
|
+
- **Namespace** (`TS_API_TEST_NAMESPACE`) - Optional
|
|
297
|
+
- **UDI Image** (`TS_API_TEST_UDI_IMAGE`) - Optional
|
|
298
|
+
|
|
299
|
+
#### Sample/Devfile Tests
|
|
300
|
+
|
|
301
|
+
**Ask for these additional parameters:**
|
|
302
|
+
|
|
303
|
+
- **Sample List** (`TS_SAMPLE_LIST`) - e.g., `Node.js Express`
|
|
304
|
+
|
|
305
|
+
#### SSH/PAT Tests (SshUrlNoOauthPatFactory, etc.)
|
|
306
|
+
|
|
307
|
+
**Ask for these additional parameters:**
|
|
308
|
+
|
|
309
|
+
- **SSH Private Key Path** or **Personal Access Token** details
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Step 6: Generate Bash Commands
|
|
314
|
+
|
|
315
|
+
Based on all collected parameters, generate the appropriate bash commands.
|
|
316
|
+
|
|
317
|
+
### Option A: Local Browser Commands
|
|
318
|
+
|
|
319
|
+
#### Browser/ChromeDriver Compatibility Check
|
|
320
|
+
|
|
321
|
+
Before running tests, verify ChromeDriver compatibility with local Chrome browser:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# Get local Chrome version
|
|
325
|
+
CHROME_VERSION=$(google-chrome --version 2>/dev/null | grep -oP '\d+' | head -1)
|
|
326
|
+
echo "Local Chrome major version: $CHROME_VERSION"
|
|
327
|
+
|
|
328
|
+
# Get ChromeDriver version from package.json
|
|
329
|
+
CHROMEDRIVER_VERSION=$(npm list chromedriver --depth=0 2>/dev/null | grep -oP 'chromedriver@\K[\d.]+')
|
|
330
|
+
echo "ChromeDriver version in package.json: $CHROMEDRIVER_VERSION"
|
|
331
|
+
|
|
332
|
+
# If versions don't match, suggest installing compatible driver
|
|
333
|
+
if [[ "${CHROMEDRIVER_VERSION%%.*}" != "$CHROME_VERSION" ]]; then
|
|
334
|
+
echo "WARNING: ChromeDriver version mismatch!"
|
|
335
|
+
echo "Install compatible version: npm install chromedriver@$CHROME_VERSION"
|
|
336
|
+
fi
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**If ChromeDriver is incompatible**, install a matching version:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npm install chromedriver@<chrome-major-version>
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### Full Test Run (Build and Run)
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
cd tests/e2e
|
|
349
|
+
|
|
350
|
+
# Use correct Node.js version
|
|
351
|
+
nvm use v22.10.0
|
|
352
|
+
|
|
353
|
+
# Get current branch name for informational purposes
|
|
354
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
355
|
+
echo "Current branch: $CURRENT_BRANCH"
|
|
356
|
+
|
|
357
|
+
# Check for any changes compared to origin/main (committed, staged, and unstaged)
|
|
358
|
+
# Excludes docs and Claude config files
|
|
359
|
+
CODE_CHANGES=$(git diff --name-only origin/main -- . 2>/dev/null | grep -v -E '(CLAUDE\.md|\.claude/|README\.md|\.md$)')
|
|
360
|
+
|
|
361
|
+
if [[ -n "$CODE_CHANGES" ]]; then
|
|
362
|
+
echo "Code changes detected compared to origin/main:"
|
|
363
|
+
echo "$CODE_CHANGES"
|
|
364
|
+
NEEDS_REBUILD=true
|
|
365
|
+
else
|
|
366
|
+
echo "No test code changes compared to origin/main - skipping rebuild"
|
|
367
|
+
NEEDS_REBUILD=false
|
|
368
|
+
fi
|
|
369
|
+
|
|
370
|
+
# Check if package.json was modified compared to origin/main
|
|
371
|
+
PACKAGE_JSON_CHANGED=$(git diff --name-only origin/main -- package.json 2>/dev/null)
|
|
372
|
+
|
|
373
|
+
# Rebuild if changes detected compared to origin/main
|
|
374
|
+
if [[ "$NEEDS_REBUILD" == "true" ]]; then
|
|
375
|
+
echo "Rebuilding TypeScript..."
|
|
376
|
+
rm -rf node_modules dist
|
|
377
|
+
|
|
378
|
+
# Use npm install if package.json changed, otherwise npm ci
|
|
379
|
+
if [[ -n "$PACKAGE_JSON_CHANGED" ]]; then
|
|
380
|
+
echo "package.json modified - using npm install to update package-lock.json"
|
|
381
|
+
npm install
|
|
382
|
+
else
|
|
383
|
+
npm ci
|
|
384
|
+
fi
|
|
385
|
+
|
|
386
|
+
npm run lint
|
|
387
|
+
npm run prettier
|
|
388
|
+
npm run tsc
|
|
389
|
+
fi
|
|
390
|
+
|
|
391
|
+
# Set environment variables
|
|
392
|
+
export TS_SELENIUM_BASE_URL="<URL>"
|
|
393
|
+
export TS_SELENIUM_OCP_USERNAME="<USERNAME>"
|
|
394
|
+
export TS_SELENIUM_OCP_PASSWORD="<PASSWORD>"
|
|
395
|
+
export USERSTORY="<TESTNAME>"
|
|
396
|
+
export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=true
|
|
397
|
+
export NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
398
|
+
|
|
399
|
+
# Run the test
|
|
400
|
+
npm run test
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
#### API-Only Tests (No Browser)
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
export USERSTORY=EmptyWorkspaceAPI
|
|
407
|
+
npm run driver-less-test
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Option B: Podman Container Commands
|
|
411
|
+
|
|
412
|
+
**Important:** Use `--env-host` to pass all exported environment variables from the host to the container.
|
|
413
|
+
|
|
414
|
+
**Smart mounting logic based on changes vs origin/main:**
|
|
415
|
+
|
|
416
|
+
- **Changes compared to origin/main**: Mount full directory `-v $(pwd):/tmp/e2e:Z` to test local code
|
|
417
|
+
- **No changes compared to origin/main**: Mount only report directory `-v $(pwd)/report:/tmp/e2e/report:Z`
|
|
418
|
+
|
|
419
|
+
#### With Test Code Changes vs origin/main (mount full directory):
|
|
420
|
+
|
|
421
|
+
Use this when there are test code changes compared to `origin/main` (works for feature branches or local main with unpushed changes).
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
cd tests/e2e
|
|
425
|
+
|
|
426
|
+
# Set environment variables
|
|
427
|
+
export NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
428
|
+
export TS_SELENIUM_BASE_URL=<URL>
|
|
429
|
+
export TS_SELENIUM_OCP_USERNAME=<USERNAME>
|
|
430
|
+
export TS_SELENIUM_OCP_PASSWORD=<PASSWORD>
|
|
431
|
+
export USERSTORY=<TESTNAME>
|
|
432
|
+
|
|
433
|
+
# Run with full local code mounted (testing changes vs origin/main)
|
|
434
|
+
podman rm -f selenium-e2e 2>/dev/null
|
|
435
|
+
podman run -it --shm-size=2g -p 5920:5920 --env-host -v $(pwd):/tmp/e2e:Z quay.io/eclipse/che-e2e:next
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
#### No Test Code Changes vs origin/main (mount only report directory):
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
cd tests/e2e
|
|
442
|
+
|
|
443
|
+
# Set environment variables
|
|
444
|
+
export NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
445
|
+
export TS_SELENIUM_BASE_URL=<URL>
|
|
446
|
+
export TS_SELENIUM_OCP_USERNAME=<USERNAME>
|
|
447
|
+
export TS_SELENIUM_OCP_PASSWORD=<PASSWORD>
|
|
448
|
+
export USERSTORY=<TESTNAME>
|
|
449
|
+
|
|
450
|
+
# Run with only report directory mounted (no changes vs origin/main, uses published image code)
|
|
451
|
+
podman rm -f selenium-e2e 2>/dev/null
|
|
452
|
+
podman run -it --shm-size=2g -p 5920:5920 --env-host -v $(pwd)/report:/tmp/e2e/report:Z quay.io/eclipse/che-e2e:next
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Step 7: Execute After User Confirmation
|
|
458
|
+
|
|
459
|
+
Before executing, present the generated command(s) to the user and ask for confirmation.
|
|
460
|
+
|
|
461
|
+
### Confirmation prompt:
|
|
462
|
+
|
|
463
|
+
> "Here is the command I will run:
|
|
464
|
+
>
|
|
465
|
+
> ```bash
|
|
466
|
+
> <generated command>
|
|
467
|
+
> ```
|
|
468
|
+
>
|
|
469
|
+
> **Summary:**
|
|
470
|
+
>
|
|
471
|
+
> - **Platform:** [OpenShift/Kubernetes]
|
|
472
|
+
> - **Product:** [Eclipse Che/Dev Spaces]
|
|
473
|
+
> - **Test:** [TESTNAME]
|
|
474
|
+
> - **Method:** [Local browser/Podman container]
|
|
475
|
+
> - **URL:** [URL]
|
|
476
|
+
>
|
|
477
|
+
> Shall I proceed?"
|
|
478
|
+
|
|
479
|
+
### After confirmation:
|
|
480
|
+
|
|
481
|
+
1. Execute the bash command(s)
|
|
482
|
+
2. Monitor the output
|
|
483
|
+
3. Report success or failure
|
|
484
|
+
4. If using Podman, remind user about VNC access at `localhost:5920`
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## Debugging Options
|
|
489
|
+
|
|
490
|
+
### Verbose Logging
|
|
491
|
+
|
|
492
|
+
```bash
|
|
493
|
+
export TS_SELENIUM_LOG_LEVEL=TRACE
|
|
494
|
+
export TS_SELENIUM_PRINT_TIMEOUT_VARIABLES=true
|
|
495
|
+
export TS_DEBUG_MODE=true
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Headless Mode (CI)
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
export TS_SELENIUM_HEADLESS=true
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### Video Recording
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
export VIDEO_RECORDING=true
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Keep Workspace on Failure
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
export TS_DELETE_WORKSPACE_ON_FAILED_TEST=false
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## VNC Access for Visual Debugging (Podman only)
|
|
519
|
+
|
|
520
|
+
Connect to VNC at `localhost:5920` to watch tests running in the container.
|
|
521
|
+
|
|
522
|
+
**VNC clients:**
|
|
523
|
+
|
|
524
|
+
- **TigerVNC** (recommended): `sudo dnf install tigervnc` then `vncviewer localhost:5920`
|
|
525
|
+
- **Remmina**: `sudo dnf install remmina remmina-plugins-vnc` (GUI-based)
|
|
526
|
+
- **Vinagre**: `sudo dnf install vinagre` then `vinagre localhost:5920`
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## View Test Reports
|
|
531
|
+
|
|
532
|
+
After test execution:
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
npm run open-allure-dasboard
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## Troubleshooting
|
|
541
|
+
|
|
542
|
+
### Certificate Errors
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
export NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Slow Workspace Start
|
|
549
|
+
|
|
550
|
+
```bash
|
|
551
|
+
export TS_SELENIUM_START_WORKSPACE_TIMEOUT=600000
|
|
552
|
+
export TS_SELENIUM_DEFAULT_ATTEMPTS=3
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### OAuth Login Issues
|
|
556
|
+
|
|
557
|
+
Verify the login provider title matches exactly what appears on the login page:
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE="htpasswd"
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
### Container Cleanup
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
podman rm -f selenium-e2e
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
## Debugging TypeScript Tests in VS Code
|
|
572
|
+
|
|
573
|
+
For debugging E2E tests with breakpoints, see: https://code.visualstudio.com/docs/typescript/typescript-debugging
|