Skip to content

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.

test(quick-filters): add settings-with-banner stories for every filters page (#12968)

Aditya Singh2a7f4fd60328
diff --git a/frontend/src/pages/AllErrors/stories/AllErrors.stories.tsx b/frontend/src/pages/AllErrors/stories/AllErrors.stories.tsx
index f18e3c9858..a43d2fb9bc 100644
--- a/frontend/src/pages/AllErrors/stories/AllErrors.stories.tsx
+++ b/frontend/src/pages/AllErrors/stories/AllErrors.stories.tsx
@@ -98,17 +98,30 @@ export const QuickFiltersSettings: Story = {
play: openQuickFiltersSettings,
};
+const dirtyQuickFiltersSettings = async (): Promise<void> => {
+ await openQuickFiltersSettings();
+
+ // One Remove per added filter; the first row's is the one clicked.
+ const [removeFilter] = await screen.findAllByRole('button', {
+ name: 'Remove',
+ });
+
+ await userEvent.click(removeFilter);
+ await screen.findByRole('button', { name: 'Save changes' });
+};
+
/** Settings with an unsaved filter removal and the fixed action footer. */
export const QuickFiltersSettingsDirty: Story = {
- play: async (): Promise<void> => {
- await openQuickFiltersSettings();
-
- // One Remove per added filter; the first row's is the one clicked.
- const [removeFilter] = await screen.findAllByRole('button', {
- name: 'Remove',
- });
+ play: dirtyQuickFiltersSettings,
+};
- await userEvent.click(removeFilter);
- await screen.findByRole('button', { name: 'Save changes' });
- },
+/**
+ * The same panel with a banner above the shell. The banner takes 48px off the
+ * layout, so this is the case where the footer used to be pushed off screen:
+ * the panel is sized from the filters pane rather than the viewport, which
+ * keeps Save changes reachable.
+ */
+export const QuickFiltersSettingsWithBanner: Story = {
+ args: { banner: 'trial-expiry' },
+ play: dirtyQuickFiltersSettings,
};
diff --git a/frontend/src/pages/ApiMonitoring/stories/ApiMonitoringPage.stories.tsx b/frontend/src/pages/ApiMonitoring/stories/ApiMonitoringPage.stories.tsx
index 64598fb9ff..8e488fc3ab 100644
--- a/frontend/src/pages/ApiMonitoring/stories/ApiMonitoringPage.stories.tsx
+++ b/frontend/src/pages/ApiMonitoring/stories/ApiMonitoringPage.stories.tsx
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
-import { expect, userEvent, waitFor, within } from 'storybook/test';
+import { expect, screen, userEvent, waitFor, within } from 'storybook/test';
import { storyMocks } from '@/storybook/controls/defineStoryMocks';
import type { PageStoryArgs } from '@/storybook/runtime/resolveStory';
@@ -59,6 +59,35 @@ export const PortDomain: Story = {
/** The page fetches before it renders a filter, which outlasts the 1s default. */
const untilLoaded = { timeout: 15_000 };
+const openQuickFiltersSettings = async (): Promise<void> => {
+ // The settings control renders disabled while its permission check is in
+ // flight and is swapped for the enabled one once the check answers, so it is
+ // looked up again on every attempt; a click on the disabled one is dropped in
+ // silence.
+ const control = await waitFor(() => {
+ const settings = screen.getByTestId('settings-icon-container');
+
+ expect(settings).toBeEnabled();
+
+ return settings;
+ }, untilLoaded);
+
+ await userEvent.click(control);
+ await screen.findByText('Edit quick filters', undefined, untilLoaded);
+};
+
+const dirtyQuickFiltersSettings = async (): Promise<void> => {
+ await openQuickFiltersSettings();
+
+ // One Remove per added filter; the first row's is the one clicked.
+ const [removeFilter] = await screen.findAllByRole('button', {
+ name: 'Remove',
+ });
+
+ await userEvent.click(removeFilter);
+ await screen.findByRole('button', { name: 'Save changes' });
+};
+
/**
* The quick-filter panel has no test id of its own, and it only mounts once the
* workspace's filters have answered.
@@ -143,3 +172,24 @@ export const NoExternalCalls: Story = {
export const Loading: Story = {
args: { dataState: 'loading' },
};
+
+/** The editable quick-filter settings panel. */
+export const QuickFiltersSettings: Story = {
+ play: openQuickFiltersSettings,
+};
+
+/** Settings with an unsaved filter removal and the fixed action footer. */
+export const QuickFiltersSettingsDirty: Story = {
+ play: dirtyQuickFiltersSettings,
+};
+
+/**
+ * The same panel with a banner above the shell. The banner takes 48px off the
+ * layout, so this is the case where the footer used to be pushed off screen:
+ * the panel is sized from the filters pane rather than the viewport, which
+ * keeps Save changes reachable.
+ */
+export const QuickFiltersSettingsWithBanner: Story = {
+ args: { banner: 'trial-expiry' },
+ play: dirtyQuickFiltersSettings,
+};
diff --git a/frontend/src/pages/LLMObservability/Explorer/stories/Explorer.stories.tsx b/frontend/src/pages/LLMObservability/Explorer/stories/Explorer.stories.tsx
index fb86f6c791..9d00016dbc 100644
--- a/frontend/src/pages/LLMObservability/Explorer/stories/Explorer.stories.tsx
+++ b/frontend/src/pages/LLMObservability/Explorer/stories/Explorer.stories.tsx
@@ -146,11 +146,39 @@ export const Failed: Story = {
parameters: { allowConsoleErrors: true },
};
+const dirtyQuickFiltersSettings = async (): Promise<void> => {
+ await openQuickFiltersSettings();
+
+ // One Remove per added filter; the first row's is the one clicked.
+ const [removeFilter] = await screen.findAllByRole('button', {
+ name: 'Remove',
+ });
+
+ await userEvent.click(removeFilter);
+ await screen.findByRole('button', { name: 'Save changes' });
+};
+
/** The editable quick-filter settings panel. */
export const QuickFiltersSettings: Story = {
play: openQuickFiltersSettings,
};
+/** Settings with an unsaved filter removal and the fixed action footer. */
+export const QuickFiltersSettingsDirty: Story = {
+ play: dirtyQuickFiltersSettings,
+};
+
+/**
+ * The same panel with a banner above the shell. The banner takes 48px off the
+ * layout, so this is the case where the footer used to be pushed off screen:
+ * the panel is sized from the filters pane rather than the viewport, which
+ * keeps Save changes reachable.
+ */
+export const QuickFiltersSettingsWithBanner: Story = {
+ args: { banner: 'trial-expiry' },
+ play: dirtyQuickFiltersSettings,
+};
+
/** A quick-filter value selected against the LLM span query. */
export const QuickFilterSelected: Story = {
play: async ({ canvasElement }): Promise<void> => {
diff --git a/frontend/src/pages/LogsModulePage/stories/LogsModulePage.stories.tsx b/frontend/src/pages/LogsModulePage/stories/LogsModulePage.stories.tsx
index 0678f1b21b..f8a3e185e4 100644
--- a/frontend/src/pages/LogsModulePage/stories/LogsModulePage.stories.tsx
+++ b/frontend/src/pages/LogsModulePage/stories/LogsModulePage.stories.tsx
@@ -166,18 +166,31 @@ export const QuickFiltersSettings: Story = {
play: openQuickFiltersSettings,
};
+const dirtyQuickFiltersSettings = async (): Promise<void> => {
+ await openQuickFiltersSettings();
+ // One Remove per added filter; the first row's is the one clicked.
+ const [removeFilter] = await screen.findAllByRole('button', {
+ name: 'Remove',
+ });
+
+ await userEvent.click(removeFilter);
+ await screen.findByRole('button', { name: 'Save changes' });
+};
+
/** Settings with an unsaved filter removal and the fixed action footer. */
export const QuickFiltersSettingsDirty: Story = {
- play: async (): Promise<void> => {
- await openQuickFiltersSettings();
- // One Remove per added filter; the first row's is the one clicked.
- const [removeFilter] = await screen.findAllByRole('button', {
- name: 'Remove',
- });
-
- await userEvent.click(removeFilter);
- await screen.findByRole('button', { name: 'Save changes' });
- },
+ play: dirtyQuickFiltersSettings,
+};
+
+/**
+ * The same panel with a banner above the shell. The banner takes 48px off the
+ * layout, so this is the case where the footer used to be pushed off screen:
+ * the panel is sized from the filters pane rather than the viewport, which
+ * keeps Save changes reachable.
+ */
+export const QuickFiltersSettingsWithBanner: Story = {
+ args: { banner: 'trial-expiry' },
+ play: dirtyQuickFiltersSettings,
};
/**
diff --git a/frontend/src/pages/MeterExplorer/stories/MeterExplorer.stories.tsx b/frontend/src/pages/MeterExplorer/stories/MeterExplorer.stories.tsx
index 9d97d51091..f26c1104a9 100644
--- a/frontend/src/pages/MeterExplorer/stories/MeterExplorer.stories.tsx
+++ b/frontend/src/pages/MeterExplorer/stories/MeterExplorer.stories.tsx
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
+import { expect, screen, userEvent, waitFor } from 'storybook/test';
import { storyMocks } from '@/storybook/controls/defineStoryMocks';
import type { PageStoryArgs } from '@/storybook/runtime/resolveStory';
@@ -18,6 +19,7 @@ const pageStory = storyMocks(meterMocks, { layout: 'app' });
*/
const meta = {
title: 'Pages/Metering/Cost Meter',
+ tags: ['play'],
component: MeterExplorerPage,
...pageStory,
parameters: { ...pageStory.parameters },
@@ -27,6 +29,38 @@ export default meta;
type Story = StoryObj<MeterArgs>;
+/** The page fetches before it renders its filters, which outlasts the 1s default. */
+const untilLoaded = { timeout: 15_000 };
+
+const openQuickFiltersSettings = async (): Promise<void> => {
+ // The settings control renders disabled while its permission check is in
+ // flight and is swapped for the enabled one once the check answers, so it is
+ // looked up again on every attempt; a click on the disabled one is dropped in
+ // silence.
+ const control = await waitFor(() => {
+ const settings = screen.getByTestId('settings-icon-container');
+
+ expect(settings).toBeEnabled();
+
+ return settings;
+ }, untilLoaded);
+
+ await userEvent.click(control);
+ await screen.findByText('Edit quick filters', undefined, untilLoaded);
+};
+
+const dirtyQuickFiltersSettings = async (): Promise<void> => {
+ await openQuickFiltersSettings();
+
+ // One Remove per added filter; the first row's is the one clicked.
+ const [removeFilter] = await screen.findAllByRole('button', {
+ name: 'Remove',
+ });
+
+ await userEvent.click(removeFilter);
+ await screen.findByRole('button', { name: 'Save changes' });
+};
+
/**
* The Meter tab over the last day: what the workspace ingested in total, then
* the hourly count and size of log records, of spans, and the metric datapoints
@@ -88,3 +122,26 @@ export const ExplorerWithoutQuickFilters: Story = {
export const ViewsEmpty: Story = {
args: { tab: 'views', savedViews: 0 },
};
+
+/** The editable quick-filter settings panel, which lives on the Explorer tab. */
+export const QuickFiltersSettings: Story = {
+ args: { tab: 'explorer' },
+ play: openQuickFiltersSettings,
+};
+
+/** Settings with an unsaved filter removal and the fixed action footer. */
+export const QuickFiltersSettingsDirty: Story = {
+ args: { tab: 'explorer' },
+ play: dirtyQuickFiltersSettings,
+};
+
+/**
+ * The same panel with a banner above the shell. The banner takes 48px off the
+ * layout, so this is the case where the footer used to be pushed off screen:
+ * the panel is sized from the filters pane rather than the viewport, which
+ * keeps Save changes reachable.
+ */
+export const QuickFiltersSettingsWithBanner: Story = {
+ args: { tab: 'explorer', banner: 'trial-expiry' },
+ play: dirtyQuickFiltersSettings,
+};
diff --git a/frontend/src/pages/TracesModulePage/stories/TracesModulePage.stories.tsx b/frontend/src/pages/TracesModulePage/stories/TracesModulePage.stories.tsx
index 8b991935a4..294e699c04 100644
--- a/frontend/src/pages/TracesModulePage/stories/TracesModulePage.stories.tsx
+++ b/frontend/src/pages/TracesModulePage/stories/TracesModulePage.stories.tsx
@@ -116,16 +116,29 @@ export const QuickFiltersSettings: Story = {
play: openQuickFiltersSettings,
};
+const dirtyQuickFiltersSettings = async (): Promise<void> => {
+ await openQuickFiltersSettings();
+ // One Remove per added filter; the first row's is the one clicked.
+ const [removeFilter] = await screen.findAllByRole('button', {
+ name: 'Remove',
+ });
+
+ await userEvent.click(removeFilter);
+ await screen.findByRole('button', { name: 'Save changes' });
+};
+
/** Settings with an unsaved filter removal and the fixed action footer. */
export const QuickFiltersSettingsDirty: Story = {
- play: async (): Promise<void> => {
- await openQuickFiltersSettings();
- // One Remove per added filter; the first row's is the one clicked.
- const [removeFilter] = await screen.findAllByRole('button', {
- name: 'Remove',
- });
-
- await userEvent.click(removeFilter);
- await screen.findByRole('button', { name: 'Save changes' });
- },
+ play: dirtyQuickFiltersSettings,
+};
+
+/**
+ * The same panel with a banner above the shell. The banner takes 48px off the
+ * layout, so this is the case where the footer used to be pushed off screen:
+ * the panel is sized from the filters pane rather than the viewport, which
+ * keeps Save changes reachable.
+ */
+export const QuickFiltersSettingsWithBanner: Story = {
+ args: { banner: 'trial-expiry' },
+ play: dirtyQuickFiltersSettings,
};