diff --git a/ui/cypress/e2e/collectors.test.ts b/ui/cypress/e2e/collectors.test.ts index 5809f2fc12..8a9ebb18de 100644 --- a/ui/cypress/e2e/collectors.test.ts +++ b/ui/cypress/e2e/collectors.test.ts @@ -394,7 +394,7 @@ describe('Collectors', () => { cy.reload() }) it('Can add label', () => { - cy.getByTestID('inline-labels--add').trigger('mouseover') + cy.getByTestID('inline-labels--add').click() cy.getByTestID('inline-labels--popover-field').type('zoe') cy.getByTestID('inline-labels--create-new').click() cy.getByTestID('overlay--container').should('exist') diff --git a/ui/cypress/e2e/dashboardsIndex.test.ts b/ui/cypress/e2e/dashboardsIndex.test.ts index d88f52b3a6..b80afb5fff 100644 --- a/ui/cypress/e2e/dashboardsIndex.test.ts +++ b/ui/cypress/e2e/dashboardsIndex.test.ts @@ -197,7 +197,7 @@ describe('Dashboards', () => { cy.createLabel(labelName, id).then(() => { cy.getByTestID(`inline-labels--add`) .first() - .trigger('mouseover') + .click() cy.getByTestID(`label--pill ${labelName}`).click() @@ -213,7 +213,7 @@ describe('Dashboards', () => { cy.createLabel(labelName, id).then(() => { cy.getByTestID(`inline-labels--add`) .first() - .trigger('mouseover') + .click() cy.getByTestID(`label--pill ${labelName}`).click() @@ -233,7 +233,7 @@ describe('Dashboards', () => { cy.createLabel(labelName, id).then(() => { cy.getByTestID(`inline-labels--add`) .first() - .trigger('mouseover') + .click() cy.getByTestID(`inline-labels--popover-field`).type(labelName) @@ -249,7 +249,7 @@ describe('Dashboards', () => { cy.get('@org').then(() => { cy.getByTestID(`inline-labels--add`) .first() - .trigger('mouseover') + .click() cy.getByTestID(`inline-labels--popover-field`) .type(labelName) @@ -262,7 +262,7 @@ describe('Dashboards', () => { const label = 'plerps' cy.getByTestID(`inline-labels--add`) .first() - .trigger('mouseover') + .click() cy.getByTestID('inline-labels--popover-field').type(label) cy.getByTestID('inline-labels--create-new').click() diff --git a/ui/cypress/e2e/dashboardsView.test.ts b/ui/cypress/e2e/dashboardsView.test.ts index 01cc665fef..536899aa98 100644 --- a/ui/cypress/e2e/dashboardsView.test.ts +++ b/ui/cypress/e2e/dashboardsView.test.ts @@ -162,7 +162,7 @@ describe('Dashboard', () => { .should('equal', secondKey) // graph tips responds to mouse over - cy.getByTestID('graphtips-question-mark').trigger('mouseover') + cy.getByTestID('graphtips-question-mark').click() }) }) }) diff --git a/ui/jestSetup.ts b/ui/jestSetup.ts index 9eefddd810..9c90b14f02 100644 --- a/ui/jestSetup.ts +++ b/ui/jestSetup.ts @@ -1,5 +1,4 @@ import {cleanup} from 'react-testing-library' -import 'intersection-observer' jest.mock('honeybadger-js', () => () => null) diff --git a/ui/src/shared/components/inlineLabels/InlineLabelPopover.tsx b/ui/src/shared/components/inlineLabels/InlineLabelPopover.tsx index 74070dbba6..ca5feebaad 100644 --- a/ui/src/shared/components/inlineLabels/InlineLabelPopover.tsx +++ b/ui/src/shared/components/inlineLabels/InlineLabelPopover.tsx @@ -65,8 +65,8 @@ export default class InlineLabelPopover extends PureComponent { position={PopoverPosition.Below} triggerRef={triggerRef} distanceFromTrigger={8} - showEvent={PopoverInteraction.Hover} - hideEvent={PopoverInteraction.Hover} + showEvent={PopoverInteraction.Click} + hideEvent={PopoverInteraction.Click} testID="inline-labels--popover" contents={() => ( diff --git a/ui/src/shared/components/inlineLabels/InlineLabelsEditor.test.tsx b/ui/src/shared/components/inlineLabels/InlineLabelsEditor.test.tsx index 4c00008d53..0c83a886c9 100644 --- a/ui/src/shared/components/inlineLabels/InlineLabelsEditor.test.tsx +++ b/ui/src/shared/components/inlineLabels/InlineLabelsEditor.test.tsx @@ -2,7 +2,6 @@ import React from 'react' import {act} from 'react-dom/test-utils' import {fireEvent} from 'react-testing-library' -import 'intersection-observer' // Components import InlineLabelsEditor from 'src/shared/components/inlineLabels/InlineLabelsEditor' @@ -65,14 +64,11 @@ describe('Shared.Components.InlineLabelsEditor', () => { }) describe('mouse interactions', () => { - it('hovering the plus button opens the popover', () => { + it('Clicking the plus button opens the popover', () => { const {getByTestId, getAllByTestId} = setup() const plusButton = getByTestId('inline-labels--add') - - act(() => { - fireEvent.mouseOver(plusButton) - }) + plusButton.click() const popover = getAllByTestId('inline-labels--popover-field') @@ -83,9 +79,8 @@ describe('Shared.Components.InlineLabelsEditor', () => { const {getByTestId, getAllByTestId} = setup() const plusButton = getByTestId('inline-labels--add') - act(() => { - fireEvent.mouseOver(plusButton) - }) + plusButton.click() + const inputValue = 'yodelling is rad' const input = getByTestId('inline-labels--popover-field') @@ -108,9 +103,8 @@ describe('Shared.Components.InlineLabelsEditor', () => { const onAddLabel = jest.fn() const {getByTestId} = setup({onAddLabel}) const button = getByTestId('inline-labels--add') - act(() => { - fireEvent.mouseOver(button) - }) + button.click() + const secondListItem = getByTestId(`label-list--item ${secondLabel.name}`) fireEvent.click(secondListItem)