jattac.libs.web.zest-button 1.2.9 → 1.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.
@@ -0,0 +1,227 @@
1
+ # E2E Testing Policy
2
+
3
+ ## Terminology
4
+
5
+ The words MUST, MUST NOT, SHALL, SHALL NOT, SHOULD and MAY are to be interpreted as defined by RFC 2119.
6
+
7
+ ---
8
+
9
+ ## Purpose
10
+
11
+ E2E tests verify critical business paths through the full stack:
12
+
13
+ HTTP request → API → service → database → response.
14
+
15
+ They are expensive. They are not run on every commit.
16
+
17
+ They are a merge gate: they MUST pass before code enters master.
18
+
19
+ ---
20
+
21
+ ## Critical Path Identification
22
+
23
+ Each project MUST define its critical paths in:
24
+
25
+ ```
26
+ docs/e2e/critical-paths.md
27
+ ```
28
+
29
+ A critical path is:
30
+
31
+ • A business flow that, if broken, causes user-facing impact
32
+
33
+ • A data integrity path where incorrect writes are dangerous
34
+
35
+ • An integration point with external systems
36
+
37
+ Examples:
38
+
39
+ • User authentication (login, refresh, logout)
40
+
41
+ • Payment processing (create, confirm, fail, refund)
42
+
43
+ • Order lifecycle (create, pay, ship, complete)
44
+
45
+ • Data import/export
46
+
47
+ • Any path that writes to the database in ways that affect business data
48
+
49
+ ---
50
+
51
+ ## Configuration
52
+
53
+ Via environment variables:
54
+
55
+ • `E2E_API_BASE_URL` — the running API (e.g., `https://localhost:5001`)
56
+
57
+ • `E2E_DB_CONNECTION` — database connection string for setup/teardown
58
+
59
+ • `E2E_DB_TYPE` — database type (MariaDB, PostgreSQL, SQL Server)
60
+
61
+ Tests MUST NOT hardcode URLs or connection strings.
62
+
63
+ Tests MUST fail fast if required environment variables are missing.
64
+
65
+ ---
66
+
67
+ ## Test Structure
68
+
69
+ Each test class = one critical path.
70
+
71
+ Each test method = one scenario within that path.
72
+
73
+ Required structure:
74
+
75
+ ```
76
+ [Arrange] Set up database state
77
+ [Act] Make HTTP requests
78
+ [Assert] Verify response AND database state
79
+ [Teardown] Clean up database
80
+ ```
81
+
82
+ Test naming convention:
83
+
84
+ ```
85
+ [Method]_[Scenario]_[ExpectedResult]
86
+ ```
87
+
88
+ Examples:
89
+
90
+ ```
91
+ Login_ValidCredentials_Returns200AndToken
92
+ Login_InvalidCredentials_Returns401
93
+ CreatePayment_ValidRequest_Returns201AndPaymentRecord
94
+ CreatePayment_InvalidAmount_Returns400
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Execution
100
+
101
+ E2E tests run BEFORE merge to master.
102
+
103
+ They do NOT run on every commit.
104
+
105
+ They do NOT run on feature branch pushes.
106
+
107
+ ### Local Merge Workflow
108
+
109
+ Before merging to master, the developer (or AI agent) SHALL:
110
+
111
+ 1. Ensure the API server is running (if the project has a backend)
112
+
113
+ 2. Run e2e tests using the project's actual E2E command, e.g.:
114
+ - .NET: `dotnet test --filter Category=E2E`
115
+ - Node.js: `npx playwright test` (or the project's configured E2E script)
116
+
117
+ 3. Verify all e2e tests pass
118
+
119
+ 4. Create marker: `touch .e2e-passed`
120
+
121
+ 5. Complete the merge
122
+
123
+ 6. Push to remote
124
+
125
+ 7. Delete marker: `rm .e2e-passed`
126
+
127
+ ### CI Workflow
128
+
129
+ If CI exists, e2e tests SHALL be a required check for Pull Requests targeting master.
130
+
131
+ ---
132
+
133
+ ## Enforcement
134
+
135
+ The pre-push hook rejects pushes to master if `.e2e-passed` does not exist —
136
+ but only once the project actually has an E2E suite (a non-empty `e2e/` or
137
+ `e2e-tests/` directory). Until then, the gate does not apply: a project
138
+ with no E2E tests yet cannot be blocked by a requirement it has no way to
139
+ satisfy. The moment a real E2E suite is added, the gate activates.
140
+
141
+ Where the gate applies, it is a hard block. No override exists for the e2e requirement.
142
+
143
+ AI agents SHALL NOT bypass this mechanism.
144
+
145
+ AI agents SHALL NOT create the marker without running tests.
146
+
147
+ AI agents SHALL NOT recommend skipping e2e tests.
148
+
149
+ ---
150
+
151
+ ## Database Rules
152
+
153
+ • Tests MUST set up their own data
154
+
155
+ • Tests MUST clean up after themselves
156
+
157
+ • Tests MUST NOT depend on data from other tests
158
+
159
+ • Tests MUST NOT leave data in the database
160
+
161
+ • If a test fails, teardown MUST still run (use `IAsyncLifetime` or `IDisposable`)
162
+
163
+ • Database state MUST be verified after write operations
164
+
165
+ • Connection strings MUST come from environment variables
166
+
167
+ • Tests SHOULD use transactions that rollback where possible
168
+
169
+ ---
170
+
171
+ ## Test Isolation
172
+
173
+ Each test MUST be independent.
174
+
175
+ Tests MUST NOT share state.
176
+
177
+ Tests MUST NOT depend on execution order.
178
+
179
+ Tests MUST be safe to run in parallel unless explicitly marked as serial.
180
+
181
+ ---
182
+
183
+ ## What E2E Tests Are NOT
184
+
185
+ • Not unit tests
186
+
187
+ • Not integration tests (those test services in isolation)
188
+
189
+ • Not contract tests (those test API shape)
190
+
191
+ E2E tests are the full stack: HTTP through database.
192
+
193
+ ---
194
+
195
+ ## Marker File
196
+
197
+ The marker file `.e2e-passed` indicates that e2e tests have passed.
198
+
199
+ It MUST exist before pushing to a protected branch.
200
+
201
+ It MUST be deleted after a successful push.
202
+
203
+ It MUST NOT be created without running the tests.
204
+
205
+ It MUST be listed in `.gitignore` if the project has one.
206
+
207
+ ---
208
+
209
+ ## Adding New Critical Paths
210
+
211
+ When a new critical business path is identified:
212
+
213
+ 1. Document it in `docs/e2e/critical-paths.md`
214
+
215
+ 2. Write e2e tests for it
216
+
217
+ 3. Add the `[Category("E2E")]` attribute to the test class
218
+
219
+ 4. Ensure tests follow the structure and isolation rules above
220
+
221
+ ---
222
+
223
+ ## Removing Critical Paths
224
+
225
+ Critical paths MUST NOT be removed without explicit user instruction.
226
+
227
+ If a feature is deprecated, mark the path as deprecated in `docs/e2e/critical-paths.md` but keep the tests until the feature is fully removed.