|
1 | 1 | import { test, expect } from '@playwright/test'; |
2 | | -import { DashboardPage, SidebarNav, FeatureSetsPage } from '../pages'; |
| 2 | +import { DashboardPage } from '../pages'; |
3 | 3 |
|
4 | 4 | test.describe('FeatureSets Page', () => { |
5 | | - let dashboard: DashboardPage; |
6 | | - let sidebar: SidebarNav; |
7 | | - let featureSets: FeatureSetsPage; |
8 | | - |
9 | | - test.beforeEach(async ({ page }) => { |
10 | | - dashboard = new DashboardPage(page); |
11 | | - sidebar = new SidebarNav(page); |
12 | | - featureSets = new FeatureSetsPage(page); |
13 | | - |
14 | | - await dashboard.navigate(); |
15 | | - await sidebar.goToFeatureSets(); |
16 | | - await expect(featureSets.heading).toBeVisible(); |
17 | | - }); |
18 | | - |
19 | 5 | test('should display the FeatureSets heading', async ({ page }) => { |
20 | | - await expect(featureSets.heading).toBeVisible(); |
21 | | - const headingText = await featureSets.heading.textContent(); |
22 | | - expect(headingText?.toLowerCase()).toContain('feature'); |
| 6 | + const dashboard = new DashboardPage(page); |
| 7 | + await dashboard.navigate(); |
| 8 | + |
| 9 | + // Click FeatureSets in sidebar |
| 10 | + await page.locator('nav button:has-text("FeatureSets")').click(); |
| 11 | + |
| 12 | + // Check heading (use first() to avoid multiple matches) |
| 13 | + await expect(page.getByRole('heading', { name: 'Feature Sets' }).first()).toBeVisible(); |
23 | 14 | }); |
24 | 15 |
|
25 | | - test('should show description text', async ({ page }) => { |
26 | | - const description = page.locator('text=/permission|bundle|tool/i'); |
27 | | - // Some description about feature sets should be visible |
| 16 | + test('should show feature sets page content', async ({ page }) => { |
| 17 | + const dashboard = new DashboardPage(page); |
| 18 | + await dashboard.navigate(); |
| 19 | + |
| 20 | + await page.locator('nav button:has-text("FeatureSets")').click(); |
| 21 | + await expect(page.getByRole('heading', { name: 'Feature Sets' }).first()).toBeVisible(); |
| 22 | + |
| 23 | + // Page should have content |
| 24 | + const content = page.locator('[class*="rounded"]'); |
| 25 | + const count = await content.count(); |
| 26 | + expect(count).toBeGreaterThan(0); |
28 | 27 | }); |
29 | 28 |
|
30 | 29 | test('should display built-in feature sets', async ({ page }) => { |
| 30 | + const dashboard = new DashboardPage(page); |
| 31 | + await dashboard.navigate(); |
| 32 | + |
| 33 | + await page.locator('nav button:has-text("FeatureSets")').click(); |
| 34 | + |
31 | 35 | // There are usually built-in feature sets like "All Features", "Default" |
32 | 36 | const builtInSets = page.locator('text=/All Features|Default|Server:/i'); |
33 | 37 | const count = await builtInSets.count(); |
34 | 38 |
|
35 | 39 | // May have built-in sets |
36 | 40 | expect(count).toBeGreaterThanOrEqual(0); |
37 | 41 | }); |
38 | | - |
39 | | - test('should show feature set cards with details', async ({ page }) => { |
40 | | - const cards = page.locator('[class*="rounded"][class*="border"]'); |
41 | | - const count = await cards.count(); |
42 | | - |
43 | | - if (count > 0) { |
44 | | - // First card should be visible |
45 | | - await expect(cards.first()).toBeVisible(); |
46 | | - } |
47 | | - }); |
48 | 42 | }); |
49 | 43 |
|
50 | 44 | test.describe('FeatureSet Details', () => { |
51 | | - test.beforeEach(async ({ page }) => { |
| 45 | + test('should show feature set content', async ({ page }) => { |
52 | 46 | const dashboard = new DashboardPage(page); |
53 | | - const sidebar = new SidebarNav(page); |
54 | | - |
55 | 47 | await dashboard.navigate(); |
56 | | - await sidebar.goToFeatureSets(); |
57 | | - }); |
58 | | - |
59 | | - test('should expand feature set to show members', async ({ page }) => { |
60 | | - // Click on a feature set to expand it |
61 | | - const featureSetItems = page.locator('[class*="rounded"][class*="border"]'); |
62 | | - const count = await featureSetItems.count(); |
| 48 | + |
| 49 | + await page.locator('nav button:has-text("FeatureSets")').click(); |
| 50 | + |
| 51 | + // Page should have elements |
| 52 | + const cards = page.locator('[class*="rounded"][class*="border"]'); |
| 53 | + const count = await cards.count(); |
63 | 54 |
|
64 | 55 | if (count > 0) { |
65 | | - const firstItem = featureSetItems.first(); |
66 | | - const expandButton = firstItem.locator('button, [class*="chevron"]').first(); |
67 | | - |
68 | | - if (await expandButton.isVisible()) { |
69 | | - await expandButton.click(); |
70 | | - // Content should expand |
71 | | - } |
| 56 | + await expect(cards.first()).toBeVisible(); |
72 | 57 | } |
73 | 58 | }); |
74 | 59 |
|
75 | | - test('should show feature counts or member lists', async ({ page }) => { |
76 | | - // Feature sets show counts of tools, prompts, resources |
77 | | - const countIndicators = page.locator('text=/\\d+ tools?|\\d+ prompts?|\\d+ resources?/i'); |
78 | | - // May or may not be visible |
79 | | - }); |
80 | | -}); |
81 | | - |
82 | | -test.describe('FeatureSet Types', () => { |
83 | | - test.beforeEach(async ({ page }) => { |
| 60 | + test('should show server-specific feature sets if servers installed', async ({ page }) => { |
84 | 61 | const dashboard = new DashboardPage(page); |
85 | | - const sidebar = new SidebarNav(page); |
86 | | - |
87 | 62 | await dashboard.navigate(); |
88 | | - await sidebar.goToFeatureSets(); |
89 | | - }); |
90 | | - |
91 | | - test('should distinguish between built-in and custom feature sets', async ({ page }) => { |
92 | | - // Built-in sets typically have different styling or badges |
93 | | - const builtInBadge = page.locator('text=/Built-in|System|All/i'); |
94 | | - const customBadge = page.locator('text=/Custom|User/i'); |
95 | 63 |
|
96 | | - // At least one type should exist |
97 | | - }); |
98 | | - |
99 | | - test('should show server-specific feature sets if servers installed', async ({ page }) => { |
| 64 | + await page.locator('nav button:has-text("FeatureSets")').click(); |
| 65 | + |
100 | 66 | // Server-specific sets show the server name |
101 | 67 | const serverSets = page.locator('text=/Server:/i'); |
102 | 68 | const count = await serverSets.count(); |
|
0 commit comments