kwikqa 0.2.4 → 0.2.5
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 +56 -7
- package/dist/kwikqa.mjs +94 -93
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ WebdriverIO wherever your package manager installed it inside the repository, in
|
|
|
182
182
|
| `npx kwikqa analyze --capture` | First re-run the failing tests so every failure has full evidence. Playwright runs with full tracing; with Playwright 1.59+ and [Playwright CLI](https://www.npmjs.com/package/@playwright/cli) installed, it also pauses locator failures at the failing line and asks Playwright for locators of the closest elements (`--no-probe` skips this). Cypress and WebdriverIO re-run the failing specs with your own config plus KwikQA's reporter and failure capture, which records each failed attempt's DOM, command log, console, and network. Asks before running anything; `--yes` approves in CI. |
|
|
183
183
|
| `npx kwikqa analyze --html` | Also write the [failure report](#failure-report), `kwikqa-report.html`; `--output <path>` writes it elsewhere. |
|
|
184
184
|
| `npx kwikqa report` | Write the failure report of the latest analysis without analyzing again or sending anything. `--run <id>` picks an earlier run under `.kwikqa/runs/`; `--output <path>` picks the file. |
|
|
185
|
-
| `npx kwikqa ci` | In a CI job: analyze as `analyze --yes --html` does, then publish a summary. On GitHub Actions that is the job summary and one pull-request comment, on Azure Pipelines a build summary and one pull-request thread,
|
|
185
|
+
| `npx kwikqa ci` | In a CI job: analyze as `analyze --yes --html` does, then publish a summary. On GitHub Actions that is the job summary and one pull-request comment, on Azure Pipelines a build summary and one pull-request thread, on GitLab CI/CD the job's log and one merge-request note, and on Jenkins the console log and one comment on a GitHub or GitLab pull request; with your webhooks, also a Slack or Teams message. See [CI](#ci). Without a KwikQA token it analyzes locally. It takes `--report`, `--framework`, `--local`, `--no-changes`, and `--output` as `analyze` does, and `--notify always` to post to chat after every run, not only failed ones. |
|
|
186
186
|
| `npx kwikqa fix` | Propose a repair for a test-side cause, show the diff and validation commands, and apply it if you approve. First it offers to re-run the failing tests once: a test that passes now is flaky, so KwikQA reports it and requests no repair. It starts with the failure group whose test-side diagnosis is strongest; if the model declines, or its proposal fails KwikQA's checks, it asks about the next such group, at most three, each with its own preview. One `fix` counts as one fix however many groups it tries. `--group <n>` repairs only group n, as `analyze` numbered it. `--propose-only` stops after the proposal. |
|
|
187
187
|
| `npx kwikqa validate` | Run the approved validation. The repaired test must pass three times in a row, with retries off. Passing keeps the patch; failing rolls it back. When other tests failed with the same cause, it then offers to re-run them once and names any that still fail, so you can run `fix` again for them; the patch stays either way. |
|
|
188
188
|
| `npx kwikqa fix --retry` | After a failed validation, re-diagnose from the new evidence and propose one revised patch. |
|
|
@@ -399,10 +399,13 @@ The `exit 1` keeps the job failed: KwikQA exits with the analysis's code, which
|
|
|
399
399
|
|
|
400
400
|
- **Variables.** Add `KWIKQA_TOKEN` and `GITLAB_TOKEN` under Settings → CI/CD → Variables. Mark
|
|
401
401
|
them **masked**, and leave **protected** off, or a feature branch's pipeline won't get them.
|
|
402
|
-
- **The token.** `CI_JOB_TOKEN` can't write notes, so `GITLAB_TOKEN` is a token
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
402
|
+
- **The token.** `CI_JOB_TOKEN` can't write notes, so `GITLAB_TOKEN` is a token of your own, with
|
|
403
|
+
at least the Reporter role. The note is posted as that token's user.
|
|
404
|
+
- A fine-grained personal access token needs only your project, with Work Item read, create, and
|
|
405
|
+
update. GitLab's merge-request notes API comes under Work Item. Make it a dedicated user's if
|
|
406
|
+
you can.
|
|
407
|
+
- Otherwise, a token with the `api` scope: a legacy personal access token, or a project or group
|
|
408
|
+
access token (Premium or Ultimate on GitLab.com, any tier when self-managed).
|
|
406
409
|
- **Merge-request note.** The summary is printed in the job's log and posted as one note on the
|
|
407
410
|
merge request. A re-run of the same job updates it. A merge request pipeline names its merge
|
|
408
411
|
request. A branch pipeline gets a note when its branch has exactly one open merge request in the
|
|
@@ -410,6 +413,52 @@ The `exit 1` keeps the job failed: KwikQA exits with the analysis's code, which
|
|
|
410
413
|
- **Forks.** A fork's merge request pipeline runs in the fork, without your project's variables.
|
|
411
414
|
KwikQA analyzes it locally and skips the note.
|
|
412
415
|
|
|
416
|
+
### Jenkins
|
|
417
|
+
|
|
418
|
+
In a Pipeline, run `kwikqa ci` when the tests fail, with its tokens bound only around it. The agent
|
|
419
|
+
needs Node.js 20.11 or later.
|
|
420
|
+
|
|
421
|
+
```groovy
|
|
422
|
+
stage('e2e') {
|
|
423
|
+
steps {
|
|
424
|
+
sh 'npm ci'
|
|
425
|
+
sh 'npx playwright test'
|
|
426
|
+
}
|
|
427
|
+
post {
|
|
428
|
+
failure {
|
|
429
|
+
withCredentials([
|
|
430
|
+
string(credentialsId: 'kwikqa-token', variable: 'KWIKQA_TOKEN'),
|
|
431
|
+
string(credentialsId: 'github-token', variable: 'GITHUB_TOKEN'),
|
|
432
|
+
]) {
|
|
433
|
+
sh 'npx kwikqa ci'
|
|
434
|
+
}
|
|
435
|
+
archiveArtifacts artifacts: 'kwikqa-report.html', allowEmptyArchive: true
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
- **Summary.** It's printed in the build's console log, with a link to the build, where the
|
|
442
|
+
archived report is.
|
|
443
|
+
- **Pull-request comment.** In a multibranch project, a pull request's build knows its pull
|
|
444
|
+
request from the branch source. KwikQA comments on it through its host, and a rebuild updates
|
|
445
|
+
the comment:
|
|
446
|
+
- GitHub, including GitHub Enterprise, with `GITHUB_TOKEN`: a fine-grained token with Pull
|
|
447
|
+
requests read and write on the repository, or a classic token with the `repo` scope. A GitHub
|
|
448
|
+
App credential works too, bound with `usernamePassword(credentialsId: 'github-app',
|
|
449
|
+
usernameVariable: 'GITHUB_APP', passwordVariable: 'GITHUB_TOKEN')`. Its token lasts an hour, so
|
|
450
|
+
bind it around `kwikqa ci`, as above.
|
|
451
|
+
- GitLab, with `GITLAB_TOKEN`, a token as in [GitLab CI/CD](#gitlab-cicd).
|
|
452
|
+
- Bitbucket and other hosts get no comment yet.
|
|
453
|
+
- **Forks.** Jenkins gives a fork's pull request build the credentials its Jenkinsfile binds, and
|
|
454
|
+
that build runs the fork's code, its `package.json` included. If you build pull requests from
|
|
455
|
+
forks you don't trust, don't bind tokens in their builds. The branch source's trust setting only
|
|
456
|
+
decides whose Jenkinsfile runs.
|
|
457
|
+
- **The report.** Jenkins serves an archived page with its script and styles blocked, and the report
|
|
458
|
+
stays readable that way. For its styles and filters too, set a Resource Root URL on another host
|
|
459
|
+
name, under Manage Jenkins → System → "Serve resource files from another domain". Don't loosen
|
|
460
|
+
Jenkins' Content-Security-Policy instead.
|
|
461
|
+
|
|
413
462
|
### Slack and Microsoft Teams
|
|
414
463
|
|
|
415
464
|
`kwikqa ci` posts the run to the incoming webhooks you store as CI secrets. KwikQA keeps no webhook
|
|
@@ -429,8 +478,8 @@ a wider audience than a build log. KwikQA posts only when tests failed, unless y
|
|
|
429
478
|
|
|
430
479
|
### Other CI systems
|
|
431
480
|
|
|
432
|
-
On
|
|
433
|
-
|
|
481
|
+
On other CI systems, `npx kwikqa ci` writes the report and posts to Slack and Teams, but writes no
|
|
482
|
+
summary or comment yet:
|
|
434
483
|
|
|
435
484
|
```sh
|
|
436
485
|
npx playwright test || { npx kwikqa ci; exit 1; }
|