From 10b6f8e7e0973acce0f89a7feebf8947d11d72ff Mon Sep 17 00:00:00 2001 From: Gandalf the Greybeard Date: Mon, 27 Apr 2026 00:36:29 +0000 Subject: [PATCH] fix(e2e): use [role=main] instead of main element Switch from 'main' element selector to '[role="main"]' attribute selector for better compatibility with Headlamp's app structure. Co-Authored-By: Paperclip --- e2e/polaris.spec.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/e2e/polaris.spec.ts b/e2e/polaris.spec.ts index cbd3244..608705c 100644 --- a/e2e/polaris.spec.ts +++ b/e2e/polaris.spec.ts @@ -14,19 +14,19 @@ test.describe('Polaris plugin smoke tests', () => { // SectionHeader renders a heading await expect( - page.locator('main').getByRole('heading', { name: 'Polaris \u2014 Overview' }) + page.locator('[role="main"]').getByRole('heading', { name: 'Polaris \u2014 Overview' }) ).toBeVisible(); // "Cluster Score" section exists with a percentage - await expect(page.locator('main').getByText('Cluster Score')).toBeVisible(); - await expect(page.locator('main').getByText(/%/).first()).toBeVisible(); + await expect(page.locator('[role="main"]').getByText('Cluster Score')).toBeVisible(); + await expect(page.locator('[role="main"]').getByText(/%/).first()).toBeVisible(); }); test('namespaces page renders table with namespace buttons', async ({ page }) => { await page.goto('/c/main/polaris/namespaces'); await expect( - page.locator('main').getByRole('heading', { name: 'Polaris \u2014 Namespaces' }) + page.locator('[role="main"]').getByRole('heading', { name: 'Polaris \u2014 Namespaces' }) ).toBeVisible(); // Table should have at least one row with a namespace button @@ -52,14 +52,14 @@ test.describe('Polaris plugin smoke tests', () => { // Drawer should open and show the namespace name in the heading await expect( - page.locator('main').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) + page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) ).toBeVisible(); // "Namespace Score" section should be present in drawer - await expect(page.locator('main').getByText('Namespace Score')).toBeVisible(); + await expect(page.locator('[role="main"]').getByText('Namespace Score')).toBeVisible(); // Resources table should exist in drawer - await expect(page.locator('main').getByRole('heading', { name: 'Resources' })).toBeVisible(); + await expect(page.locator('[role="main"]').getByRole('heading', { name: 'Resources' })).toBeVisible(); // URL hash should be updated with namespace name await expect(page).toHaveURL(/\/polaris\/namespaces#/); @@ -77,7 +77,7 @@ test.describe('Polaris plugin smoke tests', () => { // Verify drawer is open await expect( - page.locator('main').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) + page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) ).toBeVisible(); // Press Escape key @@ -85,7 +85,7 @@ test.describe('Polaris plugin smoke tests', () => { // Drawer should close (heading should not be visible anymore) await expect( - page.locator('main').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) + page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) ).not.toBeVisible(); // URL hash should be cleared @@ -105,10 +105,10 @@ test.describe('Polaris plugin smoke tests', () => { // Drawer should automatically open with the namespace details await expect( - page.locator('main').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) + page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` }) ).toBeVisible(); // "Namespace Score" section should be present - await expect(page.locator('main').getByText('Namespace Score')).toBeVisible(); + await expect(page.locator('[role="main"]').getByText('Namespace Score')).toBeVisible(); }); });