Skip to content

Commit 3035dac

Browse files
Copilotkarpikpl
andcommitted
Update teams-comparison screenshot with team selection and add E2E test
Co-authored-by: karpikpl <[email protected]>
1 parent 78f8ed7 commit 3035dac

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

e2e-tests/pages/DashboardPage.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class DashboardPage {
1616
readonly toolbarTitle: Locator;
1717

1818
readonly teamTabLink: Locator;
19+
readonly teamsTabLink: Locator;
1920
readonly orgTabLink: Locator;
2021
readonly enterpriseTabLink: Locator;
2122

@@ -43,12 +44,13 @@ export class DashboardPage {
4344
this.githubTabLink = page.getByRole('tab', { name: 'github.com' })
4445

4546
this.teamTabLink = page.getByRole('tab', { name: 'team' })
47+
this.teamsTabLink = page.getByRole('tab', { name: 'teams' })
4648
this.orgTabLink = page.getByRole('tab', { name: 'organization' })
4749
this.enterpriseTabLink = page.getByRole('tab', { name: 'enterprise' })
4850
}
4951

5052
async expectTeamsTabVisible() {
51-
await expect(this.teamTabLink).toBeVisible();
53+
await expect(this.teamsTabLink).toBeVisible();
5254
}
5355

5456
async expectOrgTabVisible() {
@@ -106,6 +108,12 @@ export class DashboardPage {
106108
return new GitHubTab(this.page);
107109
}
108110

111+
async gotoTeamsTab() {
112+
await this.teamsTabLink.click();
113+
// No specific page object for teams tab, just return this for fluent interface
114+
return this;
115+
}
116+
109117
async close() {
110118
await this.page.close();
111119
}

e2e-tests/teams-comparison.spec.ts

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import { expect, test } from '@playwright/test'
2+
import { DashboardPage } from './pages/DashboardPage';
3+
4+
const tag = { tag: ['@teams-comparison'] };
5+
6+
test.describe('Teams Comparison tests', () => {
7+
8+
let dashboard: DashboardPage;
9+
10+
test.beforeAll(async ({ browser }) => {
11+
const page = await browser.newPage();
12+
await page.goto('/orgs/mocked-org?mock=true');
13+
14+
dashboard = new DashboardPage(page);
15+
16+
// wait for the data
17+
await dashboard.expectMetricLabelsVisible();
18+
});
19+
20+
test.afterAll(async () => {
21+
await dashboard?.close();
22+
});
23+
24+
test('has teams tab available', tag, async () => {
25+
// Verify that teams tab is visible for org scope
26+
await dashboard.expectTeamsTabVisible();
27+
});
28+
29+
test('teams comparison functionality with team selection', tag, async () => {
30+
// Click on teams tab
31+
await dashboard.gotoTeamsTab();
32+
33+
// Wait for teams dropdown to be visible
34+
const teamsDropdown = dashboard.page.getByRole('combobox').first();
35+
await expect(teamsDropdown).toBeVisible();
36+
37+
// Click on the dropdown to open it
38+
await teamsDropdown.click();
39+
40+
// Wait for team options to appear
41+
const teamOptions = dashboard.page.locator('[role="listbox"] [role="option"]');
42+
await expect(teamOptions.first()).toBeVisible();
43+
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);
48+
49+
await firstTeam.click();
50+
await secondTeam.click();
51+
52+
// Close dropdown by pressing Escape
53+
await dashboard.page.keyboard.press('Escape');
54+
55+
// Verify that teams are selected
56+
const selectedTeamsSection = dashboard.page.locator('text=Selected Teams').first();
57+
await expect(selectedTeamsSection).toBeVisible();
58+
59+
// Verify that team metrics cards are visible
60+
const teamsSelectedCard = dashboard.page.locator('text=Teams Selected').first();
61+
await expect(teamsSelectedCard).toBeVisible();
62+
63+
const totalActiveUsersCard = dashboard.page.locator('text=Total Active Users').first();
64+
await expect(totalActiveUsersCard).toBeVisible();
65+
66+
// 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');
71+
await expect(languageUsageChart).toBeVisible();
72+
73+
const editorUsageChart = dashboard.page.locator('text=Editor Usage by Team');
74+
await expect(editorUsageChart).toBeVisible();
75+
76+
// Take a screenshot for documentation purposes
77+
await dashboard.page.screenshot({
78+
path: 'images/teams-comparison-test.png',
79+
fullPage: true
80+
});
81+
});
82+
83+
test('teams comparison empty state', tag, async () => {
84+
// Click on teams tab
85+
await dashboard.gotoTeamsTab();
86+
87+
// Verify empty state message when no teams are selected
88+
const emptyStateMessage = dashboard.page.locator('text=No Teams Selected');
89+
await expect(emptyStateMessage).toBeVisible();
90+
91+
const emptyStateDescription = dashboard.page.locator('text=Select one or more teams from the dropdown above to view and compare their metrics.');
92+
await expect(emptyStateDescription).toBeVisible();
93+
});
94+
});

images/teams-comparison.png

637 KB
Loading

0 commit comments

Comments
 (0)