fix(e2e): scope heading locators to main content area #50

Merged
privilegedescalation-engineer[bot] merged 1 commits from fix/heading-selectors into main 2026-05-04 17:20:38 +00:00
+21 -13
View File
@@ -19,16 +19,18 @@ test.describe('Intel GPU plugin smoke tests', () => {
// Should navigate to the overview route
await expect(page).toHaveURL(/\/intel-gpu$/);
await expect(page.getByRole('heading', { name: /Intel GPU — Overview/i })).toBeVisible();
await expect(
page.locator('main').getByRole('heading', { name: 'Intel GPU — Overview' })
).toBeVisible();
});
greptile-apps[bot] commented 2026-04-21 21:14:54 +00:00 (Migrated from github.com)
Review

P2 Missing timeout after navigation

All other heading assertions in this file pass { timeout: 15_000 }, but this one does not. After gpuEntry.click() triggers a client-side navigation, the heading may not be immediately present in the DOM. Without an explicit timeout, Playwright falls back to the global expect timeout configured in playwright.config.ts. Adding the same 15_000 ms timeout used elsewhere makes the behaviour consistent and less fragile in slow CI environments.

    await expect(
      page.locator('main').getByRole('heading', { name: 'Intel GPU — Overview' })
    ).toBeVisible({ timeout: 15_000 });
Prompt To Fix With AI
This is a comment left during a code review.
Path: e2e/intel-gpu.spec.ts
Line: 22-24

Comment:
**Missing timeout after navigation**

All other heading assertions in this file pass `{ timeout: 15_000 }`, but this one does not. After `gpuEntry.click()` triggers a client-side navigation, the heading may not be immediately present in the DOM. Without an explicit timeout, Playwright falls back to the global `expect` timeout configured in `playwright.config.ts`. Adding the same `15_000` ms timeout used elsewhere makes the behaviour consistent and less fragile in slow CI environments.

```suggestion
    await expect(
      page.locator('main').getByRole('heading', { name: 'Intel GPU — Overview' })
    ).toBeVisible({ timeout: 15_000 });
```

How can I resolve this? If you propose a fix, please make it concise.
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=7" align="top"></a> **Missing timeout after navigation** All other heading assertions in this file pass `{ timeout: 15_000 }`, but this one does not. After `gpuEntry.click()` triggers a client-side navigation, the heading may not be immediately present in the DOM. Without an explicit timeout, Playwright falls back to the global `expect` timeout configured in `playwright.config.ts`. Adding the same `15_000` ms timeout used elsewhere makes the behaviour consistent and less fragile in slow CI environments. ```suggestion await expect( page.locator('main').getByRole('heading', { name: 'Intel GPU — Overview' }) ).toBeVisible({ timeout: 15_000 }); ``` <details><summary>Prompt To Fix With AI</summary> `````markdown This is a comment left during a code review. Path: e2e/intel-gpu.spec.ts Line: 22-24 Comment: **Missing timeout after navigation** All other heading assertions in this file pass `{ timeout: 15_000 }`, but this one does not. After `gpuEntry.click()` triggers a client-side navigation, the heading may not be immediately present in the DOM. Without an explicit timeout, Playwright falls back to the global `expect` timeout configured in `playwright.config.ts`. Adding the same `15_000` ms timeout used elsewhere makes the behaviour consistent and less fragile in slow CI environments. ```suggestion await expect( page.locator('main').getByRole('heading', { name: 'Intel GPU — Overview' }) ).toBeVisible({ timeout: 15_000 }); ``` How can I resolve this? If you propose a fix, please make it concise. ````` </details>
test('overview page renders GPU device list or empty state', async ({ page }) => {
await page.goto('/c/main/intel-gpu');
// Overview heading should be present
await expect(page.getByRole('heading', { name: /Intel GPU — Overview/i })).toBeVisible({
timeout: 15_000,
});
await expect(
page.locator('main').getByRole('heading', { name: 'Intel GPU — Overview' })
).toBeVisible({ timeout: 15_000 });
// Either a populated table/list or an empty-state indicator must be visible
const hasTable = await page.locator('table').first().isVisible().catch(() => false);
@@ -43,9 +45,9 @@ test.describe('Intel GPU plugin smoke tests', () => {
test('device plugins page renders or shows empty state', async ({ page }) => {
await page.goto('/c/main/intel-gpu/device-plugins');
await expect(page.getByRole('heading', { name: /Intel GPU — Device Plugins/i })).toBeVisible({
timeout: 15_000,
});
await expect(
page.locator('main').getByRole('heading', { name: 'Intel GPU — Device Plugins' })
).toBeVisible({ timeout: 15_000 });
const hasTable = await page.locator('table').first().isVisible().catch(() => false);
const hasEmptyState = await page
@@ -61,18 +63,24 @@ test.describe('Intel GPU plugin smoke tests', () => {
// not after clicking the parent entry from the overview. Test route
// accessibility via direct navigation — each route must render its heading.
await page.goto('/c/main/intel-gpu');
await expect(page.getByRole('heading', { name: /Intel GPU — Overview/i })).toBeVisible({
timeout: 15_000,
});
await expect(
page.locator('main').getByRole('heading', { name: 'Intel GPU — Overview' })
).toBeVisible({ timeout: 15_000 });
await page.goto('/c/main/intel-gpu/nodes');
await expect(page.getByRole('heading', { name: /Intel GPU — Nodes/i })).toBeVisible({ timeout: 15_000 });
await expect(
page.locator('main').getByRole('heading', { name: 'Intel GPU — Nodes' })
).toBeVisible({ timeout: 15_000 });
await page.goto('/c/main/intel-gpu/pods');
await expect(page.getByRole('heading', { name: /Intel GPU — Pods/i })).toBeVisible({ timeout: 15_000 });
await expect(
page.locator('main').getByRole('heading', { name: 'Intel GPU — Pods' })
).toBeVisible({ timeout: 15_000 });
await page.goto('/c/main/intel-gpu/metrics');
await expect(page.getByRole('heading', { name: /Intel GPU — Metrics/i })).toBeVisible({ timeout: 15_000 });
await expect(
page.locator('main').getByRole('heading', { name: 'Intel GPU — Metrics' })
).toBeVisible({ timeout: 15_000 });
});
test('plugin settings page shows intel-gpu plugin entry', async ({ page }) => {