SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
test(e2e): fix flaky dashboards-detail specs (sidenav overlay + slow hydration) (#12180)
Ashwin Bhatkal6bdf054a0592
diff --git a/tests/e2e/fixtures/auth.ts b/tests/e2e/fixtures/auth.tsindex acac8c8ffd..8b066e5a84 100644--- a/tests/e2e/fixtures/auth.ts+++ b/tests/e2e/fixtures/auth.ts@@ -30,6 +30,7 @@ async function storageFor(browser: Browser, user: User): Promise<StorageState> {const ctx = await browser.newContext();const page = await ctx.newPage();await login(page, user);+ await pinSidenav(page);const state = await ctx.storageState();await ctx.close();return state;@@ -58,6 +59,24 @@ async function login(page: Page, user: User): Promise<void> {await page.waitForURL((url) => !url.pathname.startsWith('/login'));}+// Pin the nav suite-wide: unpinned it flies out on hover and overlays content.+// Server-side pref, so set once per user at login.+async function pinSidenav(page: Page): Promise<void> {+ const token = await page.evaluate(+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ () => (globalThis as any).localStorage.getItem('AUTH_TOKEN') || '',+ );+ const res = await page.request.put('/api/v1/user/preferences/sidenav_pinned', {+ data: { value: true },+ headers: { Authorization: `Bearer ${token}` },+ });+ if (!res.ok()) {+ throw new Error(+ `PUT /api/v1/user/preferences/sidenav_pinned ${res.status()}: ${await res.text()}`,+ );+ }+}+export const test = base.extend<{/*** User identity for this test. Override with `test.use({ user: ... })` atdiff --git a/tests/e2e/playwright.config.ts b/tests/e2e/playwright.config.tsindex 344406551c..ce993c4c9e 100644--- a/tests/e2e/playwright.config.ts+++ b/tests/e2e/playwright.config.ts@@ -31,6 +31,10 @@ export default defineConfig({// Workersworkers: process.env.CI ? 2 : undefined,+ // The SPA hydrates slowly on CI, so the 5s expect default fires mid-load.+ expect: { timeout: 15_000 },+ timeout: process.env.CI ? 60_000 : 30_000,+// Reporterreporter: [['html', { outputFolder: 'artifacts/html', open: 'never' }],diff --git a/tests/e2e/tests/dashboards/details/12-sections.spec.ts b/tests/e2e/tests/dashboards/details/12-sections.spec.tsindex cfe666d10a..31025011b6 100644--- a/tests/e2e/tests/dashboards/details/12-sections.spec.ts+++ b/tests/e2e/tests/dashboards/details/12-sections.spec.ts@@ -137,6 +137,26 @@ async function toggleSection(row: ReturnType<Page['locator']>): Promise<void> {});}+// Poll a section to the target collapsed/expanded state, re-clicking if a+// toggle is dropped under CI load. `name` has no regex metacharacters.+async function setSectionCollapsed(+ page: Page,+ name: string,+ collapsed: boolean,+): Promise<void> {+ const collapsedTitle = new RegExp(`^${name} \\(\\d+ widgets?\\)$`);+ await expect(async () => {+ const alreadyCollapsed = (await page.getByText(collapsedTitle).count()) > 0;+ if (alreadyCollapsed === collapsed) {+ return;+ }+ await toggleSection(+ sectionRow(page, alreadyCollapsed ? collapsedTitle : name),+ );+ expect((await page.getByText(collapsedTitle).count()) > 0).toBe(collapsed);+ }).toPass({ timeout: 30_000 });+}+/*** Click the settings (⋮) icon on a section header, bypassing the sidenav's* pointer-event interception via `dispatchEvent('click')` (same root cause@@ -475,19 +495,19 @@ test.describe('Dashboard Detail — Sections', () => {}) => {await gotoApmDashboard(page);- await toggleSection(sectionRow(page, 'DB Metrics'));+ await setSectionCollapsed(page, 'DB Metrics', true);await expect(page.getByText(/^DB Metrics \(\d+ widgets?\)$/).first(),).toBeVisible();- await toggleSection(sectionRow(page, 'External calls'));+ await setSectionCollapsed(page, 'External calls', true);await expect(page.getByText(/^External calls \(\d+ widgets?\)$/).first(),).toBeVisible();// Restore both so the test leaves no state behind.- await toggleSection(sectionRow(page, /^DB Metrics \(\d+ widgets?\)$/));- await toggleSection(sectionRow(page, /^External calls \(\d+ widgets?\)$/));+ await setSectionCollapsed(page, 'DB Metrics', false);+ await setSectionCollapsed(page, 'External calls', false);await expect(page.getByText(/^DB Metrics \(\d+ widgets?\)$/)).toHaveCount(0);await expect(page.getByText(/^External calls \(\d+ widgets?\)$/)).toHaveCount(0,