@jonit-dev/night-watch-cli 1.7.97 โ 1.7.98
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/dist/scripts/night-watch-qa-cron.sh +1 -18
- package/dist/templates/qa.md +35 -10
- package/package.json +1 -1
|
@@ -379,12 +379,6 @@ cd "${PROJECT_DIR}"
|
|
|
379
379
|
PROVIDER_MODEL_DISPLAY=$(resolve_provider_model_display "${PROVIDER_CMD}" "${PROVIDER_LABEL}")
|
|
380
380
|
QA_ARTIFACTS_DESC=$(describe_qa_artifacts "${QA_ARTIFACTS}")
|
|
381
381
|
|
|
382
|
-
send_telegram_status_message "๐งช Night Watch QA: started" "Project: ${PROJECT_NAME}
|
|
383
|
-
Provider (model): ${PROVIDER_MODEL_DISPLAY}
|
|
384
|
-
Artifacts: ${QA_ARTIFACTS_DESC} (mode=${QA_ARTIFACTS})
|
|
385
|
-
Branch patterns: ${BRANCH_PATTERNS_RAW}
|
|
386
|
-
Scanning open PRs for QA candidates."
|
|
387
|
-
|
|
388
382
|
# Convert comma-separated branch prefixes into a regex that matches branch starts.
|
|
389
383
|
BRANCH_REGEX=""
|
|
390
384
|
IFS=',' read -r -a BRANCH_PATTERNS <<< "${BRANCH_PATTERNS_RAW}"
|
|
@@ -413,10 +407,6 @@ OPEN_PRS=$(
|
|
|
413
407
|
|
|
414
408
|
if [ "${OPEN_PRS}" -eq 0 ]; then
|
|
415
409
|
log "SKIP: No open PRs matching branch patterns (${BRANCH_PATTERNS_RAW})"
|
|
416
|
-
send_telegram_status_message "๐งช Night Watch QA: no matching PRs" "Project: ${PROJECT_NAME}
|
|
417
|
-
Provider (model): ${PROVIDER_MODEL_DISPLAY}
|
|
418
|
-
Branch patterns: ${BRANCH_PATTERNS_RAW}
|
|
419
|
-
Result: 0 open PRs matched."
|
|
420
410
|
emit_result "skip_no_open_prs"
|
|
421
411
|
exit 0
|
|
422
412
|
fi
|
|
@@ -472,10 +462,6 @@ done < <(
|
|
|
472
462
|
|
|
473
463
|
if [ "${QA_NEEDED}" -eq 0 ]; then
|
|
474
464
|
log "SKIP: All ${OPEN_PRS} open PR(s) matching patterns already have QA comments"
|
|
475
|
-
send_telegram_status_message "๐งช Night Watch QA: nothing to do" "Project: ${PROJECT_NAME}
|
|
476
|
-
Provider (model): ${PROVIDER_MODEL_DISPLAY}
|
|
477
|
-
Artifacts: ${QA_ARTIFACTS_DESC} (mode=${QA_ARTIFACTS})
|
|
478
|
-
Result: All matching PRs already have QA results."
|
|
479
465
|
emit_result "skip_all_qa_done"
|
|
480
466
|
exit 0
|
|
481
467
|
fi
|
|
@@ -525,10 +511,7 @@ QA_SCREENSHOT_SUMMARY=""
|
|
|
525
511
|
for pr_ref in ${PRS_NEEDING_QA}; do
|
|
526
512
|
pr_num="${pr_ref#\#}"
|
|
527
513
|
PROCESSED_PRS_CSV=$(append_csv "${PROCESSED_PRS_CSV}" "#${pr_num}")
|
|
528
|
-
|
|
529
|
-
Provider (model): ${PROVIDER_MODEL_DISPLAY}
|
|
530
|
-
Artifacts: ${QA_ARTIFACTS_DESC} (mode=${QA_ARTIFACTS})
|
|
531
|
-
Action: generating QA tests and evidence."
|
|
514
|
+
log "QA: Processing PR #${pr_num}"
|
|
532
515
|
|
|
533
516
|
cleanup_worktrees "${PROJECT_DIR}"
|
|
534
517
|
if ! prepare_detached_worktree "${PROJECT_DIR}" "${QA_WORKTREE_DIR}" "${DEFAULT_BRANCH}" "${LOG_FILE}"; then
|
package/dist/templates/qa.md
CHANGED
|
@@ -37,7 +37,27 @@ Based on the diff, determine:
|
|
|
37
37
|
- **Both**: PR touches both UI and API code
|
|
38
38
|
- **No tests needed**: Trivial changes (docs, config, comments only) โ in this case, post a comment saying "QA: No tests needed for this PR" and stop
|
|
39
39
|
|
|
40
|
-
### Step 3:
|
|
40
|
+
### Step 3: Discover Project Test Conventions
|
|
41
|
+
|
|
42
|
+
Before generating any tests, examine the existing project structure:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Find existing test files to understand conventions
|
|
46
|
+
find . -type f \( -name "*.test.ts" -o -name "*.spec.ts" -o -name "*.test.js" -o -name "*.spec.js" \) \
|
|
47
|
+
! -path "*/node_modules/*" ! -path "*/dist/*" | head -20
|
|
48
|
+
|
|
49
|
+
# Check for test config files
|
|
50
|
+
ls playwright.config.* vitest.config.* jest.config.* 2>/dev/null || true
|
|
51
|
+
cat package.json | grep -A5 '"scripts"'
|
|
52
|
+
|
|
53
|
+
# Check CLAUDE.md if it exists
|
|
54
|
+
cat CLAUDE.md 2>/dev/null || true
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Based on this output:
|
|
58
|
+
- **Identify where existing tests live** (e.g., `src/__tests__/`, `tests/`, `__tests__/`, `spec/`)
|
|
59
|
+
- **Identify naming conventions** (e.g., `*.test.ts`, `*.spec.ts`)
|
|
60
|
+
- **Identify sub-directory structure** (flat, feature-grouped, etc.)
|
|
41
61
|
|
|
42
62
|
**For UI tests (Playwright):**
|
|
43
63
|
|
|
@@ -54,23 +74,27 @@ Based on the diff, determine:
|
|
|
54
74
|
|
|
55
75
|
### Step 4: Generate Tests
|
|
56
76
|
|
|
77
|
+
**Key rule: follow existing conventions. Do not create new folder structures unless they already exist in the project.**
|
|
78
|
+
|
|
57
79
|
**UI Tests (Playwright):**
|
|
58
80
|
|
|
59
|
-
-
|
|
81
|
+
- Place test files alongside existing e2e/Playwright tests (wherever `playwright.config.*` points, or wherever existing `.spec.ts` files live)
|
|
82
|
+
- Do NOT create a new `qa/` subdirectory โ put files directly in the existing test directory with a descriptive name
|
|
60
83
|
- Test the specific feature/page changed in the PR
|
|
61
84
|
- Configure Playwright for artifacts based on `NW_QA_ARTIFACTS`:
|
|
62
85
|
- `"screenshot"`: `screenshot: 'on'` only
|
|
63
86
|
- `"video"`: `video: { mode: 'on', size: { width: 1280, height: 720 } }` only
|
|
64
87
|
- `"both"`: Both screenshot and video enabled
|
|
65
|
-
- Name
|
|
88
|
+
- Name files matching the project's existing convention (e.g., `<feature>.spec.ts`, `<feature>.test.ts`)
|
|
66
89
|
- Include at minimum: navigation to the feature, interaction with key elements, visual assertions
|
|
67
90
|
|
|
68
|
-
**API Tests:**
|
|
91
|
+
**API/Unit Tests:**
|
|
69
92
|
|
|
70
|
-
-
|
|
71
|
-
-
|
|
93
|
+
- Place test files alongside existing tests in the same directory structure
|
|
94
|
+
- Do NOT create a new `qa/` subdirectory โ put files directly in the appropriate existing test directory
|
|
95
|
+
- Test the specific endpoints/functions changed in the PR
|
|
72
96
|
- Include: happy path, error cases, validation checks
|
|
73
|
-
- Name
|
|
97
|
+
- Name files matching the project's existing convention (e.g., `<feature>.test.ts`)
|
|
74
98
|
|
|
75
99
|
### Step 5: Run Tests
|
|
76
100
|
|
|
@@ -101,8 +125,8 @@ mkdir -p qa-artifacts
|
|
|
101
125
|
### Step 7: Commit and Push
|
|
102
126
|
|
|
103
127
|
```bash
|
|
104
|
-
|
|
105
|
-
git add -
|
|
128
|
+
# Stage the specific test files you created (use the exact paths)
|
|
129
|
+
git add <path/to/test-file.test.ts> qa-artifacts/ 2>/dev/null || true
|
|
106
130
|
git commit -m "test(qa): add automated QA tests for PR changes
|
|
107
131
|
|
|
108
132
|
- Generated by Night Watch QA agent
|
|
@@ -163,7 +187,8 @@ Video artifact committed to \`qa-artifacts/\` โ view in the PR's file changes.
|
|
|
163
187
|
### Important Rules
|
|
164
188
|
|
|
165
189
|
- Process each PR **once** per run. Do NOT loop or retry after pushing.
|
|
166
|
-
- Do NOT modify existing project tests โ only add new files
|
|
190
|
+
- Do NOT modify existing project tests โ only add new test files.
|
|
191
|
+
- **Do NOT create new directories** โ place test files inside existing test directories following project conventions. Only create a new directory if the project has absolutely no test infrastructure at all.
|
|
167
192
|
- If tests fail, still commit and report โ the failures are useful information.
|
|
168
193
|
- Keep test files self-contained and independent from each other.
|
|
169
194
|
- Follow the project's existing code style and conventions (check CLAUDE.md, package.json scripts, tsconfig).
|