I have a modal that appears in my application after 25 minutes have elapsed while a user is idle. How can I get this modal to appear in Jest?
Here's what I have in my test:
render(<App />);
// Wait 25.5 minutes
setTimeout(() => {}, 1530000);
screen.debug();
Something else I've tried:
jest.useFakeTimers();
jest.advanceTimersByTime(1530000);
render(<App />);
screen.debug();
I'm expecting the modal to appear when debugging the screen, but it does not appear. Any idea how I can accomplish this?
Here is one example similar to your scenario:
Above is the code of My Component which opens popup when user stays idle for 25 mins.
Here is my test file
Result
Hope it will help!!