Test Cases: Concurrency & Race Conditions
Module: Edge Cases - Concurrency
Priority: P2
Phase: 6 (Days 17-18)
Prerequisites
- Multiple browser windows/tabs available
- Two test users with appropriate permissions
- Understanding of browser DevTools for timing
1. Event Registration Race Conditions
TC-CONC-01: Last Spot Race Condition
Scenario: Two users try to register for the last available spot simultaneously.
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create or find an event with capacity = 1 remaining. | Event has 1 spot left. |
| 2 | Open Browser 1: Login as testmember@rcme.membervu.com. | Dashboard displayed. |
| 3 | Open Browser 2: Login as pending-payment@demo.membervu.com. | Dashboard displayed. |
| 4 | Browser 1: Navigate to event registration page. | "1 spot remaining" shown. |
| 5 | Browser 2: Navigate to same event registration page. | "1 spot remaining" shown. |
| 6 | Browser 1: Fill registration form, hover over submit. | Ready to submit. |
| 7 | Browser 2: Fill registration form, hover over submit. | Ready to submit. |
| 8 | Click submit in BOTH browsers as simultaneously as possible. | One succeeds, one fails. |
| 9 | Verify successful registration. | Exactly ONE user registered. |
| 10 | Verify failed registration. | Error: "Event is full" or "No spots available". |
| 11 | Verify database. | Event registrations = capacity (no overbooking). |
TC-CONC-02: Capacity Counter Accuracy
| Step | Action | Expected Result |
|---|---|---|
| 1 | Check event: e2e-free-event with capacity 50. | Note current registrations. |
| 2 | Open 5 browser tabs as different users. | All logged in. |
| 3 | Navigate all 5 to the event page. | All show same "spots remaining". |
| 4 | Submit registrations from all 5 rapidly. | All 5 succeed (if capacity allows). |
| 5 | Verify final capacity count. | Accurate count, no race condition errors. |
2. Payment Race Conditions
TC-CONC-03: Duplicate Payment Prevention
Scenario: Same user submits payment twice rapidly (double-click scenario).
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as testmember@rcme.membervu.com. | Dashboard displayed. |
| 2 | Navigate to a pending invoice. | Invoice detail shown. |
| 3 | Click "Pay Now", fill payment details. | Form ready. |
| 4 | Double-click submit button rapidly. | Only ONE payment created. |
| 5 | Verify in payments list. | Single payment record. |
| 6 | Verify UI feedback. | Button disabled after first click, or loading state. |
TC-CONC-04: Concurrent Payments for Same Invoice
Scenario: Two different users (or sessions) submit payment for same invoice.
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as user in Browser 1. | - |
| 2 | Login as admin/treasurer in Browser 2. | - |
| 3 | Browser 1: Open invoice, fill payment form. | Ready to submit. |
| 4 | Browser 2: Open same invoice, fill payment form. | Ready to submit. |
| 5 | Submit both simultaneously. | Both may succeed (pending approval). |
| 6 | Admin reviews payments. | Can see both pending payments. |
| 7 | Approve first payment (full amount). | Invoice marked PAID. |
| 8 | Attempt to approve second payment. | Warning: "Invoice already paid" or handled as overpayment. |
TC-CONC-05: Payment While Invoice Being Voided
| Step | Action | Expected Result |
|---|---|---|
| 1 | Browser 1: Login as member, open pending invoice. | Invoice displayed. |
| 2 | Browser 2: Login as treasurer, open same invoice. | Invoice displayed. |
| 3 | Browser 1: Fill payment form. | Ready to submit. |
| 4 | Browser 2: Click "Void Invoice", enter reason, confirm. | Invoice voided. |
| 5 | Browser 1: Submit payment. | Error: "Invoice has been voided" or "Cannot pay voided invoice". |
3. Data Edit Conflicts
TC-CONC-06: Simultaneous Profile Edit
Scenario: User edits profile from two browser tabs.
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as testmember@rcme.membervu.com in Tab 1. | - |
| 2 | Open same session in Tab 2 (copy URL). | Same user, two tabs. |
| 3 | Tab 1: Navigate to /profile, load current data. | Profile form with current values. |
| 4 | Tab 2: Navigate to /profile, load current data. | Same current values. |
| 5 | Tab 1: Change phone to "09171111111", save. | Save successful. |
| 6 | Tab 2: Change phone to "09172222222", save. | Last save wins OR conflict warning. |
| 7 | Refresh both tabs. | Both show "09172222222" (last save). |
TC-CONC-07: Simultaneous Member Edit (Admin)
| Step | Action | Expected Result |
|---|---|---|
| 1 | Admin 1: Open member edit page. | Member data loaded. |
| 2 | Admin 2: Open same member edit page. | Same data loaded. |
| 3 | Admin 1: Change status to SUSPENDED, save. | Save successful. |
| 4 | Admin 2: Change membership type, save. | Either succeeds (last wins) or conflict warning. |
| 5 | Verify final state. | Both changes applied (if independent) or last change only. |
TC-CONC-08: Event Edit During Registration
| Step | Action | Expected Result |
|---|---|---|
| 1 | Browser 1 (Admin): Open event edit page. | Edit form displayed. |
| 2 | Browser 2 (Member): Open same event for registration. | Registration form displayed. |
| 3 | Admin: Change event date, save. | Save successful. |
| 4 | Member: Submit registration with old date shown. | Registration succeeds (uses current event data). |
| 5 | Verify registration. | Shows updated date. |
4. Approval Workflow Conflicts
TC-CONC-09: Simultaneous Member Approval
Scenario: Two admins try to approve the same pending member.
| Step | Action | Expected Result |
|---|---|---|
| 1 | Browser 1: Login as admin@rcme.membervu.com. | - |
| 2 | Browser 2: Login as membershipchair@demo.membervu.com. | - |
| 3 | Both: Navigate to pending approvals list. | Same pending member visible. |
| 4 | Both: Click "Approve" on same member simultaneously. | One succeeds, one gets error. |
| 5 | Verify member status. | ACTIVE (approved once). |
| 6 | Verify approval record. | Single approval, single invoice generated. |
TC-CONC-10: Simultaneous Payment Approval
| Step | Action | Expected Result |
|---|---|---|
| 1 | Browser 1: Treasurer opens pending payments. | Payment visible. |
| 2 | Browser 2: Admin opens same pending payments. | Same payment visible. |
| 3 | Both click "Approve" on same payment. | One succeeds, one gets "Already approved". |
| 4 | Verify payment status. | APPROVED (single approval). |
| 5 | Verify invoice balance. | Correctly updated once. |
TC-CONC-11: Approve While Member Cancels
| Step | Action | Expected Result |
|---|---|---|
| 1 | Pending member has submitted application. | Status: PENDING_APPROVAL. |
| 2 | Browser 1 (Admin): Open approval queue, view application. | Ready to approve. |
| 3 | Browser 2 (Member): Cancel their application. | Application withdrawn. |
| 4 | Admin: Click Approve. | Error: "Application no longer pending" or "Not found". |
5. Session & Token Conflicts
TC-CONC-12: Concurrent Login Sessions
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as testmember@rcme.membervu.com in Browser 1. | Session 1 active. |
| 2 | Login as same user in Browser 2. | Session 2 active. |
| 3 | Perform action in Browser 1. | Action succeeds. |
| 4 | Perform action in Browser 2. | Action succeeds (concurrent sessions allowed). |
| 5 | Logout in Browser 1. | Session 1 ended. |
| 6 | Verify Browser 2 still works. | Session 2 still active (or forced logout depending on policy). |
TC-CONC-13: Password Change Invalidates Other Sessions
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login in Browser 1 and Browser 2 as same user. | Two active sessions. |
| 2 | Browser 1: Change password in profile settings. | Password changed. |
| 3 | Browser 2: Attempt any action. | Session invalidated OR still works (policy dependent). |
| 4 | Browser 2: Refresh page. | Redirect to login (if sessions invalidated). |
6. Broadcast & Communications
TC-CONC-14: Edit Broadcast While Sending
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create a broadcast to large segment (100+ recipients). | Broadcast in DRAFT. |
| 2 | Browser 1: Click "Send Now". | Broadcast starts sending. |
| 3 | Browser 2: Attempt to edit same broadcast. | Edit blocked: "Broadcast is currently sending". |
| 4 | Wait for send to complete. | Status: SENT. |
| 5 | Attempt to edit. | Edit blocked: "Cannot edit sent broadcast". |
TC-CONC-15: Delete Broadcast While Sending
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create broadcast, start sending. | Status: SENDING. |
| 2 | Attempt to delete. | Delete blocked or cancelled mid-send. |
| 3 | Verify recipients. | Either all received or none (atomic operation). |
7. Inventory/Stock Scenarios
TC-CONC-16: Event Ticket Type Stock
Scenario: Event has limited "VIP" tickets.
| Step | Action | Expected Result |
|---|---|---|
| 1 | Event has 2 VIP tickets remaining, 50 regular. | Displayed on event page. |
| 2 | Browser 1: Select VIP ticket, proceed to checkout. | VIP selected. |
| 3 | Browser 2: Select VIP ticket, proceed to checkout. | VIP selected. |
| 4 | Browser 3: Select VIP ticket. | Still shows 2 available (not reserved yet). |
| 5 | Browser 1: Complete checkout. | VIP tickets now 1 remaining. |
| 6 | Browser 2: Complete checkout. | VIP tickets now 0 remaining. |
| 7 | Browser 3: Attempt complete checkout. | Error: "VIP tickets sold out". |
8. Database Integrity Tests
TC-CONC-17: Referential Integrity
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create invoice for a member. | Invoice references member. |
| 2 | Attempt to delete member while invoice exists. | Delete blocked or cascaded appropriately. |
| 3 | Create event registration. | Registration references member and event. |
| 4 | Attempt to delete event with registrations. | Blocked: "Event has registrations". |
TC-CONC-18: Transaction Rollback
| Step | Action | Expected Result |
|---|---|---|
| 1 | Start complex operation (e.g., bulk invoice creation). | - |
| 2 | Simulate partial failure (network drop, etc.). | - |
| 3 | Verify database state. | Either all records created or none (no partial state). |
Test Execution Tips
Timing Techniques
- Two-person test: Have two testers coordinate actions via voice/chat
- Tab switching: Open action in multiple tabs, switch rapidly to click
- DevTools pause: Use debugger to pause before submit, then resume both
- Network throttling: Slow connection to extend race window
What to Verify
- No duplicate records created
- Data integrity maintained
- User-friendly error messages
- No 500 errors or system crashes
- Accurate counts and balances
Summary Checklist
| Category | Test Cases | Priority |
|---|---|---|
| Event Registration | TC-CONC-01, TC-CONC-02 | P1 |
| Payment | TC-CONC-03 to TC-CONC-05 | P0 |
| Data Editing | TC-CONC-06 to TC-CONC-08 | P2 |
| Approval Workflow | TC-CONC-09 to TC-CONC-11 | P1 |
| Sessions | TC-CONC-12, TC-CONC-13 | P1 |
| Broadcasts | TC-CONC-14, TC-CONC-15 | P2 |
| Inventory | TC-CONC-16 | P1 |
| Database | TC-CONC-17, TC-CONC-18 | P0 |