diff --git a/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.test.tsx b/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.test.tsx index 8e48305c0a9..b013f2d413c 100644 --- a/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.test.tsx +++ b/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.test.tsx @@ -106,10 +106,10 @@ describe('VizTooltipFooter', () => { ); - const onForButton = screen.getByRole('button', { name: /Apply as filter/i }); + const onForButton = screen.getByTestId(selectors.components.VizTooltipFooter.buttons.apply); expect(onForButton).toBeInTheDocument(); - const onOutButton = screen.getByRole('button', { name: /Apply as inverse filter/i }); + const onOutButton = screen.getByTestId(selectors.components.VizTooltipFooter.buttons.applyInverse); expect(onOutButton).toBeInTheDocument(); await userEvent.click(onForButton); diff --git a/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.tsx b/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.tsx index 4bb0aeff326..caef776abd3 100644 --- a/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.tsx +++ b/packages/grafana-ui/src/components/VizTooltip/VizTooltipFooter.tsx @@ -127,24 +127,18 @@ export const VizTooltipFooter = ({ variant="secondary" size="sm" onClick={filterByGroupedLabels.onFilterForGroupedLabels} + data-testid={selectors.components.VizTooltipFooter.buttons.apply} > - - Filter on this value - + Filter on this value