|
1 | 1 | import { expect, test } from './test-utils' |
2 | 2 |
|
| 3 | +test.describe('Compare Page', () => { |
| 4 | + test('no-dep column renders separately from package columns', async ({ page, goto }) => { |
| 5 | + await goto('/compare?packages=vue,__no_dependency__', { waitUntil: 'hydration' }) |
| 6 | + |
| 7 | + const grid = page.locator('.comparison-grid') |
| 8 | + await expect(grid).toBeVisible({ timeout: 15000 }) |
| 9 | + |
| 10 | + // Should have the no-dep column with special styling |
| 11 | + const noDepColumn = grid.locator('.comparison-cell-nodep') |
| 12 | + await expect(noDepColumn).toBeVisible() |
| 13 | + |
| 14 | + // The no-dep column should not contain a link |
| 15 | + await expect(noDepColumn.locator('a')).toHaveCount(0) |
| 16 | + }) |
| 17 | + |
| 18 | + test('no-dep column is always last even when packages are added after', async ({ |
| 19 | + page, |
| 20 | + goto, |
| 21 | + }) => { |
| 22 | + // Start with vue and no-dep |
| 23 | + await goto('/compare?packages=vue,__no_dependency__', { waitUntil: 'hydration' }) |
| 24 | + |
| 25 | + const grid = page.locator('.comparison-grid') |
| 26 | + await expect(grid).toBeVisible({ timeout: 15000 }) |
| 27 | + |
| 28 | + // Add another package via the input |
| 29 | + const input = page.locator('#package-search') |
| 30 | + await input.fill('nuxt') |
| 31 | + |
| 32 | + // Wait for search results and click on nuxt |
| 33 | + const nuxtOption = page.locator('button:has-text("nuxt")').first() |
| 34 | + await expect(nuxtOption).toBeVisible({ timeout: 10000 }) |
| 35 | + await nuxtOption.click() |
| 36 | + |
| 37 | + // URL should have no-dep at the end, not in the middle |
| 38 | + await expect(page).toHaveURL(/packages=vue,nuxt,__no_dependency__/) |
| 39 | + |
| 40 | + // Verify column order in the grid: vue, nuxt, then no-dep |
| 41 | + const headerLinks = grid.locator('.comparison-cell-header a.truncate') |
| 42 | + await expect(headerLinks).toHaveCount(2) |
| 43 | + await expect(headerLinks.nth(0)).toContainText('vue') |
| 44 | + await expect(headerLinks.nth(1)).toContainText('nuxt') |
| 45 | + |
| 46 | + // No-dep should still be visible as the last column |
| 47 | + const noDepColumn = grid.locator('.comparison-cell-nodep') |
| 48 | + await expect(noDepColumn).toBeVisible() |
| 49 | + }) |
| 50 | +}) |
| 51 | + |
3 | 52 | test.describe('Search Pages', () => { |
4 | 53 | test('/search?q=vue → keyboard navigation (arrow keys + enter)', async ({ page, goto }) => { |
5 | 54 | await goto('/search?q=vue', { waitUntil: 'hydration' }) |
|
0 commit comments