mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
chore: fix the failing tests in CI
This commit is contained in:
parent
9c67d36e57
commit
6fe5178dad
@ -5,6 +5,7 @@ import {
|
|||||||
import { rest } from 'msw';
|
import { rest } from 'msw';
|
||||||
import {
|
import {
|
||||||
mockErrorTracesData,
|
mockErrorTracesData,
|
||||||
|
mockFunnelsListData,
|
||||||
mockOverviewData,
|
mockOverviewData,
|
||||||
mockSlowTracesData,
|
mockSlowTracesData,
|
||||||
mockStepsData,
|
mockStepsData,
|
||||||
@ -292,6 +293,12 @@ export const handlers = [
|
|||||||
rest.get('http://localhost/locales/en-US/common.json', (_, res, ctx) =>
|
rest.get('http://localhost/locales/en-US/common.json', (_, res, ctx) =>
|
||||||
res(ctx.status(200), ctx.json(commonEnTranslation)),
|
res(ctx.status(200), ctx.json(commonEnTranslation)),
|
||||||
),
|
),
|
||||||
|
rest.get('http://localhost/api/v1/trace-funnels/list', (_, res, ctx) =>
|
||||||
|
res(
|
||||||
|
ctx.status(200),
|
||||||
|
ctx.json({ status: 'success', payload: mockFunnelsListData }),
|
||||||
|
),
|
||||||
|
),
|
||||||
rest.get(
|
rest.get(
|
||||||
'http://localhost/api/v1/trace-funnels/get/:funnelId',
|
'http://localhost/api/v1/trace-funnels/get/:funnelId',
|
||||||
(req, res, ctx) => {
|
(req, res, ctx) => {
|
||||||
|
|||||||
@ -209,13 +209,17 @@ describe('Add span to funnel from trace details page', () => {
|
|||||||
fireEvent.click(addFunnelButton);
|
fireEvent.click(addFunnelButton);
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
// Wait for modal to appear and content to load
|
||||||
expect(await screen.findByText(firstFunnel.funnel_name)).toBeInTheDocument();
|
|
||||||
|
// Wait for funnel list content to appear in modal
|
||||||
|
await waitFor(async () => {
|
||||||
|
expect(
|
||||||
|
await screen.findByText(firstFunnel.funnel_name),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display the add to funnel modal when the add to funnel icon is clicked', async () => {
|
it('should display the add to funnel modal when the add to funnel icon is clicked', async () => {
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
||||||
|
|
||||||
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
@ -269,23 +273,30 @@ describe('Add span to funnel from trace details page', () => {
|
|||||||
});
|
});
|
||||||
describe('funnel details view tests', () => {
|
describe('funnel details view tests', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
await waitFor(() => {
|
||||||
|
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
||||||
|
|
||||||
const firstFunnelButton = await within(addSpanToFunnelModal).findByText(
|
const firstFunnelButton = await within(addSpanToFunnelModal).findByText(
|
||||||
firstFunnel.funnel_name,
|
firstFunnel.funnel_name,
|
||||||
);
|
);
|
||||||
await act(() => {
|
|
||||||
|
act(() => {
|
||||||
fireEvent.click(firstFunnelButton);
|
fireEvent.click(firstFunnelButton);
|
||||||
});
|
});
|
||||||
|
|
||||||
await within(addSpanToFunnelModal).findByRole('button', {
|
// Wait for the modal to transition to details view
|
||||||
name: 'All funnels',
|
await waitFor(async () => {
|
||||||
|
expect(
|
||||||
|
await within(addSpanToFunnelModal).findByRole('button', {
|
||||||
|
name: 'All funnels',
|
||||||
|
}),
|
||||||
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should go to funnels details view of modal when a funnel is clicked, and go back to list view on clicking all funnels button', async () => {
|
it('should go to funnels details view of modal when a funnel is clicked, and go back to list view on clicking all funnels button', async () => {
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
||||||
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
@ -323,7 +334,6 @@ describe('Add span to funnel from trace details page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should render the funnel preview card correctly', async () => {
|
it('should render the funnel preview card correctly', async () => {
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
||||||
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
@ -334,7 +344,6 @@ describe('Add span to funnel from trace details page', () => {
|
|||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
it('should render the funnel steps correctly', async () => {
|
it('should render the funnel steps correctly', async () => {
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
||||||
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
||||||
|
|
||||||
const expectTextWithCount = async (
|
const expectTextWithCount = async (
|
||||||
@ -361,7 +370,6 @@ describe('Add span to funnel from trace details page', () => {
|
|||||||
await expectTextWithCount('Replace', 2);
|
await expectTextWithCount('Replace', 2);
|
||||||
});
|
});
|
||||||
it('should replace the selected span and service names on clicking the replace button', async () => {
|
it('should replace the selected span and service names on clicking the replace button', async () => {
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
||||||
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
||||||
|
|
||||||
expect(within(addSpanToFunnelModal).getByText('SpanA')).toBeInTheDocument();
|
expect(within(addSpanToFunnelModal).getByText('SpanA')).toBeInTheDocument();
|
||||||
@ -386,7 +394,6 @@ describe('Add span to funnel from trace details page', () => {
|
|||||||
expect(replaceButtons[0]).toBeDisabled();
|
expect(replaceButtons[0]).toBeDisabled();
|
||||||
});
|
});
|
||||||
it('should add the span as a new step on clicking the add for a new step button', async () => {
|
it('should add the span as a new step on clicking the add for a new step button', async () => {
|
||||||
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
||||||
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
const addSpanToFunnelModal = await screen.findByRole('dialog');
|
||||||
|
|
||||||
const addNewStepButton = await within(
|
const addNewStepButton = await within(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user