Files
gridpilot.gg/tests/bdd/race-event-performance-summary.feature
2025-12-13 11:43:09 +01:00

99 lines
4.5 KiB
Gherkin

Feature: Race Event Performance Summary Notifications
As a driver
I want to receive performance summary notifications after races
So that I can see my results and rating changes immediately
Background:
Given a league exists with stewarding configuration
And a season exists for that league
And a race event is scheduled with practice, qualifying, and main race sessions
Scenario: Driver receives performance summary after main race completion
Given I am a registered driver for the race event
And all sessions are scheduled
When the main race session is completed
Then a MainRaceCompleted domain event is published
And I receive a race_performance_summary notification
And the notification shows my position, incidents, and provisional rating change
And the notification has modal urgency and requires no response
Scenario: Driver receives final results after stewarding closes
Given I am a registered driver for the race event
And the main race has been completed
And the race event is in awaiting_stewarding status
When the stewarding window expires
Then a RaceEventStewardingClosed domain event is published
And I receive a race_final_results notification
And the notification shows my final position and rating change
And the notification indicates if penalties were applied
Scenario: Practice and qualifying sessions don't trigger notifications
Given I am a registered driver for the race event
When practice and qualifying sessions are completed
Then no performance summary notifications are sent
And the race event status remains in_progress
Scenario: Only main race completion triggers performance summary
Given I am a registered driver for the race event
And the race event has practice, qualifying, sprint, and main race sessions
When the sprint race session is completed
Then no performance summary notification is sent
When the main race session is completed
Then a performance summary notification is sent
Scenario: Provisional rating changes are calculated correctly
Given I finished in position 1 with 0 incidents
When the main race is completed
Then my provisional rating change should be +25 points
And the notification should display "+25 rating"
Scenario: Rating penalties are applied for incidents
Given I finished in position 5 with 3 incidents
When the main race is completed
Then my provisional rating change should be reduced by 15 points
And the notification should show the adjusted rating change
Scenario: DNF results show appropriate rating penalty
Given I did not finish the race (DNF)
When the main race is completed
Then my provisional rating change should be -10 points
And the notification should display "DNF" as position
Scenario: Stewarding close mechanism works correctly
Given a race event is awaiting_stewarding
And the stewarding window is configured for 24 hours
When 24 hours have passed since the main race completion
Then the CloseRaceEventStewardingUseCase should close the event
And final results notifications should be sent to all participants
Scenario: Race event lifecycle transitions work correctly
Given a race event is scheduled
When practice and qualifying sessions start
Then the race event status becomes in_progress
When the main race completes
Then the race event status becomes awaiting_stewarding
When stewarding closes
Then the race event status becomes closed
Scenario: Notifications include proper action buttons
Given I receive a performance summary notification
Then it should have a "View Full Results" action button
And clicking it should navigate to the race results page
Scenario: Final results notifications include championship standings link
Given I receive a final results notification
Then it should have a "View Championship Standings" action button
And clicking it should navigate to the league standings page
Scenario: Notifications are sent to all registered drivers
Given 10 drivers are registered for the race event
When the main race is completed
Then 10 performance summary notifications should be sent
When stewarding closes
Then 10 final results notifications should be sent
Scenario: League configuration affects stewarding window
Given a league has stewardingClosesHours set to 48
When a race event is created for that league
Then the stewarding window should be 48 hours after main race completion