From de7a9209677a63a4e108a100b918b295ddd7ce46 Mon Sep 17 00:00:00 2001 From: Josh Hunt Date: Fri, 4 Feb 2022 12:36:44 +1100 Subject: [PATCH] Chore: Suppress messages and logs from tests (#44629) * Suppress "not wrapped in act()" warning in UserPicker test * Add menuShouldPortal to AmRoutesExpandedForm to suppress deprecation warning * use forwardRef in alerting ActionIcon to suppress ref warning * Add menuShouldPortal to alerting GroupBy to suppress deprecation warning --- public/app/core/components/Select/UserPicker.test.tsx | 5 +++-- .../unified/components/alert-groups/GroupBy.tsx | 1 + .../components/amroutes/AmRoutesExpandedForm.tsx | 1 + .../alerting/unified/components/rules/ActionIcon.tsx | 11 +++++++---- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public/app/core/components/Select/UserPicker.test.tsx b/public/app/core/components/Select/UserPicker.test.tsx index cbc1ea6236a..d63fbda5868 100644 --- a/public/app/core/components/Select/UserPicker.test.tsx +++ b/public/app/core/components/Select/UserPicker.test.tsx @@ -7,8 +7,9 @@ jest.mock('@grafana/runtime', () => ({ })); describe('UserPicker', () => { - it('renders correctly', () => { + it('renders correctly', async () => { render( {}} />); - expect(screen.getByTestId('userPicker')).toBeInTheDocument(); + + expect(await screen.findByTestId('userPicker')).toBeInTheDocument(); }); }); diff --git a/public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx b/public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx index ae595e84372..b43b69847f3 100644 --- a/public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx +++ b/public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx @@ -31,6 +31,7 @@ export const GroupBy = ({ className, groups, groupBy, onGroupingChange }: Props) onGroupingChange(items.map(({ value }) => value as string)); }} options={labelKeyOptions} + menuShouldPortal /> ); diff --git a/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx b/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx index 567a9488759..76ec7d4a250 100644 --- a/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx +++ b/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx @@ -82,6 +82,7 @@ export const AmRoutesExpandedForm: FC = ({ onCancel, onChange={(value) => onChange(value?.value)} options={matcherFieldOptions} aria-label="Operator" + menuShouldPortal /> )} defaultValue={field.operator} diff --git a/public/app/features/alerting/unified/components/rules/ActionIcon.tsx b/public/app/features/alerting/unified/components/rules/ActionIcon.tsx index 0de605ff02b..90c066b3259 100644 --- a/public/app/features/alerting/unified/components/rules/ActionIcon.tsx +++ b/public/app/features/alerting/unified/components/rules/ActionIcon.tsx @@ -56,21 +56,24 @@ interface GoToProps { url: string; label?: string; target?: string; + children?: React.ReactNode; } -const GoTo: FC = ({ url, label, target, children }) => { +const GoTo = React.forwardRef(({ url, label, target, children }, ref) => { const absoluteUrl = url?.startsWith('http'); return absoluteUrl ? ( - + {children} ) : ( - + {children} ); -}; +}); + +GoTo.displayName = 'GoTo'; export const getStyle = () => css` cursor: pointer;