Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] flaky test scripts/dashboard/build-dashboard.cy.js #2737

Closed
2 tasks done
anshgoyalevil opened this issue Mar 5, 2024 · 8 comments · Fixed by #2739
Closed
2 tasks done

[BUG] flaky test scripts/dashboard/build-dashboard.cy.js #2737

anshgoyalevil opened this issue Mar 5, 2024 · 8 comments · Fixed by #2739
Labels
bug good first issue Good for newcomers

Comments

@anshgoyalevil
Copy link
Member

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

image

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?

Are you willing to work on this issue ?

None

@anshgoyalevil anshgoyalevil added bug good first issue Good for newcomers labels Mar 5, 2024
@noobCoderVP
Copy link
Contributor

noobCoderVP commented Mar 5, 2024

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 ?

image

@anshgoyalevil
Copy link
Member Author

@noobCoderVP
We don't assign issues here according to contributor guidelines. Feel free to create a PR directly.

@noobCoderVP
Copy link
Contributor

Okay, thank you @anshgoyalevil !! Working on it...

@noobCoderVP
Copy link
Contributor

noobCoderVP commented Mar 5, 2024

There are some logical bugs in the implementation of these tests,

image

  1. Month can become negative if current month is 0/1/2, we might need to use modulo operation here.
  2. 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.
  3. 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

@RamGoel
Copy link
Contributor

RamGoel commented Mar 5, 2024

@noobCoderVP I was checking the code, and found that the monthsSince function is implemented correctly. You can modify the function to give correct output.

@noobCoderVP
Copy link
Contributor

Aye aye captain!! on my way...

@noobCoderVP
Copy link
Contributor

noobCoderVP commented Mar 5, 2024

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?

image

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
image

I will do PR once I run the tests, let me know if you have any suggestions till then @RamGoel ...

@RamGoel
Copy link
Contributor

RamGoel commented Mar 5, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants