@@ -30,47 +30,43 @@ test.describe('Teams Comparison tests', () => {
30
30
// Click on teams tab
31
31
await dashboard . gotoTeamsTab ( ) ;
32
32
33
- // Wait for teams dropdown to be visible
34
- const teamsDropdown = dashboard . page . getByRole ( ' combobox') . first ( ) ;
33
+ // Wait for the team selection dropdown to be visible
34
+ const teamsDropdown = dashboard . page . locator ( 'input[role=" combobox"] ') . first ( ) ;
35
35
await expect ( teamsDropdown ) . toBeVisible ( ) ;
36
36
37
37
// Click on the dropdown to open it
38
38
await teamsDropdown . click ( ) ;
39
39
40
- // Wait for team options to appear
41
- const teamOptions = dashboard . page . locator ( '[role="listbox"] [role="option"]' ) ;
42
- await expect ( teamOptions . first ( ) ) . toBeVisible ( ) ;
40
+ // Wait for team options to appear and select first two teams
41
+ // Use specific team names from mock data
42
+ const theATeamOption = dashboard . page . getByText ( 'The A Team' ) ;
43
+ const devTeamOption = dashboard . page . getByText ( 'Development Team' ) ;
43
44
44
- // Select at least 2 teams as requested in the comment
45
- // Get the first two team options
46
- const firstTeam = teamOptions . first ( ) ;
47
- const secondTeam = teamOptions . nth ( 1 ) ;
45
+ await expect ( theATeamOption ) . toBeVisible ( ) ;
46
+ await theATeamOption . click ( ) ;
48
47
49
- await firstTeam . click ( ) ;
50
- await secondTeam . click ( ) ;
48
+ await expect ( devTeamOption ) . toBeVisible ( ) ;
49
+ await devTeamOption . click ( ) ;
51
50
52
- // Close dropdown by pressing Escape
53
- await dashboard . page . keyboard . press ( 'Escape' ) ;
51
+ // Click outside to close dropdown
52
+ await dashboard . page . locator ( 'body' ) . click ( ) ;
54
53
55
54
// Verify that teams are selected
56
- const selectedTeamsSection = dashboard . page . locator ( 'text= Selected Teams') . first ( ) ;
55
+ const selectedTeamsSection = dashboard . page . getByText ( ' Selected Teams') ;
57
56
await expect ( selectedTeamsSection ) . toBeVisible ( ) ;
58
57
59
58
// Verify that team metrics cards are visible
60
- const teamsSelectedCard = dashboard . page . locator ( 'text= Teams Selected') . first ( ) ;
59
+ const teamsSelectedCard = dashboard . page . getByText ( ' Teams Selected') ;
61
60
await expect ( teamsSelectedCard ) . toBeVisible ( ) ;
62
61
63
- const totalActiveUsersCard = dashboard . page . locator ( 'text= Total Active Users') . first ( ) ;
62
+ const totalActiveUsersCard = dashboard . page . getByText ( ' Total Active Users') ;
64
63
await expect ( totalActiveUsersCard ) . toBeVisible ( ) ;
65
64
66
65
// Verify that charts are displayed
67
- const acceptanceRateChart = dashboard . page . locator ( 'h2:has-text("Acceptance Rate by Count (%)")' ) ;
68
- await expect ( acceptanceRateChart ) . toBeVisible ( ) ;
69
-
70
- const languageUsageChart = dashboard . page . locator ( 'text=Language Usage by Team' ) ;
66
+ const languageUsageChart = dashboard . page . getByText ( 'Language Usage by Team' ) ;
71
67
await expect ( languageUsageChart ) . toBeVisible ( ) ;
72
68
73
- const editorUsageChart = dashboard . page . locator ( 'text= Editor Usage by Team') ;
69
+ const editorUsageChart = dashboard . page . getByText ( ' Editor Usage by Team') ;
74
70
await expect ( editorUsageChart ) . toBeVisible ( ) ;
75
71
76
72
// Take a screenshot for documentation purposes
@@ -85,10 +81,10 @@ test.describe('Teams Comparison tests', () => {
85
81
await dashboard . gotoTeamsTab ( ) ;
86
82
87
83
// Verify empty state message when no teams are selected
88
- const emptyStateMessage = dashboard . page . locator ( 'text= No Teams Selected') ;
84
+ const emptyStateMessage = dashboard . page . getByText ( ' No Teams Selected') ;
89
85
await expect ( emptyStateMessage ) . toBeVisible ( ) ;
90
86
91
- const emptyStateDescription = dashboard . page . locator ( 'text= Select one or more teams from the dropdown above to view and compare their metrics.') ;
87
+ const emptyStateDescription = dashboard . page . getByText ( ' Select one or more teams from the dropdown above to view and compare their metrics.') ;
92
88
await expect ( emptyStateDescription ) . toBeVisible ( ) ;
93
89
} ) ;
94
90
} ) ;
0 commit comments