mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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',
|
url: '${HOST}/alerting/list',
|
||||||
wait: 500,
|
wait: 500,
|
||||||
rootElement: '.main-view',
|
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',
|
url: '${HOST}/datasources',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
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 userEvent from '@testing-library/user-event';
|
||||||
import { UnifiedAlertingPromotion, LOCAL_STORAGE_KEY } from './UnifiedAlertingPromotion';
|
import { UnifiedAlertingPromotion, LOCAL_STORAGE_KEY } from './UnifiedAlertingPromotion';
|
||||||
|
|
||||||
@ -10,8 +10,8 @@ describe('Unified Alerting promotion', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show by default', () => {
|
it('should show by default', () => {
|
||||||
const promotion = render(<UnifiedAlertingPromotion />);
|
render(<UnifiedAlertingPromotion />);
|
||||||
expect(promotion.queryByLabelText('Alert info')).toBeInTheDocument();
|
expect(screen.queryByText('Try out the Grafana 8 alerting!')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be hidden if dismissed', () => {
|
it('should be hidden if dismissed', () => {
|
||||||
@ -21,14 +21,14 @@ describe('Unified Alerting promotion', () => {
|
|||||||
const dismissButton = promotion.getByRole('button');
|
const dismissButton = promotion.getByRole('button');
|
||||||
userEvent.click(dismissButton);
|
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');
|
expect(window.localStorage.getItem(LOCAL_STORAGE_KEY)).toBe('false');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not render if previously dismissed', () => {
|
it('should not render if previously dismissed', () => {
|
||||||
window.localStorage.setItem(LOCAL_STORAGE_KEY, 'false');
|
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