The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/alerting/unified/components/AlertLabels.test.tsx

24 lines
852 B

import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { AlertLabels } from './AlertLabels';
describe('AlertLabels', () => {
it('should toggle show / hide common labels', async () => {
const labels = { foo: 'bar', bar: 'baz', baz: 'qux' };
const commonLabels = { foo: 'bar', baz: 'qux' };
render(<AlertLabels labels={labels} commonLabels={commonLabels} />);
expect(screen.getByText('+2 common labels')).toBeInTheDocument();
await userEvent.click(screen.getByRole('button'));
await waitFor(() => {
expect(screen.getByText('Hide common labels')).toBeInTheDocument();
});
await userEvent.click(screen.getByRole('button'));
await waitFor(() => {
expect(screen.getByText('+2 common labels')).toBeInTheDocument();
});
});
});