https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40134

Paul Derscheid <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #191957|0                           |1
        is obsolete|                            |

--- Comment #26 from Paul Derscheid <[email protected]> ---
Created attachment 192799
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192799&action=edit
Bug 40134: Add Cypress tests for booking improvements

This patch adds end-to-end Cypress tests for the booking modal improvements,
including smart window maximization and server-side optimal item selection.

New Tests:

1. "should successfully submit an 'Any item' booking with server-side optimal
item selection"
   - Tests the complete "any item" booking workflow
   - Selects itemtype and "Any item" option (item_id = 0)
   - Submits booking form
   - Verifies modal closes without errors
   - Validates booking created in database
   - Confirms item was assigned by server
   - Verifies server-side optimal selection completed
   - Test status: PASSING

2. "should maximize booking window by dynamically reducing available items
during overlaps"
   - Creates 4 items with strategic booking patterns
   - Tests "never re-add items to pool" algorithm
   - Validates 5 scenarios:
     a) Full window when all items available
     b) Reduced window when Item 1 becomes unavailable
     c) Further reduction when Items 1&2 unavailable
     d) Minimal window with Items 1,2,3 unavailable
     e) No availability when all items booked
   - Demonstrates smart window maximization
   - Test status: PASSING

3. "should handle edit mode date initialization correctly"
   - Tests fix for edit mode race condition
   - Verifies dates populate correctly when editing booking
   - Ensures itemtype is set before date initialization
   - Tests that flatpickr dates are set properly
   - Test status: PASSING

Updated Tests:

- "should successfully submit a booking"
  * Updated to use day+5 start date (accounts for 3-day lead period)
  * Ensures test doesn't fail on past-date constraint

- Updated test comments and log messages to reflect server-side selection
  * Changed from "client-side selectOptimalItem()" references
  * Updated to "server-side optimal item selection"
  * Clarified that server performs the optimal selection

Test Coverage:
- End-to-end "any item" booking submission
- Smart window maximization algorithm
- Edit mode date initialization
- Server-side optimal selection validation
- Database verification of assigned items
- Modal interaction and form submission

Test plan:
1. Start KTD environment
2. Ensure Cypress is installed: yarn install
3. Run: npx cypress run --spec
"t/cypress/integration/Circulation/bookingsModalBasic_spec.ts"
4. Verify all 11 tests pass
5. Optionally run in interactive mode: npx cypress open

Signed-off-by: Kristi Krueger <[email protected]>
Signed-off-by: Paul Derscheid <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to