kwikqa 0.1.1 → 0.2.1

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.
Files changed (3) hide show
  1. package/README.md +157 -4
  2. package/dist/kwikqa.mjs +204 -79
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -40,6 +40,9 @@ Using pnpm, Yarn, or Bun? See [Package managers and monorepos](#package-managers
40
40
  pnpm, Yarn, or Bun. KwikQA runs your project's own copy and never installs packages or browsers.
41
41
  - A git repository
42
42
 
43
+ For repairs, KwikQA needs one of those three frameworks. It also reads and diagnoses runs from
44
+ [other test frameworks](#other-test-frameworks).
45
+
43
46
  ## Setup
44
47
 
45
48
  ```sh
@@ -94,6 +97,64 @@ failing specs and records each failure's page (see below).
94
97
 
95
98
  `login` signs you in with GitHub; the free plan needs no payment details.
96
99
 
100
+ ### Other test frameworks
101
+
102
+ KwikQA also reads the reports these write, and diagnoses the run:
103
+
104
+ - Vitest (`--reporter=junit`);
105
+ - Jest (`jest-junit`);
106
+ - Mocha (`mocha-junit-reporter`);
107
+ - pytest (`--junitxml`);
108
+ - Playwright's own `junit` reporter;
109
+ - JUnit and TestNG through Maven Surefire or Failsafe (`target/surefire-reports`), including
110
+ Selenium tests;
111
+ - JUnit and TestNG through Gradle (`build/test-results/test`), including the test-retry plugin's
112
+ retries;
113
+ - TestNG's own `testng-results.xml`;
114
+ - Allure results (`allure-results`) from TestNG, JUnit, Playwright, and pytest;
115
+ - CTRF reports, from Playwright, Jest, pytest, and other tools that write them;
116
+ - Cucumber's JSON report, from cucumber-js (`--format json:<file>`) and Cucumber-JVM (the `json`
117
+ plugin).
118
+
119
+ Point `--report` at the file or its directory:
120
+
121
+ ```sh
122
+ npx kwikqa analyze --report reports/junit.xml --html
123
+ ```
124
+
125
+ You get failure groups, a diagnosis, and the [failure report](#failure-report). KwikQA doesn't
126
+ capture, repair, or validate these runs, and `fix` says so before it sends anything. For Playwright
127
+ repairs, use its JSON reporter as shown above.
128
+
129
+ Some details depend on the reporter:
130
+
131
+ - For TestNG, `testng-results.xml` keeps retried attempts and failed configuration methods, which
132
+ Surefire's XML of the same run doesn't correlate. Under Maven, add TestNG's XML reporter to
133
+ Surefire's configuration, then point `--report` at `test-output`:
134
+
135
+ ```xml
136
+ <properties>
137
+ <property>
138
+ <name>listener</name>
139
+ <value>org.testng.reporters.XMLReporter</value>
140
+ </property>
141
+ </properties>
142
+ ```
143
+ - Allure adds each run's results to its directory, and KwikQA reads the directory as one run, so
144
+ clean it between runs: `mvn clean`, or pytest's `--clean-alluredir`. Otherwise an earlier run's
145
+ results read as retries.
146
+ - Cucumber's JSON keeps only each scenario's final attempt, so a scenario that passed on a retry
147
+ reads as passed. Cucumber-JVM 8 needs a JSON library on the test class path to write it, such as
148
+ `tools.jackson.core:jackson-databind`.
149
+ - Gradle names a JUnit parameterized test by its display name, which includes its arguments. To
150
+ keep test data out of KwikQA's titles, set
151
+ `junit.jupiter.params.displayname.default = {displayName}[{index}]` in
152
+ `junit-platform.properties`.
153
+ - jest-junit records no test file unless you set `addFileAttribute: true`.
154
+ - pytest records each test's line only with `-o junit_family=xunit1`.
155
+ - JUnit XML from a tool KwikQA doesn't recognize is still read and diagnosed, as an unidentified
156
+ framework.
157
+
97
158
  ### Package managers and monorepos
98
159
 
99
160
  This page uses npm's commands. With another package manager, install and run KwikQA the same way:
@@ -119,6 +180,9 @@ WebdriverIO wherever your package manager installed it inside the repository, in
119
180
  | --- | --- |
120
181
  | `npx kwikqa analyze` | Diagnose the failures in the latest report. `--report <path>` picks a report file or a directory of one run's reports; `--framework` names the framework of a JUnit report; `--local` builds the evidence summary without sending anything; `--no-changes` leaves out recent code changes (see below). |
121
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
+ | `npx kwikqa analyze --html` | Also write the [failure report](#failure-report), `kwikqa-report.html`; `--output <path>` writes it elsewhere. |
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; 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. |
122
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. |
123
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. |
124
188
  | `npx kwikqa fix --retry` | After a failed validation, re-diagnose from the new evidence and propose one revised patch. |
@@ -130,6 +194,27 @@ WebdriverIO wherever your package manager installed it inside the repository, in
130
194
  Exit codes: `0` success or an informative result, `1` the repair or validation did not succeed, `2`
131
195
  usage error, `3` sign-in, plan, or usage-limit problem.
132
196
 
197
+ ## Failure report
198
+
199
+ `npx kwikqa analyze --html`, or `npx kwikqa report` after an analysis, writes one HTML file,
200
+ `kwikqa-report.html`. It shows:
201
+
202
+ - the run's counts;
203
+ - each failure group, numbered as `analyze` numbered it, with its tests, its owner (test code,
204
+ application, or environment), the diagnosis, and the evidence the diagnosis cites;
205
+ - flaky tests and failures no rule could classify;
206
+ - what KwikQA could see for each evidence channel, and every request that was sent.
207
+
208
+ A local analysis (`--local`) gets the same report without owners. Writing a report is free on
209
+ every plan and needs no sign-in. `kwikqa report` rebuilds the evidence from the same test report and
210
+ artifacts. If those have changed since the analysis, it says so instead of showing evidence the
211
+ diagnosis did not see.
212
+
213
+ The file is self-contained: it loads nothing from the network, and it stays readable when a viewer
214
+ blocks its script and styles, as Jenkins does for archived HTML by default. It holds the same
215
+ redacted evidence a request preview shows, so share it the way you share CI logs. KwikQA only ever
216
+ replaces a file it wrote itself, and `init` offers to add `kwikqa-report.html` to `.gitignore`.
217
+
133
218
  ## Plans
134
219
 
135
220
  | Plan | Monthly | Annual | Analyses / month | Fixes / month |
@@ -217,14 +302,82 @@ Run records, transaction journals, captures, and validation output stay on your
217
302
 
218
303
  ## CI
219
304
 
220
- `analyze` can run unattended; `fix` cannot, because applying a patch always needs a person.
305
+ `analyze` and `ci` run unattended; `fix` doesn't, because applying a patch always needs a person.
306
+ Create a CI token at https://kwikqa.com/dashboard/account/ and store it as the secret
307
+ `KWIKQA_TOKEN`. Running KwikQA with it approves its diagnosis requests, and each request's preview
308
+ is printed to the job's log.
309
+
310
+ ### GitHub Actions
311
+
312
+ `npx kwikqa ci` analyzes the failed run, writes `kwikqa-report.html`, and publishes a summary: one
313
+ row per failure group with its owner and evidence grade, the flaky tests, and a pointer to the
314
+ report. It holds no error text or evidence; the report does.
315
+
316
+ ```yaml
317
+ permissions:
318
+ contents: read
319
+ pull-requests: write # only for the comment
320
+ steps:
321
+ - uses: actions/checkout@v7
322
+ - run: npx playwright test
323
+ - if: failure()
324
+ run: npx kwikqa ci
325
+ env:
326
+ KWIKQA_TOKEN: ${{ secrets.KWIKQA_TOKEN }}
327
+ GITHUB_TOKEN: ${{ github.token }}
328
+ # Optional, see "Slack and Microsoft Teams" below
329
+ KWIKQA_SLACK_WEBHOOK_URL: ${{ secrets.KWIKQA_SLACK_WEBHOOK_URL }}
330
+ KWIKQA_TEAMS_WEBHOOK_URL: ${{ secrets.KWIKQA_TEAMS_WEBHOOK_URL }}
331
+ - if: failure()
332
+ uses: actions/upload-artifact@v7
333
+ with:
334
+ name: kwikqa-report
335
+ path: kwikqa-report.html
336
+ ```
337
+
338
+ - **Job summary.** The summary is shown on the run's page.
339
+ - **Pull-request comment.** On a pull request, the summary is also one comment. A re-run of the
340
+ same workflow job updates that comment instead of adding another, and a later run with no
341
+ failures updates it to say so. Each job of a workflow keeps its own comment; jobs of one matrix
342
+ share one, so analyze a sharded run once, after merging its reports.
343
+ - **Pull requests from forks.** GitHub gives a fork's workflows no secrets and a read-only token.
344
+ KwikQA analyzes such a run locally, writes the report and the summary, and skips the comment.
345
+ Don't switch to `pull_request_target` to get the token: it runs the fork's code with your
346
+ repository's secrets.
347
+ - **Never the cause of a failed build.** A comment or summary that can't be published is reported
348
+ in the log and skipped; the exit code is the analysis's. Without a KwikQA token, or past your
349
+ plan's limit, the run is analyzed locally and the summary says why it wasn't diagnosed.
350
+
351
+ ### Slack and Microsoft Teams
352
+
353
+ `kwikqa ci` posts the run to the incoming webhooks you store as CI secrets. KwikQA keeps no webhook
354
+ anywhere, and never prints one.
355
+
356
+ - **Slack.** Create an incoming webhook for the channel, and store its URL as
357
+ `KWIKQA_SLACK_WEBHOOK_URL`.
358
+ - **Teams.** In the channel, add the Workflows template "Post to a channel when a webhook request is
359
+ received", and store its URL as `KWIKQA_TEAMS_WEBHOOK_URL`. (Office 365 connector webhooks were
360
+ retired in May 2026.)
361
+
362
+ The message names the repository and branch, links the pull request or commit and the run, and gives
363
+ the counts. Then it has one line per failure group, with the group's category, where it fails, its
364
+ size, and its owner, and the flaky count. It holds no error text, evidence, or source: a channel is
365
+ a wider audience than a build log. KwikQA posts only when tests failed, unless you pass
366
+ `--notify always`. A failed post is retried once, printed, and never fails the build.
367
+
368
+ ### Other CI systems
369
+
370
+ `npx kwikqa ci` writes the report there too, and posts to Slack and Teams, but writes no summary or
371
+ comment yet:
221
372
 
222
373
  ```sh
223
- export KWIKQA_TOKEN=... # create a CI token at https://kwikqa.com/dashboard/account/
224
- npx playwright test || npx kwikqa analyze --yes
225
- npx cypress run || npx kwikqa analyze --yes
374
+ npx playwright test || { npx kwikqa ci; exit 1; }
375
+ npx cypress run || { npx kwikqa ci; exit 1; }
226
376
  ```
227
377
 
378
+ The `exit 1` keeps the build failed: KwikQA exits with the analysis's code, which is usually `0`.
379
+ Then keep `kwikqa-report.html` as a build artifact.
380
+
228
381
  ## Account and billing
229
382
 
230
383
  The dashboard at https://kwikqa.com/dashboard/ shows your plan, usage, and recent requests. There