playwright-smart-test 1.0.8 โ 1.0.10
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/README.md +61 -31
- package/dist/cli/index.js +12 -1
- package/dist/diff/git-diff-analyzer.js +46 -7
- package/dist/reporters/github-reporter.d.ts +1 -0
- package/dist/reporters/github-reporter.js +34 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,13 +158,13 @@ Generate a starter configuration with `npx playwright-smart-test init` or create
|
|
|
158
158
|
},
|
|
159
159
|
"ai": {
|
|
160
160
|
"provider": "gemini",
|
|
161
|
-
"model": "gemini-3.
|
|
161
|
+
"model": "gemini-3.5-flash-lite",
|
|
162
162
|
"temperature": 0.2
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
> **Model Flexibility**: You can configure any Gemini model (e.g. `gemini-3.
|
|
167
|
+
> **Model Flexibility**: You can configure any Gemini model (e.g. `gemini-3.5-flash-lite`, `gemini-2.5-flash`, `gemini-1.5-flash`, `gemini-1.5-pro`) or override it dynamically via the `GEMINI_MODEL` environment variable.
|
|
168
168
|
|
|
169
169
|
---
|
|
170
170
|
|
|
@@ -178,8 +178,11 @@ Generate a starter configuration with `npx playwright-smart-test init` or create
|
|
|
178
178
|
| `playwright-smart-test init` | Generates a starter `playwright-smart-test.config.json` configuration file. |
|
|
179
179
|
|
|
180
180
|
### CLI Options
|
|
181
|
-
* `-b, --base <ref>`: Target Git branch or
|
|
182
|
-
* `-h, --head <ref>`: Head Git commit/branch (default: working directory
|
|
181
|
+
* `-b, --base <ref>`: Target Git branch, commit, or tag to diff against. Supports remote references (`origin/main`), local branches (`main`), commit SHAs, and ancestor specifiers (`HEAD~1`, `origin/main~2`, `HEAD^`).
|
|
182
|
+
* `-h, --head <ref>`: Head Git commit/branch (default: `HEAD` or uncommitted working directory).
|
|
183
|
+
* `--fail-on-empty`: Exit with status code 1 if 0 modified files are detected against the base ref (safeguard against empty diffs or un-fetched base refs in CI).
|
|
184
|
+
* `--comment`: Automatically post or update an interactive PR comment on GitHub and append the report to `$GITHUB_STEP_SUMMARY`.
|
|
185
|
+
* `--cwd <dir>`: Target working directory (defaults to `process.cwd()`).
|
|
183
186
|
* `--staged`: Analyze only staged git changes.
|
|
184
187
|
* `-c, --config <path>`: Path to custom configuration file.
|
|
185
188
|
* `-o, --output <path>`: Save report to `.md` or `.json` (e.g. `--output report.md`).
|
|
@@ -189,83 +192,110 @@ Generate a starter configuration with `npx playwright-smart-test init` or create
|
|
|
189
192
|
|
|
190
193
|
## ๐ GitHub Actions CI/CD Integration
|
|
191
194
|
|
|
192
|
-
Add this step to your Pull Request workflow (`.github/workflows/regression.yml`):
|
|
195
|
+
Add this step to your Pull Request workflow (`.github/workflows/smart-regression.yml`):
|
|
193
196
|
|
|
194
197
|
```yaml
|
|
195
198
|
name: Playwright Smart Regression
|
|
196
199
|
|
|
197
200
|
on:
|
|
198
201
|
pull_request:
|
|
199
|
-
|
|
202
|
+
types: [opened, synchronize, reopened]
|
|
203
|
+
push:
|
|
204
|
+
branches: [main]
|
|
200
205
|
|
|
201
206
|
jobs:
|
|
202
|
-
|
|
207
|
+
smart-regression:
|
|
203
208
|
runs-on: ubuntu-latest
|
|
209
|
+
permissions:
|
|
210
|
+
contents: read
|
|
211
|
+
issues: write # Required for posting/updating PR comments
|
|
212
|
+
pull-requests: write # Required for PR comment metadata
|
|
213
|
+
|
|
204
214
|
steps:
|
|
205
|
-
- name: Checkout
|
|
215
|
+
- name: Checkout code
|
|
206
216
|
uses: actions/checkout@v4
|
|
207
217
|
with:
|
|
208
|
-
|
|
218
|
+
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
|
219
|
+
fetch-depth: 0 # Full history needed for git diff
|
|
220
|
+
|
|
221
|
+
- name: Fetch target base branch
|
|
222
|
+
if: github.event_name == 'pull_request'
|
|
223
|
+
run: |
|
|
224
|
+
git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
|
|
209
225
|
|
|
210
226
|
- name: Setup Node.js
|
|
211
227
|
uses: actions/setup-node@v4
|
|
212
228
|
with:
|
|
213
|
-
node-version:
|
|
229
|
+
node-version: 22
|
|
214
230
|
cache: 'npm'
|
|
215
231
|
|
|
216
|
-
- name: Install
|
|
232
|
+
- name: Install dependencies
|
|
217
233
|
run: npm ci
|
|
218
234
|
|
|
219
|
-
- name: Install Playwright
|
|
220
|
-
run: npx playwright install --with-deps
|
|
235
|
+
- name: Install Playwright Chromium
|
|
236
|
+
run: npx playwright install --with-deps chromium
|
|
221
237
|
|
|
222
|
-
- name: Run Smart Regression
|
|
223
|
-
id: smart-regression
|
|
238
|
+
- name: Run AI Smart Regression Selection & Targeted E2E Tests
|
|
224
239
|
env:
|
|
225
240
|
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
|
241
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
226
242
|
run: |
|
|
227
|
-
npx playwright-smart-test
|
|
228
|
-
npx playwright-smart-test run --base "origin/${{ github.base_ref }}"
|
|
229
|
-
|
|
230
|
-
- name: Post PR Comment
|
|
231
|
-
if: always()
|
|
232
|
-
uses: thollander/actions-comment-pull-request@v2
|
|
233
|
-
with:
|
|
234
|
-
filePath: pr-report.md
|
|
235
|
-
comment_tag: smart-regression-report
|
|
243
|
+
npx playwright-smart-test run --comment --fail-on-empty --base "${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || 'HEAD~1' }}"
|
|
236
244
|
```
|
|
237
245
|
|
|
238
246
|
---
|
|
239
247
|
|
|
248
|
+
> [!TIP]
|
|
249
|
+
> Always execute with `npx playwright-smart-test` (or `npm exec -- playwright-smart-test`) rather than bare `npm exec`. In `npm 10`, flags passed after binary subcommands without the `--` separator may be intercepted by `npm exec` rather than reaching the CLI agent.
|
|
250
|
+
>
|
|
251
|
+
> Also ensure `actions/checkout` specifies `fetch-depth: 0` so full git history is available to calculate diffs against the base branch.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
240
255
|
## ๐ Sample PR Impact Report
|
|
241
256
|
|
|
242
|
-
When running `playwright-smart-test comment` or
|
|
257
|
+
When running `playwright-smart-test run --comment` or `playwright-smart-test comment`, the agent automatically posts an interactive analysis report directly to the GitHub Pull Request and GitHub Actions Step Summary:
|
|
243
258
|
|
|
244
259
|
```markdown
|
|
245
260
|
## ๐ค Playwright Smart Regression Selection Report
|
|
246
261
|
|
|
247
|
-
|
|
262
|
+
### ๐ Impact & Risk Assessment
|
|
248
263
|
|
|
249
|
-
|
|
|
264
|
+
| Metric | Assessment |
|
|
250
265
|
| :--- | :--- |
|
|
266
|
+
| **Overall Risk** | ๐ **HIGH** |
|
|
267
|
+
| **Analysis Confidence** | ๐ข **HIGH** |
|
|
251
268
|
| **Changed Components** | `checkout`, `payment` |
|
|
252
269
|
| **Potentially Impacted Areas** | `cart`, `order-summary` |
|
|
253
270
|
|
|
254
271
|
### ๐ง AI Semantic Rationale
|
|
272
|
+
|
|
255
273
|
- **Direct Impact:** Modified voucher code calculation logic in CheckoutPage.
|
|
256
274
|
- **Ripple Effects:** Discount changes propagate into final payment charge payload.
|
|
257
275
|
|
|
276
|
+
<details>
|
|
277
|
+
<summary><b>๐ Modified Files Analyzed (3)</b></summary>
|
|
278
|
+
|
|
279
|
+
| File | Status | Diff Lines |
|
|
280
|
+
| :--- | :---: | :---: |
|
|
281
|
+
| `src/components/Checkout.tsx` | ๐ก Modified | +24 / -8 |
|
|
282
|
+
| `src/components/Payment.tsx` | ๐ก Modified | +12 / -3 |
|
|
283
|
+
| `src/types.ts` | ๐ก Modified | +2 / -0 |
|
|
284
|
+
|
|
285
|
+
</details>
|
|
286
|
+
|
|
258
287
|
### ๐งช Selected Regression Tests (3)
|
|
259
288
|
|
|
260
289
|
| Spec File | Selection Type | Rationale |
|
|
261
290
|
| :--- | :---: | :--- |
|
|
262
|
-
| `tests/checkout.spec.ts` | ๐ข Direct | Directly touches changed component 'checkout'. |
|
|
263
|
-
| `tests/payment.spec.ts` | ๐ก Ripple | Indirectly impacted by ripple effects on domain 'payment'. |
|
|
264
|
-
| `tests/cart.spec.ts` | ๐ก Ripple | Indirectly impacted by ripple effects on domain 'cart'. |
|
|
291
|
+
| `playwright/e2e/tests/checkout.spec.ts` | ๐ข Direct | Directly touches changed component 'checkout'. |
|
|
292
|
+
| `playwright/e2e/tests/payment.spec.ts` | ๐ก Ripple | Indirectly impacted by ripple effects on domain 'payment'. |
|
|
293
|
+
| `playwright/e2e/tests/cart.spec.ts` | ๐ก Ripple | Indirectly impacted by ripple effects on domain 'cart'. |
|
|
265
294
|
|
|
266
295
|
### โก Playwright Execution Command
|
|
296
|
+
|
|
267
297
|
```bash
|
|
268
|
-
npx playwright test "tests/checkout.spec.ts" "tests/payment.spec.ts" "tests/cart.spec.ts"
|
|
298
|
+
npx playwright test "playwright/e2e/tests/checkout.spec.ts" "playwright/e2e/tests/payment.spec.ts" "playwright/e2e/tests/cart.spec.ts"
|
|
269
299
|
```
|
|
270
300
|
```
|
|
271
301
|
|
package/dist/cli/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const program = new Command();
|
|
|
15
15
|
program
|
|
16
16
|
.name('playwright-smart-test')
|
|
17
17
|
.description('AI-Powered Smart Regression Test Selection Agent for Playwright')
|
|
18
|
-
.version('1.0.
|
|
18
|
+
.version('1.0.10');
|
|
19
19
|
async function executeAnalysis(options) {
|
|
20
20
|
const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd();
|
|
21
21
|
const config = loadConfig(cwd, options.config);
|
|
@@ -27,6 +27,14 @@ async function executeAnalysis(options) {
|
|
|
27
27
|
staged: options.staged,
|
|
28
28
|
});
|
|
29
29
|
console.log(`Detected ${pc.yellow(changedFiles.length.toString())} modified files.`);
|
|
30
|
+
if (changedFiles.length === 0) {
|
|
31
|
+
if (options.base) {
|
|
32
|
+
console.warn(pc.yellow(`โ ๏ธ [playwright-smart-test] Warning: 0 modified files detected against base '${options.base}'. Verify that '${options.base}' exists and has distinct commits relative to HEAD.`));
|
|
33
|
+
}
|
|
34
|
+
if (options.failOnEmpty) {
|
|
35
|
+
throw new Error(`0 modified files detected against base '${options.base || 'HEAD'}'. Aborting because --fail-on-empty was specified.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
30
38
|
const catalogIndexer = new TestCatalogIndexer(cwd);
|
|
31
39
|
const catalog = await catalogIndexer.scanTestFiles(config.testDir, config.testMatch);
|
|
32
40
|
console.log(`Indexed ${pc.yellow(catalog.length.toString())} Playwright spec files in '${config.testDir}'.`);
|
|
@@ -43,6 +51,7 @@ program
|
|
|
43
51
|
.option('-c, --config <path>', 'Path to custom config file')
|
|
44
52
|
.option('-o, --output <path>', 'Save analysis result to file (.json or .md)')
|
|
45
53
|
.option('--cwd <dir>', 'Working directory', process.cwd())
|
|
54
|
+
.option('--fail-on-empty', 'Exit with error code 1 if 0 modified files are detected')
|
|
46
55
|
.action(async (options) => {
|
|
47
56
|
try {
|
|
48
57
|
const { result } = await executeAnalysis(options);
|
|
@@ -75,6 +84,7 @@ program
|
|
|
75
84
|
.option('--cwd <dir>', 'Working directory', process.cwd())
|
|
76
85
|
.option('--dry-run', 'Print the command without executing')
|
|
77
86
|
.option('--comment', 'Automatically post or update PR comment and step summary on GitHub')
|
|
87
|
+
.option('--fail-on-empty', 'Exit with error code 1 if 0 modified files are detected')
|
|
78
88
|
.action(async (options) => {
|
|
79
89
|
try {
|
|
80
90
|
const { result, cwd } = await executeAnalysis(options);
|
|
@@ -111,6 +121,7 @@ program
|
|
|
111
121
|
.option('--repo <owner/repo>', 'Explicit GitHub repository')
|
|
112
122
|
.option('--token <token>', 'Explicit GitHub Token')
|
|
113
123
|
.option('--stdout', 'Only output markdown to stdout without attempting GitHub API post')
|
|
124
|
+
.option('--fail-on-empty', 'Exit with error code 1 if 0 modified files are detected')
|
|
114
125
|
.action(async (options) => {
|
|
115
126
|
try {
|
|
116
127
|
const { result } = await executeAnalysis(options);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { promisify } from 'node:util';
|
|
3
|
+
import pc from 'picocolors';
|
|
3
4
|
const execFileAsync = promisify(execFile);
|
|
4
5
|
export class GitDiffAnalyzer {
|
|
5
6
|
cwd;
|
|
@@ -33,7 +34,7 @@ export class GitDiffAnalyzer {
|
|
|
33
34
|
if (safeRef.startsWith('/') || safeRef.endsWith('/')) {
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
|
-
const validPattern = /^(?:HEAD|[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*|refs\/(?:heads|remotes|tags)\/[A-Za-z0-9._/-]+)
|
|
37
|
+
const validPattern = /^(?:HEAD|[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*|refs\/(?:heads|remotes|tags)\/[A-Za-z0-9._/-]+)(?:~[0-9]+|\^[0-9]*)*$/;
|
|
37
38
|
if (!validPattern.test(safeRef)) {
|
|
38
39
|
return null;
|
|
39
40
|
}
|
|
@@ -57,6 +58,12 @@ export class GitDiffAnalyzer {
|
|
|
57
58
|
}
|
|
58
59
|
async getChangedFiles(options = {}) {
|
|
59
60
|
await this.runGit(['rev-parse', '--is-inside-work-tree']);
|
|
61
|
+
if (options.base && !this.sanitizeGitRef(options.base)) {
|
|
62
|
+
throw new Error(`Invalid base git reference '${options.base}'. Reference contains disallowed characters or formatting.`);
|
|
63
|
+
}
|
|
64
|
+
if (options.head && !this.sanitizeGitRef(options.head)) {
|
|
65
|
+
throw new Error(`Invalid head git reference '${options.head}'. Reference contains disallowed characters or formatting.`);
|
|
66
|
+
}
|
|
60
67
|
const safeBase = this.sanitizeGitRef(options.base);
|
|
61
68
|
const safeHead = this.sanitizeGitRef(options.head) ?? 'HEAD';
|
|
62
69
|
if (safeBase) {
|
|
@@ -64,11 +71,15 @@ export class GitDiffAnalyzer {
|
|
|
64
71
|
await this.runGit(['rev-parse', '--verify', safeBase]);
|
|
65
72
|
}
|
|
66
73
|
catch {
|
|
67
|
-
const remoteRef = this.parseRemoteRef(safeBase);
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
const remoteRef = this.parseRemoteRef(safeBase) ?? { remote: 'origin', branch: safeBase };
|
|
75
|
+
const { remote, branch } = remoteRef;
|
|
76
|
+
const fetchBranch = branch.replace(/[~^].*$/, '');
|
|
77
|
+
try {
|
|
78
|
+
await this.runGit(['fetch', '--depth=100', remote, `+refs/heads/${fetchBranch}:refs/remotes/${remote}/${fetchBranch}`]);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
70
81
|
try {
|
|
71
|
-
await this.runGit(['fetch', '--depth=100', remote,
|
|
82
|
+
await this.runGit(['fetch', '--depth=100', remote, `+${fetchBranch}:refs/remotes/${remote}/${fetchBranch}`]);
|
|
72
83
|
}
|
|
73
84
|
catch {
|
|
74
85
|
// Ignore fetch failure and proceed with available refs.
|
|
@@ -89,17 +100,23 @@ export class GitDiffAnalyzer {
|
|
|
89
100
|
else {
|
|
90
101
|
diffRangeArgs = ['HEAD'];
|
|
91
102
|
}
|
|
103
|
+
console.log(pc.dim(`[playwright-smart-test] Comparing git diff using: git diff --numstat ${diffRangeArgs.join(' ')}`));
|
|
92
104
|
let numstatOutput;
|
|
93
105
|
try {
|
|
94
106
|
numstatOutput = await this.runGit(['diff', '--numstat', ...diffRangeArgs]);
|
|
95
107
|
}
|
|
96
|
-
catch {
|
|
108
|
+
catch (diffErr) {
|
|
97
109
|
const fallbackArgs = safeBase ? [safeBase] : ['HEAD'];
|
|
98
110
|
try {
|
|
99
111
|
numstatOutput = await this.runGit(['diff', '--numstat', ...fallbackArgs]);
|
|
100
112
|
diffRangeArgs = fallbackArgs;
|
|
101
113
|
}
|
|
102
|
-
catch {
|
|
114
|
+
catch (fallbackErr) {
|
|
115
|
+
const diffMessage = diffErr instanceof Error ? diffErr.message : String(diffErr);
|
|
116
|
+
if (safeBase) {
|
|
117
|
+
throw new Error(`Git diff failed for base '${safeBase}': ${diffMessage}`);
|
|
118
|
+
}
|
|
119
|
+
console.warn(`[playwright-smart-test] Warning: git diff failed for [${diffRangeArgs.join(' ')}] and fallback [${fallbackArgs.join(' ')}]: ${diffMessage}`);
|
|
103
120
|
numstatOutput = '';
|
|
104
121
|
}
|
|
105
122
|
}
|
|
@@ -134,6 +151,28 @@ export class GitDiffAnalyzer {
|
|
|
134
151
|
patch,
|
|
135
152
|
};
|
|
136
153
|
});
|
|
154
|
+
// Also include untracked files when diffing locally against working tree without base
|
|
155
|
+
if (!safeBase && !options.staged) {
|
|
156
|
+
try {
|
|
157
|
+
const untrackedOutput = await this.runGit(['ls-files', '--others', '--exclude-standard']);
|
|
158
|
+
const untrackedFiles = untrackedOutput.split('\n').map((l) => l.trim()).filter(Boolean);
|
|
159
|
+
for (const filePath of untrackedFiles) {
|
|
160
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
161
|
+
if (!allPaths.includes(normalized)) {
|
|
162
|
+
files.push({
|
|
163
|
+
path: normalized,
|
|
164
|
+
status: 'added',
|
|
165
|
+
additions: 1,
|
|
166
|
+
deletions: 0,
|
|
167
|
+
patch: '',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
// ls-files optional fallback
|
|
174
|
+
}
|
|
175
|
+
}
|
|
137
176
|
return files;
|
|
138
177
|
}
|
|
139
178
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export class GitHubReporter {
|
|
2
2
|
static generateMarkdown(result) {
|
|
3
3
|
const riskBadge = this.getRiskBadge(result.aiAnalysis.riskScore);
|
|
4
|
+
const confidenceBadge = this.getConfidenceBadge(result.aiAnalysis.confidenceScore);
|
|
4
5
|
const changedBadges = result.changedComponents.length > 0
|
|
5
6
|
? result.changedComponents.map((c) => `\`${c}\``).join(', ')
|
|
6
7
|
: '_None identified_';
|
|
@@ -8,7 +9,6 @@ export class GitHubReporter {
|
|
|
8
9
|
? result.impactedComponents.map((c) => `\`${c}\``).join(', ')
|
|
9
10
|
: '_None_';
|
|
10
11
|
let markdown = `## ๐ค Playwright Smart Regression Selection Report\n\n`;
|
|
11
|
-
markdown += `**Risk Level:** ${riskBadge}\n\n`;
|
|
12
12
|
if (result.isFullRegression) {
|
|
13
13
|
markdown += `> [!WARNING]\n`;
|
|
14
14
|
markdown += `> **Full Regression Suite Triggered**: ${result.fullRegressionReason || 'Critical configuration or high impact threshold reached.'}\n\n`;
|
|
@@ -17,16 +17,35 @@ export class GitHubReporter {
|
|
|
17
17
|
markdown += `> [!NOTE]\n`;
|
|
18
18
|
markdown += `> **Smoke Safety Net Activated**: ${result.smokeFallbackReason}\n\n`;
|
|
19
19
|
}
|
|
20
|
-
markdown +=
|
|
20
|
+
markdown += `### ๐ Impact & Risk Assessment\n\n`;
|
|
21
|
+
markdown += `| Metric | Assessment |\n`;
|
|
21
22
|
markdown += `| :--- | :--- |\n`;
|
|
23
|
+
markdown += `| **Overall Risk** | ${riskBadge} |\n`;
|
|
24
|
+
markdown += `| **Analysis Confidence** | ${confidenceBadge} |\n`;
|
|
22
25
|
markdown += `| **Changed Components** | ${changedBadges} |\n`;
|
|
23
26
|
markdown += `| **Potentially Impacted Areas** | ${impactedBadges} |\n\n`;
|
|
24
|
-
markdown += `### ๐ง AI Semantic Rationale\n`;
|
|
27
|
+
markdown += `### ๐ง AI Semantic Rationale\n\n`;
|
|
25
28
|
markdown += `- **Direct Impact:** ${result.aiAnalysis.directReason}\n`;
|
|
26
29
|
if (result.aiAnalysis.rippleEffectReason) {
|
|
27
30
|
markdown += `- **Ripple Effects:** ${result.aiAnalysis.rippleEffectReason}\n`;
|
|
28
31
|
}
|
|
29
32
|
markdown += `\n`;
|
|
33
|
+
if (result.changedFiles && result.changedFiles.length > 0) {
|
|
34
|
+
markdown += `<details>\n<summary><b>๐ Modified Files Analyzed (${result.changedFiles.length})</b></summary>\n\n`;
|
|
35
|
+
markdown += `| File | Status | Diff Lines |\n`;
|
|
36
|
+
markdown += `| :--- | :---: | :---: |\n`;
|
|
37
|
+
for (const file of result.changedFiles) {
|
|
38
|
+
const statusBadge = file.status === 'added'
|
|
39
|
+
? '๐ข Added'
|
|
40
|
+
: file.status === 'deleted'
|
|
41
|
+
? '๐ด Deleted'
|
|
42
|
+
: file.status === 'renamed'
|
|
43
|
+
? '๐ต Renamed'
|
|
44
|
+
: '๐ก Modified';
|
|
45
|
+
markdown += `| \`${file.path}\` | ${statusBadge} | +${file.additions} / -${file.deletions} |\n`;
|
|
46
|
+
}
|
|
47
|
+
markdown += `\n</details>\n\n`;
|
|
48
|
+
}
|
|
30
49
|
markdown += `### ๐งช Selected Regression Tests (${result.selectedSpecs.length})\n\n`;
|
|
31
50
|
if (result.selectedSpecs.length === 0) {
|
|
32
51
|
markdown += `_No tests selected. Changes do not impact any existing test suites._\n\n`;
|
|
@@ -51,7 +70,7 @@ export class GitHubReporter {
|
|
|
51
70
|
}
|
|
52
71
|
markdown += `\n`;
|
|
53
72
|
}
|
|
54
|
-
markdown += `### โก Playwright Execution Command\n`;
|
|
73
|
+
markdown += `### โก Playwright Execution Command\n\n`;
|
|
55
74
|
if (result.selectedSpecs.length === 0 && !result.isFullRegression) {
|
|
56
75
|
markdown += `_No tests executed (0 impacted tests identified)._\n\n`;
|
|
57
76
|
}
|
|
@@ -74,4 +93,15 @@ export class GitHubReporter {
|
|
|
74
93
|
return '๐ข **LOW**';
|
|
75
94
|
}
|
|
76
95
|
}
|
|
96
|
+
static getConfidenceBadge(confidence) {
|
|
97
|
+
switch (confidence) {
|
|
98
|
+
case 'HIGH':
|
|
99
|
+
return '๐ข **HIGH**';
|
|
100
|
+
case 'LOW':
|
|
101
|
+
return '๐ด **LOW**';
|
|
102
|
+
case 'MEDIUM':
|
|
103
|
+
default:
|
|
104
|
+
return '๐ก **MEDIUM**';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
77
107
|
}
|