Files
headlamp-tns-csi-plugin/e2e/tns-csi.spec.ts
T
privilegedescalation-engineer[bot] be254b1eec feat(e2e): consolidate E2E infra + add waitForSidebar (PRI-698) (#42)
* feat(e2e): consolidate E2E test infrastructure + add waitForSidebar (PRI-698)

- Adds e2e/auth.setup.ts, e2e/tns-csi.spec.ts with waitForSidebar helper
- Adds playwright.config.ts, scripts/deploy-e2e-headlamp.sh, scripts/teardown-e2e-headlamp.sh
- Adds .github/workflows/e2e.yaml
- Plugin settings test waits for list before searching

* fix(e2e): add @playwright/test to devDependencies and e2e script (PRI-698)

@playwright/test was missing from devDependencies, causing the
'Install Playwright browsers' step to fail. Added it alongside
the e2e npm script so the reusable workflow can run playwright test.

* fix(e2e): reference @main workflow after .github merge

Co-Authored-By: Paperclip <noreply@paperclip.ing>

---------

Co-authored-by: Chris Farhood <chris@farhood.org>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-05-06 00:43:55 +00:00

52 lines
1.9 KiB
TypeScript

import { test, expect } from '@playwright/test';
async function waitForSidebar(page: import('@playwright/test').Page) {
const sidebar = page.getByRole('navigation', { name: 'Navigation' });
await expect(sidebar).toBeVisible({ timeout: 15_000 });
await page.waitForLoadState('networkidle');
return sidebar;
}
test.describe('TNS CSI plugin smoke tests', () => {
test('sidebar contains TNS CSI entry', async ({ page }) => {
await page.goto('/');
const sidebar = await waitForSidebar(page);
await expect(sidebar.getByRole('button', { name: /tns.csi/i })).toBeVisible();
});
test('TNS CSI sidebar entry navigates to TNS CSI view', async ({ page }) => {
await page.goto('/');
const sidebar = await waitForSidebar(page);
const entry = sidebar.getByRole('button', { name: /tns.csi/i });
await expect(entry).toBeVisible();
await entry.click();
await page.waitForLoadState('networkidle');
await expect(page).toHaveURL(/tns-csi/);
await expect(page.getByRole('heading', { name: /TNS.CSI/i })).toBeVisible();
});
test('TNS CSI page renders content', async ({ page }) => {
await page.goto('/c/main/tns-csi');
await waitForSidebar(page);
await expect(page.getByRole('heading', { name: /TNS.CSI/i })).toBeVisible({
timeout: 15_000,
});
const hasTable = await page.locator('table').first().isVisible().catch(() => false);
const hasContent = await page.locator('[class*="Mui"]').first().isVisible().catch(() => false);
expect(hasTable || hasContent).toBe(true);
});
test('plugin settings page shows TNS CSI plugin entry', async ({ page }) => {
await page.goto('/settings/plugins');
await page.waitForLoadState('networkidle');
await page.waitForSelector('[class*="PluginList"], [class*="plugins"], table, list', { timeout: 10_000 }).catch(() => {});
const pluginEntry = page.locator('text=/tns.csi/i').first();
await expect(pluginEntry).toBeVisible({ timeout: 30_000 });
});
});