[BUG] flaky test `scripts/dashboard/build-dashboard.cy.js`
anshgoyalevil opened this issue ยท 8 comments
Describe the bug.
The scripts/dashboard/build-dashboard.cy.js
test failed after we entered the Month of March. This may be related to a hardcoded condition.
Expected behavior
It must not have failed.
Screenshots
How to Reproduce
Failing on all commits after 28 Feb, i.e., starting from 01 March 2024.
๐ฅฆ Browser
None
๐ Have you checked for similar open issues?
- I checked and didn't find similar issue
๐ข Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to work on this issue ?
None
Hey there, I would like to work on the issue, I have identified where the test is failing, I will fix that up. Can you assign me this issue @anshgoyalevil ?
@noobCoderVP
We don't assign issues here according to contributor guidelines. Feel free to create a PR directly.
Okay, thank you @anshgoyalevil !! Working on it...
There are some logical bugs in the implementation of these tests,
- Month can become negative if current month is 0/1/2, we might need to use modulo operation here.
- Each date may not exist in the previous month, for example if today is 31 st March, calling 31 st February will fail the constructor and hence error.
- Before January the month and year both changes, it is also not carefully handled.
I will fix the errors in the implementation and change the corresponding tests, @anshgoyalevil will do it quickly, give me some time
@noobCoderVP I was checking the code, and found that the monthsSince
function is implemented correctly. You can modify the function to give correct output.
Aye aye captain!! on my way...
I have fixed the issue but I want to test whether it is working fine, I tried to run npm run cy:run
but it triggers E2E testing adds unnecessary files, any guide for running tests locally?
I have defined a unit month = number of seconds in a month, I am defining 2 months and 3 months ago by this unit. I have also added a comment in the function to explain the constant literal used
I will do PR once I run the tests, let me know if you have any suggestions till then @RamGoel ...
@noobCoderVP run cy:open , select component testing in GUI and go to this url http://localhost:8080/__/#/specs/runner?file=cypress/test/scripts/dashboard/build-dashboard.cy.js