-
Notifications
You must be signed in to change notification settings - Fork 18k
fix(tests): resolve AlertReportModal checkmark test failures #34995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,6 @@ import { | |||||||||||||||||||||||||||||||
| userEvent, | ||||||||||||||||||||||||||||||||
| within, | ||||||||||||||||||||||||||||||||
| } from 'spec/helpers/testing-library'; | ||||||||||||||||||||||||||||||||
| import { VizType } from '@superset-ui/core'; | ||||||||||||||||||||||||||||||||
| import { buildErrorTooltipMessage } from './buildErrorTooltipMessage'; | ||||||||||||||||||||||||||||||||
| import AlertReportModal, { AlertReportModalProps } from './AlertReportModal'; | ||||||||||||||||||||||||||||||||
| import { AlertObject, NotificationMethodOption } from './types'; | ||||||||||||||||||||||||||||||||
|
|
@@ -49,6 +48,7 @@ const generateMockPayload = (dashboard = true) => { | |||||||||||||||||||||||||||||||
| database: { | ||||||||||||||||||||||||||||||||
| database_name: 'examples', | ||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||
| value: 1, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| description: 'Some description', | ||||||||||||||||||||||||||||||||
| extra: {}, | ||||||||||||||||||||||||||||||||
|
|
@@ -93,8 +93,9 @@ const generateMockPayload = (dashboard = true) => { | |||||||||||||||||||||||||||||||
| ...mockPayload, | ||||||||||||||||||||||||||||||||
| chart: { | ||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||
| slice_name: 'Test Chart', | ||||||||||||||||||||||||||||||||
| viz_type: VizType.Table, | ||||||||||||||||||||||||||||||||
| slice_name: 'test chart', | ||||||||||||||||||||||||||||||||
| viz_type: 'table', | ||||||||||||||||||||||||||||||||
| value: 1, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
|
Comment on lines
94
to
99
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing required label property in chart mock
The chart object mock is missing the required Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #c3ee1f Should Bito avoid suggestions like this for future reviews? (Manage Rules)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
|
|
@@ -134,7 +135,7 @@ const validAlert: AlertObject = { | |||||||||||||||||||||||||||||||
| creation_method: 'alerts_reports', | ||||||||||||||||||||||||||||||||
| crontab: '0 0 * * *', | ||||||||||||||||||||||||||||||||
| dashboard_id: 0, | ||||||||||||||||||||||||||||||||
| chart_id: 0, | ||||||||||||||||||||||||||||||||
| chart_id: 1, | ||||||||||||||||||||||||||||||||
| force_screenshot: false, | ||||||||||||||||||||||||||||||||
| last_state: 'Not triggered', | ||||||||||||||||||||||||||||||||
| name: 'Test Alert', | ||||||||||||||||||||||||||||||||
|
|
@@ -153,6 +154,24 @@ const validAlert: AlertObject = { | |||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||
| timezone: 'America/Rainy_River', | ||||||||||||||||||||||||||||||||
| type: 'Alert', | ||||||||||||||||||||||||||||||||
| database: { | ||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||
| value: 1, | ||||||||||||||||||||||||||||||||
| database_name: 'test_db', | ||||||||||||||||||||||||||||||||
| } as any, | ||||||||||||||||||||||||||||||||
| sql: 'SELECT COUNT(*) FROM test_table', | ||||||||||||||||||||||||||||||||
| validator_config_json: { | ||||||||||||||||||||||||||||||||
| op: '>', | ||||||||||||||||||||||||||||||||
| threshold: 10.0, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| working_timeout: 3600, | ||||||||||||||||||||||||||||||||
| chart: { | ||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||
| value: 1, | ||||||||||||||||||||||||||||||||
| label: 'Test Chart', | ||||||||||||||||||||||||||||||||
| slice_name: 'Test Chart', | ||||||||||||||||||||||||||||||||
| viz_type: 'table', | ||||||||||||||||||||||||||||||||
| } as any, | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jest.mock('./buildErrorTooltipMessage', () => ({ | ||||||||||||||||||||||||||||||||
|
|
@@ -258,6 +277,10 @@ test('renders 5 checkmarks for a valid alert', async () => { | |||||||||||||||||||||||||||||||
| render(<AlertReportModal {...generateMockedProps(false, true, false)} />, { | ||||||||||||||||||||||||||||||||
| useRedux: true, | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Wait for validation to complete by waiting for the modal to fully render | ||||||||||||||||||||||||||||||||
| await screen.findByText('Edit alert'); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const checkmarks = await screen.findAllByRole('img', { | ||||||||||||||||||||||||||||||||
| name: /check-circle/i, | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex change from
/(?=[A-Z])/.filter(word => word.length > 0)to/(?<=[a-z])(?=[A-Z])/fundamentally alters string splitting behavior and breaks aria-label generation for strings with consecutive uppercase letters like 'SLACK', 'XMLHttpRequest', 'HTMLElement'. This will cause incorrect accessibility labels in production. Please revert to the original regex pattern.Code suggestion
Code Review Run #c3ee1f
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both regexes produce identical results for icon names like "CheckCircleOutlined"