|
| 1 | +import { test, expect } from '@playwright/test'; |
| 2 | +import { DashboardPage, SidebarNav, SettingsPage } from '../pages'; |
| 3 | + |
| 4 | +test.describe('Navigation', () => { |
| 5 | + test('should load the dashboard on startup', async ({ page }) => { |
| 6 | + const dashboard = new DashboardPage(page); |
| 7 | + await dashboard.navigate(); |
| 8 | + |
| 9 | + await expect(dashboard.heading).toBeVisible(); |
| 10 | + await expect(page.locator('text=Welcome to McpMux')).toBeVisible(); |
| 11 | + }); |
| 12 | + |
| 13 | + test('should navigate to settings page', async ({ page }) => { |
| 14 | + const dashboard = new DashboardPage(page); |
| 15 | + const sidebar = new SidebarNav(page); |
| 16 | + const settings = new SettingsPage(page); |
| 17 | + |
| 18 | + await dashboard.navigate(); |
| 19 | + await sidebar.goToSettings(); |
| 20 | + |
| 21 | + await expect(settings.heading).toBeVisible(); |
| 22 | + await expect(page.locator('text=Configure McpMux')).toBeVisible(); |
| 23 | + }); |
| 24 | + |
| 25 | + test('should navigate to all main pages', async ({ page }) => { |
| 26 | + const dashboard = new DashboardPage(page); |
| 27 | + const sidebar = new SidebarNav(page); |
| 28 | + |
| 29 | + await dashboard.navigate(); |
| 30 | + |
| 31 | + // Navigate to each page and verify heading |
| 32 | + await sidebar.goToMyServers(); |
| 33 | + await expect(page.getByRole('heading', { name: /Servers|My Servers/i })).toBeVisible(); |
| 34 | + |
| 35 | + await sidebar.goToDiscover(); |
| 36 | + await expect(page.getByRole('heading', { name: /Discover|Registry/i })).toBeVisible(); |
| 37 | + |
| 38 | + await sidebar.goToSpaces(); |
| 39 | + await expect(page.getByRole('heading', { name: 'Spaces' })).toBeVisible(); |
| 40 | + |
| 41 | + await sidebar.goToFeatureSets(); |
| 42 | + await expect(page.getByRole('heading', { name: /FeatureSets|Feature Sets/i })).toBeVisible(); |
| 43 | + |
| 44 | + await sidebar.goToClients(); |
| 45 | + await expect(page.getByRole('heading', { name: 'Clients' })).toBeVisible(); |
| 46 | + |
| 47 | + await sidebar.goToDashboard(); |
| 48 | + await expect(dashboard.heading).toBeVisible(); |
| 49 | + }); |
| 50 | +}); |
0 commit comments