tewip-ai 0.4.0
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/LICENSE +202 -0
- package/QUICKSTART.md +178 -0
- package/README.md +308 -0
- package/TEAM-GUIDE.md +234 -0
- package/dist/cli/tewip.js +117 -0
- package/dist/engine/autofix/autofix.js +63 -0
- package/dist/engine/autofix/candidates.js +33 -0
- package/dist/engine/autofix/locate.js +78 -0
- package/dist/engine/corrections.js +66 -0
- package/dist/engine/dataset.js +41 -0
- package/dist/engine/decide.js +130 -0
- package/dist/engine/device-errors.js +45 -0
- package/dist/engine/drift-rules.js +98 -0
- package/dist/engine/driver-errors.js +103 -0
- package/dist/engine/engine.js +76 -0
- package/dist/engine/error-parse.js +150 -0
- package/dist/engine/history.js +105 -0
- package/dist/engine/import/blob.js +165 -0
- package/dist/engine/import/junit.js +235 -0
- package/dist/engine/import/xml.js +104 -0
- package/dist/engine/llm/anthropic.js +59 -0
- package/dist/engine/llm/client.js +139 -0
- package/dist/engine/llm/context.js +141 -0
- package/dist/engine/llm/llm-diagnose.js +48 -0
- package/dist/engine/llm/prompt.js +40 -0
- package/dist/engine/llm/providers.js +54 -0
- package/dist/engine/llm/usage.js +69 -0
- package/dist/engine/pipeline.js +33 -0
- package/dist/engine/quality/frameworks.js +181 -0
- package/dist/engine/quality/grounding.js +203 -0
- package/dist/engine/quality/model.js +17 -0
- package/dist/engine/quality/plan-command.js +34 -0
- package/dist/engine/quality/plan-render.js +38 -0
- package/dist/engine/quality/plan.js +119 -0
- package/dist/engine/quality/write-command.js +146 -0
- package/dist/engine/quality/write-verify.js +140 -0
- package/dist/engine/quality/write.js +144 -0
- package/dist/engine/rules.js +174 -0
- package/dist/engine/signature.js +23 -0
- package/dist/engine/similarity.js +76 -0
- package/dist/engine/snapshot.js +56 -0
- package/dist/engine/timing-rules.js +188 -0
- package/dist/engine/trace/dom.js +92 -0
- package/dist/engine/trace/trace-summary.js +87 -0
- package/dist/engine/trace/zip.js +53 -0
- package/dist/eval/harvest/gh.js +21 -0
- package/dist/eval/harvest/harvest.js +117 -0
- package/dist/mcp/github-report.js +50 -0
- package/dist/mcp/server.js +80 -0
- package/dist/mcp/tools.js +124 -0
- package/dist/outlets/design-debt.js +22 -0
- package/dist/outlets/items.js +94 -0
- package/dist/outlets/view.js +63 -0
- package/dist/outlets/views/architecture.js +77 -0
- package/dist/outlets/views/developer.js +59 -0
- package/dist/outlets/views/digest.js +66 -0
- package/dist/outlets/views/infra.js +49 -0
- package/dist/outlets/views/quality.js +108 -0
- package/dist/outlets/views/release.js +33 -0
- package/dist/outlets/views/sdet.js +29 -0
- package/dist/reporters/run-context.js +20 -0
- package/dist/reporters/store.js +46 -0
- package/dist/reporters/triage-reporter.js +101 -0
- package/dist/reporters/types.js +4 -0
- package/dist/scripts/explain.js +58 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Hasan Mamut (Tewip)
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/QUICKSTART.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Quickstart: putting Tewip on one repository
|
|
2
|
+
|
|
3
|
+
For an engineer adding the agent to a project that already runs Playwright tests in GitHub Actions. It takes about ten minutes, and the first useful output arrives with the next failing run.
|
|
4
|
+
|
|
5
|
+
Start with **one** repository whose tests fail sometimes. A repository whose suite is always green has nothing to triage.
|
|
6
|
+
|
|
7
|
+
## What the agent does once it is installed
|
|
8
|
+
|
|
9
|
+
Every CI run, for every failed test, it decides the root cause — application bug, changed selector, race, environment, or test data — with a confidence, the evidence it used, and one concrete next action. It then delivers that to the people who need it: a comment on the pull request, the board in the job summary, one grouped issue for environment failures, and optionally a separate pull request with locator fixes that it re-ran and verified.
|
|
10
|
+
|
|
11
|
+
It never merges anything, never edits application code, and never opens a fix pull request for a change it has not proved by re-running the test.
|
|
12
|
+
|
|
13
|
+
## Step 1: make Playwright leave the evidence behind
|
|
14
|
+
|
|
15
|
+
The agent reads Playwright's own blob report and traces, so nothing from this project goes into your test config:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// playwright.config.ts
|
|
19
|
+
reporter: process.env.CI ? [['list'], ['blob']] : 'list',
|
|
20
|
+
use: { trace: 'retain-on-failure' },
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If your config already uses a reporter list in CI, add `['blob']` to it.
|
|
24
|
+
|
|
25
|
+
## Step 2: add one step to the workflow that runs the tests
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
permissions:
|
|
29
|
+
pull-requests: write # the diagnosis comment
|
|
30
|
+
issues: write # the grouped environment issue
|
|
31
|
+
contents: write # only if you turn autofix on
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
# ... your existing checkout, install, and `npx playwright test` steps ...
|
|
35
|
+
|
|
36
|
+
- name: Tewip
|
|
37
|
+
if: always() # it must run even though the test step failed
|
|
38
|
+
uses: hmamut39/tewip@main
|
|
39
|
+
with:
|
|
40
|
+
openai-api-key: ${{ secrets.OPENAI_API_KEY }} # optional, see step 3
|
|
41
|
+
autofix: 'false' # start with this off
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`if: always()` matters: without it the step is skipped exactly when there is something to triage.
|
|
45
|
+
|
|
46
|
+
Keep `autofix: 'false'` for the first week. Read what the agent says, decide whether you trust it, and turn fixing on afterwards.
|
|
47
|
+
|
|
48
|
+
## Step 3: decide whether to give it an API key
|
|
49
|
+
|
|
50
|
+
| Without a key | With `OPENAI_API_KEY` |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Only the deterministic rules run | The rules run first, and only what they cannot settle goes to the model |
|
|
53
|
+
| Every answer is explainable from the error, the trace and the test's history | Adds a judgement on the rest, with its reasoning and evidence shown |
|
|
54
|
+
| Free | A few cents per run in practice, because the rules answer most failures |
|
|
55
|
+
|
|
56
|
+
On real projects the rules alone decide most failures and are right on 96–98% of what they decide, so starting without a key is a reasonable first week. To add one later: repository **Settings → Secrets and variables → Actions → New repository secret**, named `OPENAI_API_KEY`.
|
|
57
|
+
|
|
58
|
+
Every run prints what it cost, priced from OpenAI's published prices. One guard worth setting once the key is in place:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
env:
|
|
62
|
+
TRIAGE_LLM_MAX_CALLS: '80' # hard cap on model calls per run
|
|
63
|
+
# TRIAGE_LLM_PRICE_IN / _OUT: only if your price differs (per million tokens)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Not using Playwright? Every stack works
|
|
67
|
+
|
|
68
|
+
Point the agent at your test runner's **JUnit XML** report (or .NET's **TRX**) instead of a Playwright blob report. Each runner marked *verified* was run for real in CI (`fixtures/polyglot`) and its report is checked by the test suite on every change.
|
|
69
|
+
|
|
70
|
+
| Stack | Runner | How to write the report | Status |
|
|
71
|
+
|---|---|---|---|
|
|
72
|
+
| **Node.js** | node:test (built in) | `node --test --test-reporter=junit --test-reporter-destination=report.xml` | verified |
|
|
73
|
+
| Node.js, React, Vue, Angular, Next.js, NestJS, Express | Jest | `jest --reporters=default --reporters=jest-junit` | verified |
|
|
74
|
+
| Vite, Vue, Svelte, Nuxt, React | Vitest | `vitest run --reporter=junit --outputFile=report.xml` | verified |
|
|
75
|
+
| Node.js, Express | Mocha | `mocha --reporter mocha-junit-reporter` | verified |
|
|
76
|
+
| **Python**, Django, Flask, FastAPI | pytest (also runs `unittest`) | `pytest --junitxml=report.xml` (retries: `pytest-rerunfailures`) | verified |
|
|
77
|
+
| **Java**, Spring, Kotlin | JUnit 4/5, TestNG via Maven Surefire | written by default to `target/surefire-reports/` (retries: `rerunFailingTestsCount`) | verified |
|
|
78
|
+
| Java, Kotlin, Android | Gradle | written by default to `build/test-results/test/` | same format as Surefire |
|
|
79
|
+
| **Go** | gotestsum | `gotestsum --junitfile report.xml` | verified |
|
|
80
|
+
| **.NET** (C#, F#), ASP.NET | xUnit, NUnit, MSTest | `dotnet test --logger trx` (native) or `--logger junit` | both verified |
|
|
81
|
+
| **Ruby**, Rails | RSpec | `rspec --format RspecJunitFormatter --out report.xml` | verified |
|
|
82
|
+
| **PHP**, Laravel, Symfony | PHPUnit | `phpunit --log-junit report.xml` | verified |
|
|
83
|
+
| **Rust** | cargo-nextest | `[profile.ci.junit]` in `.config/nextest.toml` | verified |
|
|
84
|
+
| End-to-end | **Selenium** (Java, Python, JavaScript, C#) | through the runner above it: Surefire, pytest, Jest/Mocha, `dotnet test` | JUnit format; error wording read |
|
|
85
|
+
| End-to-end | Cypress, WebdriverIO | `mocha-junit-reporter` / `@wdio/junit-reporter` | JUnit format; error wording read |
|
|
86
|
+
| End-to-end | **Playwright** | blob reporter (step 1) — adds traces, selector drift and verified fixes | verified on 5 real projects |
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
- name: Tewip
|
|
90
|
+
if: always()
|
|
91
|
+
uses: hmamut39/tewip@main
|
|
92
|
+
with:
|
|
93
|
+
junit-report: report.xml # a file, or a directory of them (.xml and .trx)
|
|
94
|
+
suite: unit # only needed when one workflow triages several suites
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
What it reads from any of these: the failure text, retries, and each test's history. From that it tells apart a wrong value (a real bug once the test has a passing history), an unreachable service (environment), a data collision, and a test that failed then passed on a retry (timing), in the wording each language uses: `expected: <4> but was: <3>` in Java, `got 3, want 4` in Go, `AssertionError: 3 != 4` in Python, `Expected: 4 / Actual: 3` in .NET, and so on. It also reads each browser tool's own words for the same three problems: an element that was never found (Selenium's `NoSuchElementException`, WebdriverIO's `still not displayed`, Cypress's `Expected to find element`), a click another element received (Selenium's `Other element would receive the click`, Cypress's `is being covered by another element`), and an element the page replaced mid-test (Selenium's `StaleElementReferenceException`, Cypress's `the page updated while this command was executing`). No labelled Selenium or Cypress runs have measured those rules yet, so they report at a confidence the merge gate does not trust on its own. What it cannot do without Playwright's traces is look at the page, so selector drift and automatic fixes stay Playwright-only.
|
|
98
|
+
|
|
99
|
+
A wrong value on a test's **first** recorded failure stays undecided rather than guessed: one failure alone does not show whether the test was reliable before. It becomes a real-bug diagnosis once the test's history shows it passing and then failing the same way.
|
|
100
|
+
|
|
101
|
+
When one workflow triages several suites (say `unit` and `e2e`), give each a `suite` name: each then keeps its own history and its own comment, and corrections name the suite, as in `/triage TIMING unit#2 flaky on CI`.
|
|
102
|
+
|
|
103
|
+
## On your own machine, without CI
|
|
104
|
+
|
|
105
|
+
Install the command once from the release file, `npm install -g tewip-<version>.tgz` (Tewip is not on the npm registry yet; Node 22.18 or newer), run your tests with the report switched on (see the table above), then:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
tewip explain report.xml # JUnit XML or .trx
|
|
109
|
+
tewip explain reports/ # a folder of them
|
|
110
|
+
tewip explain blob-report/ # Playwright
|
|
111
|
+
tewip ci owner/repo --pr 12 # what Tewip's GitHub Action said about a pull request
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
It prints the same triage board CI writes: each failure's cause, confidence, evidence and next action. Each run is kept in a `.tewip/` folder in your project (add it to `.gitignore`), so from the second run on, failures are judged against their history exactly as in CI. `--name` keeps separate histories for different projects.
|
|
115
|
+
|
|
116
|
+
## What you will see on the next failing run
|
|
117
|
+
|
|
118
|
+
- **On the pull request:** one comment listing each failing test, grouped by whether your change likely caused it, each with a cause, a confidence, the evidence and the next action. It updates in place rather than adding a comment per run.
|
|
119
|
+
- **In the job summary:** the same failures as a triage board.
|
|
120
|
+
- **As an issue:** environment failures (5xx responses, connection resets, outages) grouped into one issue instead of one per test.
|
|
121
|
+
- **As an artifact** named `tewip-report`: every role's view, including the engineering-quality view with the flaky tests ranked by the CI minutes they cost.
|
|
122
|
+
|
|
123
|
+
## Correcting it
|
|
124
|
+
|
|
125
|
+
When it gets one wrong, reply to its comment:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
/triage TIMING #2 this one is flaky on our CI runners, not a bug
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
From the next run on, that failure of that test gets your answer, shown as "corrected by a person" with your name and reason. A correction settles the cause; it never makes the agent change code.
|
|
132
|
+
|
|
133
|
+
## Asking it questions from your editor
|
|
134
|
+
|
|
135
|
+
- **VS Code, Cursor, Windsurf, VSCodium:** install the Tewip extension (*Extensions → … → Install from VSIX*, `tewip-<version>.vsix`). It connects Tewip to the editor's AI assistant by itself and adds *Tewip: Explain a test report…* and *Tewip: Why did CI fail on this branch?*
|
|
136
|
+
- **JetBrains (2025.2+), Claude, and other MCP clients:** add one server whose command is `tewip mcp`.
|
|
137
|
+
|
|
138
|
+
Then ask, in plain language: "why did CI fail on my PR?", "which tests are flaky in checkout?", "is main safe to release?". Every tool is read-only, and it reads the report the Action already uploaded, so you do not need the other repository cloned.
|
|
139
|
+
|
|
140
|
+
## Stop flaky tests from blocking merges (optional)
|
|
141
|
+
|
|
142
|
+
Once you trust its answers, let the agent decide whether a failed run should block:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
- name: Tests
|
|
146
|
+
continue-on-error: true # the gate below decides
|
|
147
|
+
run: npx playwright test
|
|
148
|
+
- name: Tewip
|
|
149
|
+
if: always()
|
|
150
|
+
uses: hmamut39/tewip@main
|
|
151
|
+
with:
|
|
152
|
+
gate: real-failures
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The build then fails only for real bugs, changed selectors, test-data problems and anything undecided. Failures a rule or a person classified as flaky or environment no longer block. On 2,296 real failures this unblocked 84% of the flaky and environment ones without letting a real bug through.
|
|
156
|
+
|
|
157
|
+
## Turning fixing on, once you trust it
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
autofix: 'true'
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
It then rewrites a drifted locator, re-runs that single test, and opens a **separate** pull request only with the changes that passed. Review it like any other pull request: an intended UI change and a regression can look identical from the outside, which is exactly why a human merges it.
|
|
164
|
+
|
|
165
|
+
On real WordPress CI data it would have fixed 14 drifted locators with none wrong, and every locator it suggested matched what the developers themselves wrote.
|
|
166
|
+
|
|
167
|
+
## If something does not appear
|
|
168
|
+
|
|
169
|
+
| Symptom | Cause |
|
|
170
|
+
|---|---|
|
|
171
|
+
| The step ran but says "no blob report" | The blob reporter is not on in CI, or the tests step did not run |
|
|
172
|
+
| No comment on the pull request | The run was not triggered by a pull request, or `pull-requests: write` is missing |
|
|
173
|
+
| "Resource not accessible by integration" | The workflow's permissions block is missing an entry |
|
|
174
|
+
| Diagnoses look thin on the first day | The agent judges each failure against that test's history, which it builds from your runs; it gets better as runs accumulate |
|
|
175
|
+
|
|
176
|
+
## What it costs, and what it keeps
|
|
177
|
+
|
|
178
|
+
The agent stores the run history in the Actions cache, never in your repository. Collected failure data and traces stay in CI. The only thing it writes to your repository is a pull request branch, and only when you turn fixing on.
|