* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import '@testing-library/jest-dom';
-import { configure, fireEvent, screen } from '@testing-library/react';
+import { configure, fireEvent, screen, waitFor } from '@testing-library/react';
configure({
asyncUtilTimeout: 3000,
fireEvent.pointerLeave(received);
+ await waitFor(() => {
+ expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
+ });
+
return result;
},
});
import { Dict } from '../../../types/types';
import IssueHeader from '../components/IssueHeader';
-jest.useFakeTimers();
-
it('renders correctly', async () => {
const issue = mockIssue();
renderIssueHeader(
await expect(cctBadge).toHaveATooltipWithContent(
`issue.clean_code_attribute.${issue.cleanCodeAttribute}`,
);
- jest.runOnlyPendingTimers();
// Software Qualities
const qualityBadge = byText(`software_quality.${issue.impacts[0].softwareQuality}`).get();
expect(qualityBadge).toBeInTheDocument();
await expect(qualityBadge).toHaveATooltipWithContent('software_quality');
- jest.runOnlyPendingTimers();
// Deprecated type
const type = byText(`issue.type.${issue.type}`).get();
expect(type).toBeInTheDocument();
await expect(type).toHaveATooltipWithContent('issue.clean_code_attribute');
- jest.runOnlyPendingTimers();
// Deprecated severity
const severity = byText(`severity.${issue.severity}`).get();
expect(ui.templateLink('Permission Template 2').get()).toBeInTheDocument();
// Shows warning for browse and code viewer permissions.
- await expect(ui.getHeaderTooltipIconByIndex(1)).toHaveATooltipWithContent(
+ await expect(ui.getHeaderTooltipIconByIndex(0)).toHaveATooltipWithContent(
'projects_role.public_projects_warning',
);
- await expect(ui.getHeaderTooltipIconByIndex(2)).toHaveATooltipWithContent(
+ await expect(ui.getHeaderTooltipIconByIndex(1)).toHaveATooltipWithContent(
'projects_role.public_projects_warning',
);