From d83798791695462fdf2666b5ef8813a28387659d Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Mon, 9 Feb 2026 08:08:52 -0500 Subject: [PATCH] fix: update e2e tests for drawer navigation pattern Update Playwright e2e tests to match the new drawer-based namespace detail navigation instead of the old full-page route pattern. Changes: - Update "namespaces page" test: expect buttons instead of links - Update "namespace detail" test: expect drawer to open instead of page navigation - Add test for URL hash in drawer - Add test for Escape key closing drawer - Add test for opening drawer directly from URL hash All tests now validate the drawer UX pattern with hash-based navigation. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- e2e/polaris.spec.ts | 79 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/e2e/polaris.spec.ts b/e2e/polaris.spec.ts index 29e1877..f43dc7f 100644 --- a/e2e/polaris.spec.ts +++ b/e2e/polaris.spec.ts @@ -20,42 +20,91 @@ test.describe('Polaris plugin smoke tests', () => { await expect(page.getByText(/%/)).toBeVisible(); }); - test('namespaces page renders table with links', async ({ page }) => { + test('namespaces page renders table with namespace buttons', async ({ page }) => { await page.goto('/c/main/polaris/namespaces'); await expect(page.getByRole('heading', { name: 'Polaris \u2014 Namespaces' })).toBeVisible(); - // Table should have at least one row with a namespace link + // Table should have at least one row with a namespace button const table = page.locator('table'); await expect(table).toBeVisible(); const rows = table.locator('tbody tr'); await expect(rows.first()).toBeVisible(); - // Each namespace row should contain a link - const firstLink = rows.first().locator('a'); - await expect(firstLink).toBeVisible(); + // Each namespace row should contain a button (now buttons instead of links for drawer) + const firstButton = rows.first().locator('button'); + await expect(firstButton).toBeVisible(); }); - test('namespace detail page renders from table link', async ({ page }) => { + test('namespace detail drawer opens from table button', async ({ page }) => { await page.goto('/c/main/polaris/namespaces'); - // Click the first namespace link in the table + // Click the first namespace button in the table const table = page.locator('table'); await expect(table).toBeVisible(); - const firstLink = table.locator('tbody tr').first().locator('a'); - const namespaceName = await firstLink.textContent(); - await firstLink.click(); + const firstButton = table.locator('tbody tr').first().locator('button'); + const namespaceName = await firstButton.textContent(); + await firstButton.click(); - // Detail page should show the namespace name in the heading + // Drawer should open and show the namespace name in the heading + await expect( + page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) + ).toBeVisible(); + + // "Namespace Score" section should be present in drawer + await expect(page.getByText('Namespace Score')).toBeVisible(); + + // Resources table should exist in drawer + await expect(page.getByText('Resources')).toBeVisible(); + + // URL hash should be updated with namespace name + await expect(page).toHaveURL(/\/polaris\/namespaces#/); + }); + + test('namespace detail drawer closes with Escape key', async ({ page }) => { + await page.goto('/c/main/polaris/namespaces'); + + // Open the drawer by clicking a namespace button + const table = page.locator('table'); + await expect(table).toBeVisible(); + const firstButton = table.locator('tbody tr').first().locator('button'); + const namespaceName = await firstButton.textContent(); + await firstButton.click(); + + // Verify drawer is open + await expect( + page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) + ).toBeVisible(); + + // Press Escape key + await page.keyboard.press('Escape'); + + // Drawer should close (heading should not be visible anymore) + await expect( + page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) + ).not.toBeVisible(); + + // URL hash should be cleared + await expect(page).toHaveURL(/\/polaris\/namespaces$/); + }); + + test('namespace detail drawer opens from URL hash', async ({ page }) => { + // Get a namespace name first + await page.goto('/c/main/polaris/namespaces'); + const table = page.locator('table'); + await expect(table).toBeVisible(); + const firstButton = table.locator('tbody tr').first().locator('button'); + const namespaceName = await firstButton.textContent(); + + // Navigate directly to URL with hash + await page.goto(`/c/main/polaris/namespaces#${namespaceName}`); + + // Drawer should automatically open with the namespace details await expect( page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) ).toBeVisible(); // "Namespace Score" section should be present await expect(page.getByText('Namespace Score')).toBeVisible(); - - // Resources table should exist - await expect(page.getByText('Resources')).toBeVisible(); - await expect(page.locator('table')).toBeVisible(); }); });