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
feat: add unit test
amlannandyb499b103337d
diff --git a/frontend/src/container/ListOfDashboard/DashboardsList.tsx b/frontend/src/container/ListOfDashboard/DashboardsList.tsxindex 14718a562b..254a12b195 100644--- a/frontend/src/container/ListOfDashboard/DashboardsList.tsx+++ b/frontend/src/container/ListOfDashboard/DashboardsList.tsx@@ -521,63 +521,65 @@ function DashboardsList(): JSX.Element {</div>{action && (- <Popover- trigger="click"- content={- <div className="dashboard-action-content">- <section className="section-1">- <Button- type="text"- className="action-btn"- icon={<Expand size={12} />}- onClick={onClickHandler}- >- View- </Button>- <Button- type="text"- className="action-btn"- icon={<Link2 size={12} />}- onClick={(e): void => {- e.stopPropagation();- e.preventDefault();- setCopy(`${window.location.origin}${getLink()}`);- }}- >- Copy Link- </Button>- <Button- type="text"- className="action-btn"- icon={<FileJson size={12} />}- onClick={handleJsonExport}- >- Export JSON- </Button>- </section>- <section className="section-2">- <DeleteButton- name={dashboard.name}- id={dashboard.id}- isLocked={dashboard.isLocked}- createdBy={dashboard.createdBy}- />- </section>- </div>- }- placement="bottomRight"- arrow={false}- rootClassName="dashboard-actions"- >- <EllipsisVertical- className="dashboard-action-icon"- size={14}- onClick={(e): void => {- e.stopPropagation();- e.preventDefault();- }}- />- </Popover>+ <div data-testid="dashboard-action-popover">+ <Popover+ trigger="click"+ content={+ <div className="dashboard-action-content">+ <section className="section-1">+ <Button+ type="text"+ className="action-btn"+ icon={<Expand size={12} />}+ onClick={onClickHandler}+ >+ View+ </Button>+ <Button+ type="text"+ className="action-btn"+ icon={<Link2 size={12} />}+ onClick={(e): void => {+ e.stopPropagation();+ e.preventDefault();+ setCopy(`${window.location.origin}${getLink()}`);+ }}+ >+ Copy Link+ </Button>+ <Button+ type="text"+ className="action-btn"+ icon={<FileJson size={12} />}+ onClick={handleJsonExport}+ >+ Export JSON+ </Button>+ </section>+ <section className="section-2">+ <DeleteButton+ name={dashboard.name}+ id={dashboard.id}+ isLocked={dashboard.isLocked}+ createdBy={dashboard.createdBy}+ />+ </section>+ </div>+ }+ placement="bottomRight"+ arrow={false}+ rootClassName="dashboard-actions"+ >+ <EllipsisVertical+ className="dashboard-action-icon"+ size={14}+ onClick={(e): void => {+ e.stopPropagation();+ e.preventDefault();+ }}+ />+ </Popover>+ </div>)}</div><div className="dashboard-details">diff --git a/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsx b/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsxindex 98bd40ef62..bcb166eeb0 100644--- a/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsx+++ b/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsx@@ -1,7 +1,10 @@/* eslint-disable sonarjs/no-duplicate-string */import ROUTES from 'constants/routes';import DashboardsList from 'container/ListOfDashboard';-import { dashboardEmptyState } from 'mocks-server/__mockdata__/dashboards';+import {+ dashboardEmptyState,+ dashboardSuccessResponse,+} from 'mocks-server/__mockdata__/dashboards';import { server } from 'mocks-server/server';import { rest } from 'msw';import { DashboardProvider } from 'providers/Dashboard/Dashboard';@@ -204,4 +207,24 @@ describe('dashboard list page', () => {),);});++ it('ensure that the popover actions on each list item renders list of options', async () => {+ const { getByText, getAllByTestId } = render(+ <MemoryRouter initialEntries={['/dashbords']}>+ <DashboardProvider>+ <DashboardsList />+ </DashboardProvider>+ </MemoryRouter>,+ );++ await waitFor(() => {+ const popovers = getAllByTestId('dashboard-action-popover');+ expect(popovers).toHaveLength(dashboardSuccessResponse.data.length);+ fireEvent.click([...popovers[0].children][0]);+ });++ expect(getByText('View')).toBeInTheDocument();+ expect(getByText('Copy Link')).toBeInTheDocument();+ expect(getByText('Export JSON')).toBeInTheDocument();+ });});