add cy request anti pattern
This commit is contained in:
parent
d97c2cdf07
commit
507922bf55
1 changed files with 1 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ Constructs LLMs default to that this project forbids on the frontend.
|
||||||
| Inline `<script>` in templates | `<script>doStuff()</script>` in a `.php` template | put logic in `public/js/<page>.js`, load via `<script src=...>` |
|
| Inline `<script>` in templates | `<script>doStuff()</script>` in a `.php` template | put logic in `public/js/<page>.js`, load via `<script src=...>` |
|
||||||
| Hardcoded admin URLs in user-facing JS | `fetch('/api/admin/...')` from a non-admin page JS | call user-scoped endpoints from user pages, admin endpoints only from admin pages |
|
| Hardcoded admin URLs in user-facing JS | `fetch('/api/admin/...')` from a non-admin page JS | call user-scoped endpoints from user pages, admin endpoints only from admin pages |
|
||||||
| Cypress test logging in as the wrong role | `cy.loginAsAdmin()` in a non-admin spec | match the role to the page under test (`loginAsUser` for `/home`, `/texts`; `loginAsAdmin` for `/admin/*`) |
|
| Cypress test logging in as the wrong role | `cy.loginAsAdmin()` in a non-admin spec | match the role to the page under test (`loginAsUser` for `/home`, `/texts`; `loginAsAdmin` for `/admin/*`) |
|
||||||
|
| `cy.request` in E2E tests | `cy.request('/api/...')` to set up state or assert | tests must exercise UI - drive via `cy.visit`/`cy.get`; if seeding is needed, add it to backend seed data |
|
||||||
|
|
||||||
When generating code, scan the diff for these patterns before writing it
|
When generating code, scan the diff for these patterns before writing it
|
||||||
to disk.
|
to disk.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue