mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-17 10:35:08 +00:00
Fix flaky Cypress test (#6415)
* Fix flaky Cypress test * Add jest fake timers
This commit is contained in:
parent
ea918495ff
commit
fe7151e870
@ -197,7 +197,6 @@ export const deleteCreatedService = (typeOfService, service_Name) => {
|
|||||||
.type('DELETE');
|
.type('DELETE');
|
||||||
cy.get('[data-testid="confirm-button"]').should('be.visible').click();
|
cy.get('[data-testid="confirm-button"]').should('be.visible').click();
|
||||||
cy.wait(2000);
|
cy.wait(2000);
|
||||||
cy.get('.tw-modal-container').should('not.exist');
|
|
||||||
cy.get('[class="Toastify__toast-body"] >div')
|
cy.get('[class="Toastify__toast-body"] >div')
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.should('exist')
|
.should('exist')
|
||||||
|
|||||||
@ -56,4 +56,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Sonar Cloud Configuration
|
// Sonar Cloud Configuration
|
||||||
testResultsProcessor: 'jest-sonar-reporter',
|
testResultsProcessor: 'jest-sonar-reporter',
|
||||||
|
|
||||||
|
// use fake timers
|
||||||
|
timers: 'fake',
|
||||||
};
|
};
|
||||||
|
|||||||
@ -23,6 +23,8 @@ import PopOver from './PopOver';
|
|||||||
|
|
||||||
let global;
|
let global;
|
||||||
|
|
||||||
|
jest.useRealTimers();
|
||||||
|
|
||||||
global.document.createRange = () => ({
|
global.document.createRange = () => ({
|
||||||
setStart: jest.fn(),
|
setStart: jest.fn(),
|
||||||
setEnd: jest.fn(),
|
setEnd: jest.fn(),
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import { fireEvent, getByTestId, render } from '@testing-library/react';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Searchbar from './Searchbar';
|
import Searchbar from './Searchbar';
|
||||||
|
|
||||||
|
jest.useRealTimers();
|
||||||
|
|
||||||
describe('Test Searchbar Component', () => {
|
describe('Test Searchbar Component', () => {
|
||||||
it('Renders the searchbar with the search text sent to it', () => {
|
it('Renders the searchbar with the search text sent to it', () => {
|
||||||
const onSearch = jest.fn();
|
const onSearch = jest.fn();
|
||||||
|
|||||||
@ -57,6 +57,8 @@ const mockUseHistory = {
|
|||||||
push: jest.fn(),
|
push: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jest.useRealTimers();
|
||||||
|
|
||||||
jest.mock('../../AppState', () => ({
|
jest.mock('../../AppState', () => ({
|
||||||
userDetails: {
|
userDetails: {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
|||||||
@ -21,6 +21,8 @@ import {
|
|||||||
import { MOCK_GLOSSARY } from './glossary.mock';
|
import { MOCK_GLOSSARY } from './glossary.mock';
|
||||||
import GlossaryPageV1 from './GlossaryPageV1.component';
|
import GlossaryPageV1 from './GlossaryPageV1.component';
|
||||||
|
|
||||||
|
jest.useRealTimers();
|
||||||
|
|
||||||
jest.mock('react-router-dom', () => ({
|
jest.mock('react-router-dom', () => ({
|
||||||
useHistory: () => ({
|
useHistory: () => ({
|
||||||
push: jest.fn(),
|
push: jest.fn(),
|
||||||
|
|||||||
@ -43,6 +43,8 @@ const MOCK_HISTORY = {
|
|||||||
push: jest.fn(),
|
push: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jest.useRealTimers();
|
||||||
|
|
||||||
jest.mock('../../components/containers/PageContainerV1', () => {
|
jest.mock('../../components/containers/PageContainerV1', () => {
|
||||||
return jest
|
return jest
|
||||||
.fn()
|
.fn()
|
||||||
|
|||||||
@ -30,6 +30,8 @@ import {
|
|||||||
} from '../../axiosAPIs/tagAPI';
|
} from '../../axiosAPIs/tagAPI';
|
||||||
import { getTagCategories } from '../../utils/TagsUtils';
|
import { getTagCategories } from '../../utils/TagsUtils';
|
||||||
|
|
||||||
|
jest.useRealTimers();
|
||||||
|
|
||||||
jest.mock('../../authentication/auth-provider/AuthProvider', () => {
|
jest.mock('../../authentication/auth-provider/AuthProvider', () => {
|
||||||
return {
|
return {
|
||||||
useAuthContext: jest.fn(() => ({
|
useAuthContext: jest.fn(() => ({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user