You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jl...@apache.org on 2025/09/03 03:55:31 UTC

(superset) branch fix-checkmark-failures created (now eac36ec49e)

This is an automated email from the ASF dual-hosted git repository.

jli pushed a change to branch fix-checkmark-failures
in repository https://gitbox.apache.org/repos/asf/superset.git


      at eac36ec49e fix(tests): resolve AlertReportModal checkmark and chart visibility failures

This branch includes the following new commits:

     new eac36ec49e fix(tests): resolve AlertReportModal checkmark and chart visibility failures

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: fix(tests): resolve AlertReportModal checkmark and chart visibility failures

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jli pushed a commit to branch fix-checkmark-failures
in repository https://gitbox.apache.org/repos/asf/superset.git

commit eac36ec49ef256d1144d2897777e7224047677ae
Author: Joe Li <jo...@preset.io>
AuthorDate: Tue Sep 2 20:54:22 2025 -0700

    fix(tests): resolve AlertReportModal checkmark and chart visibility failures
    
    Fixes two failing AlertReportModal tests by addressing:
      - BaseIcon genAriaLabel function bug causing incorrect aria-labels
      - Incomplete validation test data missing required fields
      - Test mock data structure mismatch with AlertReportModal processing
    
     Tests now pass: 5 checkmarks display for valid alerts and chart names appear correctly in contents panel.
    
     🤖 Generated with [Claude Code](https://claude.ai/code)
    
      Co-Authored-By: Claude <no...@anthropic.com>
---
 .../components/Collapse/CollapseLabelInModal.tsx   | 10 ++-----
 .../src/components/Icons/BaseIcon.tsx              |  2 +-
 .../src/features/alerts/AlertReportModal.test.tsx  | 33 ++++++++++++++++++----
 3 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx b/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx
index 4aa18b5592..6d605a639b 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx
@@ -48,15 +48,9 @@ export const CollapseLabelInModal: React.FC<CollapseLabelInModalProps> = ({
         {title}{' '}
         {validateCheckStatus !== undefined &&
           (validateCheckStatus ? (
-            <Icons.CheckCircleOutlined
-              iconColor={theme.colorSuccess}
-              aria-label="check-circle"
-            />
+            <Icons.CheckCircleOutlined iconColor={theme.colorSuccess} />
           ) : (
-            <Icons.ExclamationCircleOutlined
-              iconColor={theme.colorError}
-              aria-label="error-circle"
-            />
+            <Icons.ExclamationCircleOutlined iconColor={theme.colorError} />
           ))}
       </Typography.Title>
       <Typography.Paragraph
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Icons/BaseIcon.tsx b/superset-frontend/packages/superset-ui-core/src/components/Icons/BaseIcon.tsx
index 98f795d8a6..5f0728e6de 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Icons/BaseIcon.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Icons/BaseIcon.tsx
@@ -22,7 +22,7 @@ import { AntdIconType, BaseIconProps, CustomIconType, IconType } from './types';
 
 const genAriaLabel = (fileName: string) => {
   const name = fileName.replace(/_/g, '-'); // Replace underscores with dashes
-  const words = name.split(/(?=[A-Z])/); // Split at uppercase letters
+  const words = name.split(/(?=[A-Z])/).filter(word => word.length > 0); // Split at uppercase letters and filter out empty strings
 
   if (words.length === 2) {
     return words[0].toLowerCase();
diff --git a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
index deb8e1b6fe..e6ea6290c4 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
@@ -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';
@@ -47,8 +46,9 @@ const generateMockPayload = (dashboard = true) => {
     crontab: '0 0 * * *',
     custom_width: null,
     database: {
-      database_name: 'examples',
+      label: 'examples',
       id: 1,
+      value: 1,
     },
     description: 'Some description',
     extra: {},
@@ -93,8 +93,8 @@ const generateMockPayload = (dashboard = true) => {
     ...mockPayload,
     chart: {
       id: 1,
-      slice_name: 'Test Chart',
-      viz_type: VizType.Table,
+      label: 'Test Chart',
+      value: 1,
     },
   };
 };
@@ -134,7 +134,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 +153,25 @@ const validAlert: AlertObject = {
   ],
   timezone: 'America/Rainy_River',
   type: 'Alert',
+  database: {
+    id: 1,
+    value: 1,
+    label: 'test_db',
+    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,
   });