@keber/qa-framework 1.9.1 → 1.11.3
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/CHANGELOG.md +103 -16
- package/README.md +1 -1
- package/docs/folder-structure-guide.md +6 -0
- package/integrations/ado-powershell/pipelines/azure-pipeline-qa.yml +277 -65
- package/integrations/playwright/README.md +124 -0
- package/integrations/playwright-azure-reporter/README.md +75 -24
- package/package.json +3 -4
- package/qa-framework.config.json +1 -1
- package/scripts/init.js +53 -38
- package/scripts/upgrade.js +105 -10
- package/templates/automation-scaffold/.env.example +20 -1
- package/templates/automation-scaffold/fixtures/base.ts +108 -0
- package/templates/automation-scaffold/global-setup.ts +119 -29
- package/templates/automation-scaffold/playwright.config.ts +24 -0
- package/templates/defect-report.md +1 -1
- package/templates/integration-scaffold/.env.example +40 -0
- package/templates/integration-scaffold/README.md +77 -0
- package/templates/integration-scaffold/global-setup.ts +99 -0
- package/templates/integration-scaffold/package.json +15 -0
- package/templates/integration-scaffold/playwright.config.ts +78 -0
- package/templates/integration-scaffold/tests/example.spec.ts +43 -0
- package/templates/memory/ci-pipeline-findings.md +36 -0
- package/templates/memory/data-volatility-strategies.md +70 -0
- package/templates/memory/e2e-stabilization-patterns.md +54 -0
- package/templates/qa-framework.instructions.md +9 -1
- package/templates/qa-readme.md +21 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# CI Pipeline Findings
|
|
2
|
+
|
|
3
|
+
> Document CI pipeline issues, root causes, and applied fixes as they are discovered.
|
|
4
|
+
> This file is loaded by the agent when diagnosing CI failures or reviewing pipeline changes.
|
|
5
|
+
|
|
6
|
+
## Applied Fixes
|
|
7
|
+
|
|
8
|
+
Document each fix that was applied to the pipeline or test setup. Use a table or prose - whatever fits the change.
|
|
9
|
+
|
|
10
|
+
| Problem | Root cause | Fix applied |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| _Add pipeline issue here_ | _Root cause_ | _What was changed and where_ |
|
|
13
|
+
|
|
14
|
+
> Examples: auth setup defaults, missing reporter packages, artifact name collisions,
|
|
15
|
+
> browser binary not installed in a CI stage, grep flag escaping issues.
|
|
16
|
+
|
|
17
|
+
## Known Limitations
|
|
18
|
+
|
|
19
|
+
Document constraints that are accepted but not fixed (timeout budgets, worker counts, retry behavior).
|
|
20
|
+
|
|
21
|
+
> Examples:
|
|
22
|
+
> - Full suite exceeds the CI timeout with 1 worker. Workaround: run only P0/P1 tags by default.
|
|
23
|
+
> - `retries: 2` counts each attempt separately, so reported execution count exceeds test count.
|
|
24
|
+
> - Attachment upload warnings on `PublishTestResults` when multiple failures share filenames.
|
|
25
|
+
|
|
26
|
+
## Failure Triage Categories
|
|
27
|
+
|
|
28
|
+
Use these categories when classifying CI failures. Add project-specific categories as needed.
|
|
29
|
+
|
|
30
|
+
| Category | Description | Action |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| TIMEOUT | Test exceeded its time budget | Adjust `timeout` in the spec or in `playwright.config.ts` |
|
|
33
|
+
| SESSION | Auth session expired mid-run | Implement session-refresh fixture or reduce suite duration |
|
|
34
|
+
| FLAKY | Intermittent failure, passes on retry | Acceptable if retries cover it; investigate if failure rate > 20% |
|
|
35
|
+
| APP-DEFECT | Application does not meet the spec | Open defect file; mark test with `test.fail()` |
|
|
36
|
+
| TEST-CODE | Selector or assertion is wrong in CI | Fix the spec file |
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Data Volatility Strategies
|
|
2
|
+
|
|
3
|
+
> The QA environment is typically shared between automated tests and manual testers.
|
|
4
|
+
> Data (record counts, available filter values, document states) changes constantly,
|
|
5
|
+
> which invalidates hardcoded values in specs. Document the chosen strategy here.
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
List the types of data that are volatile in this project's QA environment.
|
|
10
|
+
|
|
11
|
+
| Data type | Example of fragile assertion | Tests affected |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Filter option values | `hasText: 'specific-value'` | _Add count here_ |
|
|
14
|
+
| Exact row counts | `toBe(33)` | _Add count here_ |
|
|
15
|
+
| Record names used as search inputs | `fill('specific-record-name')` | _Add count here_ |
|
|
16
|
+
| Process or transaction IDs | `TEST_ID = '608'` | _Add count here_ |
|
|
17
|
+
|
|
18
|
+
## Strategy 1: Shared Constants with Dynamic Discovery
|
|
19
|
+
|
|
20
|
+
Maintain a `fixtures/test-data-constants.ts` file with well-named constants. Populate them
|
|
21
|
+
from a discovery step (global-setup or a `beforeAll` fixture) that reads the actual environment.
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// fixtures/test-data-constants.ts
|
|
25
|
+
export const QA_ITEM_CURRENT = 'current-item-name'; // most recent available
|
|
26
|
+
export const QA_ITEM_OLDEST = 'oldest-item-name'; // oldest available
|
|
27
|
+
export const QA_ITEM_INVALID = 'nonexistent-item'; // guaranteed absent
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Tradeoff:** eliminates hardcoded filter values centrally, but discovery adds startup time
|
|
31
|
+
and blocks the suite if it fails.
|
|
32
|
+
|
|
33
|
+
## Strategy 2: Resilient Assertions (Patterns and Ranges)
|
|
34
|
+
|
|
35
|
+
Replace exact-value assertions with pattern or range checks.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Instead of:
|
|
39
|
+
expect(count).toBe(33);
|
|
40
|
+
await expect(counter).toHaveText('1-5 of 5');
|
|
41
|
+
|
|
42
|
+
// Use:
|
|
43
|
+
expect(count).toBeGreaterThan(0);
|
|
44
|
+
await expect(counter).toHaveText(/\d+-\d+ of \d+/);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Tradeoff:** no extra infrastructure, each test is self-contained, but precision is lower.
|
|
48
|
+
Useful for count assertions; less useful for filter-value selection.
|
|
49
|
+
|
|
50
|
+
## Strategy 3: Snapshot Delta Validation
|
|
51
|
+
|
|
52
|
+
Capture the initial state before applying a filter, then assert that the filtered state
|
|
53
|
+
differs from the initial state in the expected direction (fewer rows, etc.).
|
|
54
|
+
|
|
55
|
+
**Tradeoff:** maximum resilience, but tests become longer and harder to trace. Use only for
|
|
56
|
+
critical filter tests where behavior (not data) must be validated.
|
|
57
|
+
|
|
58
|
+
## Chosen Approach
|
|
59
|
+
|
|
60
|
+
> Document which strategy (or combination) was chosen for this project, and which test
|
|
61
|
+
> categories each strategy applies to.
|
|
62
|
+
|
|
63
|
+
| Test category | Strategy | Status |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| Filter option values | Strategy 1 or 2 | _Pending / Implemented_ |
|
|
66
|
+
| Row count assertions | Strategy 2 | _Pending / Implemented_ |
|
|
67
|
+
| Search input values | Strategy 2 or 3 | _Pending / Implemented_ |
|
|
68
|
+
|
|
69
|
+
> Tests that are blocked on a data strategy can be marked `test.skip()` with a
|
|
70
|
+
> `PENDING-DATA-STRATEGY` annotation until the strategy is implemented.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# E2E Stabilization Patterns
|
|
2
|
+
|
|
3
|
+
> A running log of flakiness patterns found in this project and the techniques used to fix them.
|
|
4
|
+
> Load this file when investigating intermittent test failures or refactoring fragile specs.
|
|
5
|
+
|
|
6
|
+
## Crash-Recovery Pattern
|
|
7
|
+
|
|
8
|
+
When the application server crashes intermittently (e.g. unhandled error page with a Reload link),
|
|
9
|
+
a bare `waitFor` will timeout. Use `Promise.race` to detect the error state and recover:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
const outcome = await Promise.race([
|
|
13
|
+
targetElement.waitFor({ state: 'visible', timeout: 60_000 }).then(() => 'ready' as const),
|
|
14
|
+
page.getByText('An unhandled error has occurred.').waitFor({ state: 'visible', timeout: 60_000 }).then(() => 'crash' as const),
|
|
15
|
+
]).catch(() => 'timeout' as const);
|
|
16
|
+
|
|
17
|
+
if (outcome === 'crash') {
|
|
18
|
+
await page.getByRole('link', { name: 'Reload' }).click();
|
|
19
|
+
await targetElement.waitFor({ state: 'visible', timeout: 60_000 });
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> Document which spec files use this pattern and under what conditions it fires.
|
|
24
|
+
|
|
25
|
+
## Strict-Mode Selector Conflicts
|
|
26
|
+
|
|
27
|
+
`getByText()` and similar matchers can match multiple elements, triggering strict-mode violations.
|
|
28
|
+
Scope selectors to the most specific container available.
|
|
29
|
+
|
|
30
|
+
> Document conflicts found in this project here.
|
|
31
|
+
> Example: a pagination counter regex that also matches a card element.
|
|
32
|
+
> Fix: use a scoped `locator('.specific-class')` instead of a broad text match.
|
|
33
|
+
|
|
34
|
+
## Known Flaky Failure Types
|
|
35
|
+
|
|
36
|
+
Document categories of instability specific to this project. A row per pattern is enough.
|
|
37
|
+
|
|
38
|
+
| ID | Root cause | Fix | Affected tests |
|
|
39
|
+
|---|---|---|---|
|
|
40
|
+
| _Add ID_ | _Describe the underlying cause_ | _Technique used to fix_ | _Spec files or TC IDs_ |
|
|
41
|
+
|
|
42
|
+
> Examples: framework hydration delays, input binding issues requiring `pressSequentially`,
|
|
43
|
+
> elements that are in the DOM but not yet rendered, session expiry during long runs.
|
|
44
|
+
|
|
45
|
+
## Reference Timeouts
|
|
46
|
+
|
|
47
|
+
Fill in the timeout values used in this project once they are stabilized.
|
|
48
|
+
|
|
49
|
+
| Setting | Value | Location |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Default test timeout | - | `playwright.config.ts` |
|
|
52
|
+
| `actionTimeout` | - | `playwright.config.ts` |
|
|
53
|
+
| `navigationTimeout` | - | `playwright.config.ts` |
|
|
54
|
+
| Long-running spec timeout | - | Per-spec `describe.configure` |
|
|
@@ -24,7 +24,15 @@ This project uses `@keber/qa-framework` v{{VERSION}} for spec-driven automated t
|
|
|
24
24
|
1. Generate the output in `UTF-8` encoding without BOM (`UTF-8`, no signature).
|
|
25
25
|
2. Ensure the raw output is `UTF-8` encoded with no `EF BB BF` bytes at the beginning.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Azure DevOps integration
|
|
28
|
+
|
|
29
|
+
Before any ADO operation, check if `.github/skills/ado-qa/` exists or if
|
|
30
|
+
`integrations.ado.enabled` is `true` in `qa/qa-framework.config.json`. If either
|
|
31
|
+
condition is met, load `.github/skills/qa-ado-integration/SKILL.md` and use it for
|
|
32
|
+
all ADO interactions (work items, test plans, test cases, bugs, etc.).
|
|
33
|
+
|
|
34
|
+
> To enable Azure DevOps integration run: `npm install github:keber/ado-qa`
|
|
35
|
+
|
|
28
36
|
## QA Pipeline
|
|
29
37
|
|
|
30
38
|
Stages must run in order. Never start a stage unless its prerequisite is met.
|
package/templates/qa-readme.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Framework: `@keber/qa-framework` v{VERSION}
|
|
4
4
|
> Language: {LANGUAGE} | Base URL: `{QA_BASE_URL}`
|
|
5
|
+
> ADO Project: `{ADO_ORG} / {ADO_PROJECT}` _(optional — remove line if not using Azure DevOps)_
|
|
5
6
|
|
|
6
7
|
---
|
|
7
8
|
|
|
@@ -47,12 +48,32 @@ npx playwright test --last-failed
|
|
|
47
48
|
|
|
48
49
|
---
|
|
49
50
|
|
|
51
|
+
## Last Run
|
|
52
|
+
|
|
53
|
+
| Suite | Date | Pass | Fail | Skip | CI Link |
|
|
54
|
+
|---|---|---|---|---|---|
|
|
55
|
+
| E2E | — | — | — | — | — |
|
|
56
|
+
| API | — | — | — | — | — |
|
|
57
|
+
|
|
58
|
+
> Update this table after each significant run. The CI Link can be an ADO TestRun URL, a
|
|
59
|
+
> GitHub Actions run URL, or a path to a local report file.
|
|
60
|
+
|
|
50
61
|
## Last Execution
|
|
51
62
|
|
|
52
63
|
| Date | Suite | Pass | Skip | Fail | Duration | Report |
|
|
53
64
|
|---|---|---|---|---|---|---|
|
|
54
65
|
| — | — | — | — | — | — | — |
|
|
55
66
|
|
|
67
|
+
## Flaky Tests
|
|
68
|
+
|
|
69
|
+
> Mark known flaky tests with this inline annotation directly in the table or spec file.
|
|
70
|
+
> Format: `[flaky] <test-id-or-name> - <root cause> - last seen <YYYY-MM-DD>`
|
|
71
|
+
>
|
|
72
|
+
> Example:
|
|
73
|
+
> `[flaky] TC-MOD-012 - timing issue on slow CI agents - last seen 2026-01-15`
|
|
74
|
+
>
|
|
75
|
+
> Remove the annotation once the test has been stable for 2+ consecutive CI runs.
|
|
76
|
+
|
|
56
77
|
---
|
|
57
78
|
|
|
58
79
|
## Sprint History
|