fix(e2e): hybrid approach - unscoped headings, main-scoped text

Use broader heading selectors matching intel-gpu pattern, but
keep text checks scoped to main element to avoid sidebar conflicts.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Gandalf the Greybeard
2026-04-27 00:46:30 +00:00
parent 10b6f8e7e0
commit 690723317e
+11 -15
View File
@@ -13,21 +13,17 @@ test.describe('Polaris plugin smoke tests', () => {
await page.goto('/c/main/polaris');
// SectionHeader renders a heading
await expect(
page.locator('[role="main"]').getByRole('heading', { name: 'Polaris \u2014 Overview' })
).toBeVisible();
await expect(page.getByRole('heading', { name: /Polaris \u2014 Overview/i })).toBeVisible();
// "Cluster Score" section exists with a percentage
await expect(page.locator('[role="main"]').getByText('Cluster Score')).toBeVisible();
await expect(page.locator('[role="main"]').getByText(/%/).first()).toBeVisible();
await expect(page.locator('main').getByText('Cluster Score')).toBeVisible();
await expect(page.locator('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('[role="main"]').getByRole('heading', { name: 'Polaris \u2014 Namespaces' })
).toBeVisible();
await expect(page.getByRole('heading', { name: /Polaris \u2014 Namespaces/i })).toBeVisible();
// Table should have at least one row with a namespace button
const table = page.locator('table');
@@ -52,14 +48,14 @@ test.describe('Polaris plugin smoke tests', () => {
// Drawer should open and show the namespace name in the heading
await expect(
page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
).toBeVisible();
// "Namespace Score" section should be present in drawer
await expect(page.locator('[role="main"]').getByText('Namespace Score')).toBeVisible();
await expect(page.locator('main').getByText('Namespace Score')).toBeVisible();
// Resources table should exist in drawer
await expect(page.locator('[role="main"]').getByRole('heading', { name: 'Resources' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Resources' })).toBeVisible();
// URL hash should be updated with namespace name
await expect(page).toHaveURL(/\/polaris\/namespaces#/);
@@ -77,7 +73,7 @@ test.describe('Polaris plugin smoke tests', () => {
// Verify drawer is open
await expect(
page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
).toBeVisible();
// Press Escape key
@@ -85,7 +81,7 @@ test.describe('Polaris plugin smoke tests', () => {
// Drawer should close (heading should not be visible anymore)
await expect(
page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
).not.toBeVisible();
// URL hash should be cleared
@@ -105,10 +101,10 @@ test.describe('Polaris plugin smoke tests', () => {
// Drawer should automatically open with the namespace details
await expect(
page.locator('[role="main"]').getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
page.getByRole('heading', { name: `Polaris \u2014 ${namespaceName}` })
).toBeVisible();
// "Namespace Score" section should be present
await expect(page.locator('[role="main"]').getByText('Namespace Score')).toBeVisible();
await expect(page.locator('main').getByText('Namespace Score')).toBeVisible();
});
});