feat: add tournament schedule feature test (issue #7)
- Add tournament-schedule.feature with 4 scenarios - Add step definitions for tournament schedule navigation - Tests viewing schedule, generating round-robin, bye rounds, and matchup navigation - Note: Some @wip scenarios require data setup (tournament creation, team addition)
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
Feature: Tournament Schedule
|
||||||
|
As a tournament admin
|
||||||
|
I want to view and generate round matchups in a Schedule tab
|
||||||
|
So that I can manage tournament matches
|
||||||
|
|
||||||
|
@happy-path @tournament @issue-7
|
||||||
|
Scenario: Tournament admin views schedule page for tournament
|
||||||
|
Given I am logged in as a tournament admin
|
||||||
|
And a tournament exists with 4 teams
|
||||||
|
When I go to the tournament schedule page
|
||||||
|
Then I should see "Schedule"
|
||||||
|
And I should see the "Generate Schedule" button
|
||||||
|
|
||||||
|
@happy-path @tournament @issue-7 @wip
|
||||||
|
Scenario: Tournament admin generates round-robin schedule
|
||||||
|
Given I am logged in as a tournament admin
|
||||||
|
And a tournament exists with 4 teams
|
||||||
|
When I go to the tournament schedule page
|
||||||
|
And I click the "Generate Schedule" button
|
||||||
|
Then I should see "Schedule generated successfully"
|
||||||
|
And I should see round 1 matchups
|
||||||
|
And I should see round 2 matchups
|
||||||
|
|
||||||
|
@happy-path @tournament @issue-7 @wip
|
||||||
|
Scenario: Tournament admin views schedule with bye rounds
|
||||||
|
Given I am logged in as a tournament admin
|
||||||
|
And a tournament exists with 5 teams
|
||||||
|
When I go to the tournament schedule page
|
||||||
|
And I click the "Generate Schedule" button
|
||||||
|
Then I should see a bye round for one team
|
||||||
|
And each team should play every other team exactly once
|
||||||
|
|
||||||
|
@happy-path @tournament @issue-7 @wip
|
||||||
|
Scenario: Tournament admin clicks on a matchup to enter results
|
||||||
|
Given I am logged in as a tournament admin
|
||||||
|
And a tournament has a generated schedule
|
||||||
|
When I go to the tournament schedule page
|
||||||
|
And I click on a matchup
|
||||||
|
Then I should be on the match result entry page
|
||||||
@@ -264,7 +264,7 @@ Then('my user account should exist', async function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule steps
|
* Schedule steps (player)
|
||||||
*/
|
*/
|
||||||
When('I go to my schedule page', async function () {
|
When('I go to my schedule page', async function () {
|
||||||
console.log('🌍 Going to schedule page');
|
console.log('🌍 Going to schedule page');
|
||||||
@@ -287,3 +287,36 @@ Given('I have upcoming matches in my schedule', async function () {
|
|||||||
// For now, this is a placeholder that indicates data setup is needed
|
// For now, this is a placeholder that indicates data setup is needed
|
||||||
// In a real test run, this data would already exist in the dev database
|
// In a real test run, this data would already exist in the dev database
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tournament schedule steps
|
||||||
|
*/
|
||||||
|
Given('a tournament exists with {int} teams', async function (teamCount: number) {
|
||||||
|
console.log(`🌍 Note: Tournament with ${teamCount} teams requires data setup`);
|
||||||
|
console.log('🌍 For acceptance tests, this would be created via UI or API');
|
||||||
|
// In a real test run, this would either:
|
||||||
|
// 1. Create a tournament via the UI (slower but more realistic)
|
||||||
|
// 2. Use API to create tournament and add teams (faster)
|
||||||
|
// 3. Pre-existing test data in dev database
|
||||||
|
|
||||||
|
// Store the team count in world context for later steps
|
||||||
|
world.tournamentTeamCount = teamCount;
|
||||||
|
});
|
||||||
|
|
||||||
|
When('I go to the tournament schedule page', async function () {
|
||||||
|
console.log('🌍 Going to tournament schedule page');
|
||||||
|
// Navigate to a tournament schedule page
|
||||||
|
// This would typically be /admin/tournaments/{id}/schedule
|
||||||
|
// For testing, we'll go to the first tournament's schedule
|
||||||
|
await world.page.goto(`${world.baseURL}/admin/tournaments/1/schedule`);
|
||||||
|
await world.page.waitForLoadState('networkidle');
|
||||||
|
});
|
||||||
|
|
||||||
|
Given('a tournament has a generated schedule', async function () {
|
||||||
|
console.log('🌍 Note: Tournament schedule requires generation via API or UI');
|
||||||
|
console.log('🌍 For acceptance tests, this would be created before running the test');
|
||||||
|
// In a real test run, we would:
|
||||||
|
// 1. Create a tournament
|
||||||
|
// 2. Add teams/participants
|
||||||
|
// 3. Generate schedule via API or UI
|
||||||
|
});
|
||||||
|
|||||||
@@ -230,6 +230,12 @@ Then('I should be on the password reset page', async function () {
|
|||||||
expect(currentUrl).toContain('/auth/password-reset');
|
expect(currentUrl).toContain('/auth/password-reset');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Then('I should see the {string} button', async function (buttonText: string) {
|
||||||
|
const button = world.page.locator(`button:has-text("${buttonText}")`);
|
||||||
|
await expect(button).toBeVisible();
|
||||||
|
console.log(`🌍 Verified button is visible: ${buttonText}`);
|
||||||
|
});
|
||||||
|
|
||||||
Then('I should be redirected to {string}', async function (path: string) {
|
Then('I should be redirected to {string}', async function (path: string) {
|
||||||
await world.page.waitForLoadState('networkidle');
|
await world.page.waitForLoadState('networkidle');
|
||||||
const currentUrl = world.page.url();
|
const currentUrl = world.page.url();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export interface WorldState {
|
|||||||
password: string;
|
password: string;
|
||||||
};
|
};
|
||||||
tournament?: any;
|
tournament?: any;
|
||||||
|
tournamentTeamCount?: number;
|
||||||
player?: any;
|
player?: any;
|
||||||
match?: any;
|
match?: any;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user