mirror of
https://github.com/grafana/grafana.git
synced 2024-12-25 08:21:46 -06:00
Alerting: fix e2e testing selectors (#41829)
This commit is contained in:
parent
b611d54349
commit
1bd43bae2d
@ -55,7 +55,9 @@ var config = {
|
||||
url: '${HOST}/alerting/list',
|
||||
wait: 500,
|
||||
rootElement: '.main-view',
|
||||
threshold: 0,
|
||||
// the unified alerting promotion alert's content contrast is too low
|
||||
// see https://github.com/grafana/grafana/pull/41829
|
||||
threshold: 5,
|
||||
},
|
||||
{
|
||||
url: '${HOST}/datasources',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { UnifiedAlertingPromotion, LOCAL_STORAGE_KEY } from './UnifiedAlertingPromotion';
|
||||
|
||||
@ -10,8 +10,8 @@ describe('Unified Alerting promotion', () => {
|
||||
});
|
||||
|
||||
it('should show by default', () => {
|
||||
const promotion = render(<UnifiedAlertingPromotion />);
|
||||
expect(promotion.queryByLabelText('Alert info')).toBeInTheDocument();
|
||||
render(<UnifiedAlertingPromotion />);
|
||||
expect(screen.queryByText('Try out the Grafana 8 alerting!')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should be hidden if dismissed', () => {
|
||||
@ -21,14 +21,14 @@ describe('Unified Alerting promotion', () => {
|
||||
const dismissButton = promotion.getByRole('button');
|
||||
userEvent.click(dismissButton);
|
||||
|
||||
expect(promotion.queryByLabelText('Alert info')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('Try out the Grafana 8 alerting!')).not.toBeInTheDocument();
|
||||
expect(window.localStorage.getItem(LOCAL_STORAGE_KEY)).toBe('false');
|
||||
});
|
||||
|
||||
it('should not render if previously dismissed', () => {
|
||||
window.localStorage.setItem(LOCAL_STORAGE_KEY, 'false');
|
||||
const promotion = render(<UnifiedAlertingPromotion />);
|
||||
render(<UnifiedAlertingPromotion />);
|
||||
|
||||
expect(promotion.queryByLabelText('Alert info')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('Try out the Grafana 8 alerting!')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user