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(organization-traces): try unflaky both tests (#11046)

Vinicius Lourençob0e9fbe24f25
diff --git a/frontend/src/container/OnboardingQuestionaire/InviteTeamMembers/__tests__/InviteTeamMembers.test.tsx b/frontend/src/container/OnboardingQuestionaire/InviteTeamMembers/__tests__/InviteTeamMembers.test.tsx
index 9c5ae5f30e..eeb8fb238c 100644
--- a/frontend/src/container/OnboardingQuestionaire/InviteTeamMembers/__tests__/InviteTeamMembers.test.tsx
+++ b/frontend/src/container/OnboardingQuestionaire/InviteTeamMembers/__tests__/InviteTeamMembers.test.tsx
@@ -240,7 +240,7 @@ describe('InviteTeamMembers', () => {
describe('Validation callout on Complete', () => {
it('shows the correct callout message for each combination of email/role validity', async () => {
- const user = userEvent.setup({ pointerEventsCheck: 0 });
+ const user = userEvent.setup({ pointerEventsCheck: 0, delay: null });
renderComponent();
const removeButtons = screen.getAllByRole('button', {
@@ -302,10 +302,10 @@ describe('InviteTeamMembers', () => {
screen.queryByText(/please enter valid emails and select roles/i),
).not.toBeInTheDocument();
});
- });
+ }, 15000);
it('treats whitespace as untouched, clears the callout on fix-and-resubmit, and clears role error on role select', async () => {
- const user = userEvent.setup({ pointerEventsCheck: 0 });
+ const user = userEvent.setup({ pointerEventsCheck: 0, delay: null });
renderComponent();
const removeButtons = screen.getAllByRole('button', {
@@ -365,7 +365,7 @@ describe('InviteTeamMembers', () => {
await waitFor(() => expect(mockOnNext).toHaveBeenCalledTimes(1), {
timeout: 1200,
});
- });
+ }, 15000);
it('disables the Send Invites button when all rows are untouched (empty)', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/CreateEdit.test.tsx b/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/CreateEdit.test.tsx
index f63fb60e1f..5d259515fc 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/CreateEdit.test.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/CreateEdit.test.tsx
@@ -46,18 +46,16 @@ describe('CreateEdit Modal', () => {
// Tooltip mouseEnterDelay timers it triggers on the Configure button.
fireEvent.click(configureButtons[0]);
- await waitFor(() => {
- expect(screen.getByText(/edit google authentication/i)).toBeInTheDocument();
- });
+ expect(
+ await screen.findByText(/edit google authentication/i),
+ ).toBeInTheDocument();
const backButton = screen.getByRole('button', { name: /back/i });
fireEvent.click(backButton);
- await waitFor(() => {
- expect(
- screen.getByText(/configure authentication method/i),
- ).toBeInTheDocument();
- });
+ expect(
+ await screen.findByText(/configure authentication method/i),
+ ).toBeInTheDocument();
});
});
diff --git a/frontend/src/pages/TracesExplorer/__test__/TracesExplorer.test.tsx b/frontend/src/pages/TracesExplorer/__test__/TracesExplorer.test.tsx
index c65f986a2f..74418e02a7 100644
--- a/frontend/src/pages/TracesExplorer/__test__/TracesExplorer.test.tsx
+++ b/frontend/src/pages/TracesExplorer/__test__/TracesExplorer.test.tsx
@@ -699,17 +699,17 @@ describe('TracesExplorer - ', () => {
});
it('select a view options - assert and save this view', async () => {
- jest.useFakeTimers();
-
const { container } = renderWithTracesExplorerRouter(<TracesExplorer />, [
'/traces-explorer/?panelType=list&selectedExplorerView=list',
]);
- const viewSearchInput = container.querySelector(
- '.view-options .ant-select-selection-search-input',
- ) as HTMLElement;
-
- expect(viewSearchInput).toBeInTheDocument();
+ const viewSearchInput = await waitFor(() => {
+ const el = container.querySelector(
+ '.view-options .ant-select-selection-search-input',
+ ) as HTMLElement;
+ expect(el).toBeInTheDocument();
+ return el;
+ });
fireEvent.mouseDown(viewSearchInput);
@@ -718,17 +718,18 @@ describe('TracesExplorer - ', () => {
).toBeInTheDocument();
// save this view
- fireEvent.click(screen.getByText('Save this view'));
+ fireEvent.click(await screen.findByText('Save this view'));
const saveViewModalInput = await screen.findByPlaceholderText(
'e.g. External http method view',
);
expect(saveViewModalInput).toBeInTheDocument();
- const saveViewModal = document.querySelector(
- '.ant-modal-content',
- ) as HTMLElement;
- expect(saveViewModal).toBeInTheDocument();
+ const saveViewModal = await waitFor(() => {
+ const el = document.querySelector('.ant-modal-content') as HTMLElement;
+ expect(el).toBeInTheDocument();
+ return el;
+ });
await act(async () =>
fireEvent.change(saveViewModalInput, { target: { value: 'test view' } }),
@@ -739,18 +740,19 @@ describe('TracesExplorer - ', () => {
fireEvent.click(within(saveViewModal).getByTestId('save-view-btn'));
});
- expect(successNotification).toHaveBeenCalledWith({
- message: 'View Saved Successfully',
+ await waitFor(() => {
+ expect(successNotification).toHaveBeenCalledWith({
+ message: 'View Saved Successfully',
+ });
});
- });
+ }, 15000);
it('create a dashboard btn assert', async () => {
- const { getByText } = renderWithTracesExplorerRouter(<TracesExplorer />, [
+ renderWithTracesExplorerRouter(<TracesExplorer />, [
'/traces-explorer/?panelType=list&selectedExplorerView=list',
]);
- await screen.findByText(FILTER_SERVICE_NAME);
- const createDashboardBtn = getByText('Add to Dashboard');
+ const createDashboardBtn = await screen.findByText('Add to Dashboard');
expect(createDashboardBtn).toBeInTheDocument();
fireEvent.click(createDashboardBtn);
@@ -771,12 +773,11 @@ describe('TracesExplorer - ', () => {
});
it('create an alert btn assert', async () => {
- const { getByText } = renderWithTracesExplorerRouter(<TracesExplorer />, [
+ renderWithTracesExplorerRouter(<TracesExplorer />, [
'/traces-explorer/?panelType=list&selectedExplorerView=list',
]);
- await screen.findByText(FILTER_SERVICE_NAME);
- const createAlertBtn = getByText('Create an Alert');
+ const createAlertBtn = await screen.findByText('Create an Alert');
expect(createAlertBtn).toBeInTheDocument();
fireEvent.click(createAlertBtn);