asyncapi/website

[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

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

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

@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,

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

@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?

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 ...