test: enable player schedule tests with match data setup
Related to #9 - Implemented 'I have upcoming matches in my schedule' step to create tournament, players, and match with future date - Added step definitions for schedule content verification - 2 player schedule scenarios now active (empty schedule, upcoming matches) - 'Click on match' scenario remains @wip (page lacks match detail links) Player schedule page at /players/[id]/schedule shows upcoming matches with tournament name, player names, and dates.
This commit is contained in:
@@ -599,3 +599,50 @@ Then('I should see the rankings table', async function () {
|
||||
await expect(world.page.locator('table')).toBeVisible();
|
||||
console.log('🌍 Verified rankings table is visible');
|
||||
});
|
||||
|
||||
// Player Schedule Steps
|
||||
Then('I should see the match date', async function () {
|
||||
// Check for a date-like pattern on the page
|
||||
const content = await world.page.content();
|
||||
const hasDate = content.match(/\d{1,2}\/\d{1,2}\/\d{4}/) || content.match(/\w+ \d{1,2}, \d{4}/);
|
||||
expect(hasDate).toBeTruthy();
|
||||
console.log('🌍 Verified match date is visible');
|
||||
});
|
||||
|
||||
Then('I should see my opponent\'s name', async function () {
|
||||
// Check for opponent text on the page
|
||||
const content = await world.page.content();
|
||||
const hasOpponent = content.includes('Opponent');
|
||||
expect(hasOpponent).toBe(true);
|
||||
console.log('🌍 Verified opponent name is visible');
|
||||
});
|
||||
|
||||
Then('I should see my partner\'s name', async function () {
|
||||
// Check for partner text on the page
|
||||
const content = await world.page.content();
|
||||
const hasPartner = content.includes('Partner');
|
||||
expect(hasPartner).toBe(true);
|
||||
console.log('🌍 Verified partner name is visible');
|
||||
});
|
||||
|
||||
Then('I should see the tournament name', async function () {
|
||||
// Check for tournament name on the page
|
||||
const content = await world.page.content();
|
||||
const hasTournament = content.includes('Test Schedule Tournament');
|
||||
expect(hasTournament).toBe(true);
|
||||
console.log('🌍 Verified tournament name is visible');
|
||||
});
|
||||
|
||||
When('I click on a match', async function () {
|
||||
// Click on the first match link
|
||||
const matchLink = world.page.locator('a[href*="/matches/"]').first();
|
||||
await matchLink.click();
|
||||
await world.page.waitForLoadState('domcontentloaded');
|
||||
console.log('🌍 Clicked on match');
|
||||
});
|
||||
|
||||
Then('I should be on the match detail page', async function () {
|
||||
const currentUrl = world.page.url();
|
||||
console.log(`🌍 Checking current URL: ${currentUrl}`);
|
||||
expect(currentUrl).toMatch(/\/matches\/\d+/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user