📆 Seeking Best Practices for E2E Testing with Time-Sensitive Web Apps

Hi everyone! 👋 I'm currently working on a calendar-based web application and facing a bit of a challenge with end-to-end testing. Specifically, I'm looking for effective ways to ensure tests run on a fixed “test date” for reproducibility. For example, I might choose Jan 1, 2023 as the effective date that my tests run on, and have expectations that calendar events are created relative to this date. Please let me know if this doesn't seem like a good practice, and that I should instead have all my tests run based on the real world time during test execution. I'm using Cypress for testing, and my application is deployed on Vercel. The main issue is synchronizing the time between my frontend (Cypress tests) and the server, especially in CI environments, where the server doesn't share the same clock as Cypress. I’ve considered options like mocking backend calls and adjusting test data, but I'm keen to maintain true end-to-end testing without resorting to extensive mocking. If you've encountered similar challenges or have insights on best practices, especially in a small-scale startup environment, I’d love to hear your thoughts or suggestions. How do you handle time synchronization in your tests? Are there specific strategies or tools you recommend? Thanks in advance for your help and insights! 🙏
1 Reply
Nuntius Mortis
Nuntius Mortis7mo ago
I'm unsure what you mean by "synchronizing the time" and not sharing the same clock? If we're talking about timezones and alike then the tests failing might be indicative of your app not working properly for those use cases in which case it is a good thing that the tests are failing.