fix(e2e): add waitForSidebar helper and networkidle waits for reliability #19
+15
-7
@@ -1,30 +1,37 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
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('ArgoCD plugin smoke tests', () => {
|
test.describe('ArgoCD plugin smoke tests', () => {
|
||||||
test('sidebar contains ArgoCD entry', async ({ page }) => {
|
test('sidebar contains ArgoCD entry', async ({ page }) => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
const sidebar = page.getByRole('navigation', { name: 'Navigation' });
|
const sidebar = await waitForSidebar(page);
|
||||||
await expect(sidebar).toBeVisible({ timeout: 15_000 });
|
|
||||||
await expect(sidebar.getByRole('button', { name: /argocd/i })).toBeVisible();
|
await expect(sidebar.getByRole('button', { name: /argocd/i })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('ArgoCD sidebar entry navigates to applications list', async ({ page }) => {
|
test('ArgoCD sidebar entry navigates to applications list', async ({ page }) => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
const sidebar = page.getByRole('navigation', { name: 'Navigation' });
|
const sidebar = await waitForSidebar(page);
|
||||||
await expect(sidebar).toBeVisible({ timeout: 15_000 });
|
|
||||||
|
|
||||||
const argocdEntry = sidebar.getByRole('button', { name: /argocd/i });
|
const argocdEntry = sidebar.getByRole('button', { name: /argocd/i });
|
||||||
await expect(argocdEntry).toBeVisible();
|
await expect(argocdEntry).toBeVisible();
|
||||||
await argocdEntry.click();
|
await argocdEntry.click();
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/argocd/);
|
await page.waitForLoadState('networkidle');
|
||||||
await expect(page.getByRole('heading', { name: /argo.*cd|applications/i })).toBeVisible();
|
await expect(page).toHaveURL(/argocd/);
|
||||||
|
await expect(page.getByRole('heading', { name: /argo.*cd.*applications/i })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('applications list page renders', async ({ page }) => {
|
test('applications list page renders', async ({ page }) => {
|
||||||
await page.goto('/c/main/argocd');
|
await page.goto('/c/main/argocd');
|
||||||
|
await waitForSidebar(page);
|
||||||
|
|
||||||
await expect(page.getByRole('heading', { name: /argo.*cd|applications/i })).toBeVisible({
|
await expect(page.getByRole('heading', { name: /argo.*cd.*applications/i })).toBeVisible({
|
||||||
timeout: 15_000,
|
timeout: 15_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -35,6 +42,7 @@ test.describe('ArgoCD plugin smoke tests', () => {
|
|||||||
|
|
||||||
test('plugin settings page shows argocd plugin entry', async ({ page }) => {
|
test('plugin settings page shows argocd plugin entry', async ({ page }) => {
|
||||||
await page.goto('/settings/plugins');
|
await page.goto('/settings/plugins');
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
const pluginEntry = page.locator('text=/argocd|argo.*cd/i').first();
|
const pluginEntry = page.locator('text=/argocd|argo.*cd/i').first();
|
||||||
await expect(pluginEntry).toBeVisible({ timeout: 30_000 });
|
await expect(pluginEntry).toBeVisible({ timeout: 30_000 });
|
||||||
|
|||||||
Reference in New Issue
Block a user