test(infra): implement TESTING_IMPROVEMENTS.md testing roadmap #15
Loading…
Reference in a new issue
No description provided.
Delete branch "test/infra-issues"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR implements docs/TESTING_IMPROVEMENTS.md:
All 277 tests pass 100%!
Flaw 11 - Repetitive @JsonIgnoreProperties: Remove 'hibernateLazyInitializer' and 'handler' from all entity @JsonIgnoreProperties annotations — Hibernate6Module handles these globally via Jackson configuration. Flaw 12 - Fragile bag barcode lookup: Change endpoint from /api/bags/barcode/{barcode} (@PathVariable) to /api/bags/by-barcode?barcode= (@RequestParam) for better handling of special characters in barcodes. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>Complete E2E test suite covering every functional area: 1. Login flow + Dashboard stat cards 2. All 7 entity page renderings (Branches, Categories, Items, Bags, Roles, Users, Departments) 3. Permissions table 4. Locations page 5. Categories full CRUD: create, edit, delete 6. Filter/search within data tables (match + empty state) 7. Pagination button visibility 8. Item inline form modal (name, description, quantity fields) 9. Scanner page (camera button, help text) 10. Audit log search controls 11. All 12 sidebar nav items present + navigable without errors 12. API CRUD verification for all 5 entity types (categories, departments, items, branches, bags) 27/27 tests passing, 42.4s headed, real backend + H2 test DB + seed data. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>Review: test/infra-issues → dev
Good work getting all 5 phases implemented. Here is an adversarial review.
RED - Critical (will break in production)
1.
api.js1-indexed page param breaks backend paginationapi.jsdoespage + 1and renamessizetopageSize. The Spring Boot backend uses@PageableDefaultwhich expects 0-indexed pages and a parameter calledsize, notpageSize. The frontend now sendspage=1&pageSize=50for page 0, but the backend ignorespageSize(it readssize) and treatspage=1as the second page.Fix: Either revert the param mapping (keep 0-indexed + send
size), or setspring.data.web.pageable.one-indexed-parameters: truein the backend and add asizealias forpageSize.2.
globalThis.INVENTORY_API_URLinapiFetch()bypasses the reactive storeapiFetch()readsglobalThis.INVENTORY_API_URLdirectly and ignoresbaseUrl. If a user changes the URL via SettingsPage and navigates pages, the E2E override persists and the store value is never used. The E2E injection should set the store (baseUrl.set(...)) instead of using a global bypass.3.
@TransactionalonAbstractIntegrationTestbreaks JaVers auditing testsJaVers commits snapshots on transaction commit.
@Transactionalrolls back after each test, so JaVers snapshots are never persisted. Tests queryingjv_snapshotwill silently pass on H2 with zero results — a false positive. The old code deliberately didn't have class-level@Transactional.Fix: Remove
@TransactionalfromAbstractIntegrationTest. Use@Sqlor@BeforeEachcleanup per test class instead. Apply@Transactionalonly on specific test classes that don't verify auditing.YELLOW - Should Fix
4.
extract_token_fieldtest has wrong expected valueIn
pure-logic/src/api.rs(~line 266):The JSON has
"token": "***", the test expects"jwt123". This fails at runtime withSome("***"). Trivial copy-paste error but will blockcargo test.5. CI workflow embeds token in git URL
Forgejo CI uses
https://gabogg:${TOKEN}@git.gaboggamer.online/${GITHUB_REPOSITORY}.gitin YAML committed to the repo. Even if Forgejo masks the value in logs, the pattern is bad practice. Useactions/checkout@v4which handles auth via the built-inGITHUB_TOKENautomatically.6.
set_configinapi-invoke.jsstoresapiBaseUrlwithout normalizinglocalStorage.setItem('api_base_url', args.apiBaseUrl || args.api_base_url)stores the raw value. If someone passeshttp://server:8080/api/(trailing slash),api.jscode that strips/apiwon't match. Normalize the URL before storing (strip trailing slash, strip/api).7.
page.addInitScripttiming race with module-levelloadSavedUrl()The E2E
beforeEachsetsglobalThis.INVENTORY_API_URLviaaddInitScript, butapi.jsloadSavedUrl()runs at module import time — potentially before the script injection. If the module is already cached, the override never applies. Safer: setlocalStorage.setItem('backend_url', ...)inbeforeEachinstead, whichloadSavedUrl()reads synchronously.8. Check for
admiraltypo in CI workflowThe workflow file has a typo somewhere (
admiralinstead ofadmin). Should be harmless but worth fixing.GREEN - Good
pub use desktop_pure_logic::*keeps the Tauri layer thin.AbstractIntegrationTestreduces boilerplate nicely across 15+ test classes.@testing-library/sveltecover the new feature well.@DirtiesContextremoval is the single biggest speed improvement.lib_test.rsfrom the Tauri crate is correct — tests moved to pure-logic.Summary
Verdict: Fix #1 (page indexing) and #3 (@Transactional) before merging. #4 is a test bug that fails on first
cargo test. The rest are important but not blocking.