twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
Other
23.61k stars 2.43k forks source link

[Storybook Testing] Main issue: Improve Storybook Component Coverage #7491

Open charlesBochet opened 1 month ago

charlesBochet commented 1 month ago

Context

We are improving storybook coverage on packages/twenty-front/src/modules which is most of our frontend. This stories catch bugs/regressions in two ways:

How to work on a story

We have a storybook testing suite that you can run using the following commands:

  1. build and serve the stories on localhost:6006: npx nx run twenty-front:storybook:serve:dev --configuration=modules. This will generate something very similar to: https://647862655ef7071d35328bb2-ekyqijyxck.chromatic.com/
  2. Browse your story on localhost:6006, check the "Interactions". From there you can play with your story and make sure it works
  3. You can run the overall storybook headless testing by running: npx nx run twenty-front:storybook:test --configuration=modules. This will run ALL the stories. This will also output a coverage in packages/twenty-front/coverage/storybook/lcov-report/index.html (feel free to open this file with your browser for easy navigation)

Tips:

What to do

### Sub-issue list
- [ ] https://github.com/twentyhq/twenty/issues/7492
- [ ] https://github.com/twentyhq/twenty/issues/7496
rizdarmwn commented 1 month ago

Hi, @charlesBochet

I was trying to run the tests locally but it failed. Is there any prerequisites to run this locally? As I don't change anything beside the component I'm working on. Ran this on W11, WSL2.

The PR I'm working on #7580

Screenshot 2024-10-11 001032

sakshit2004 commented 1 month ago

/assign

coderkhushal commented 1 month ago

/assign

charlesBochet commented 1 month ago

@rizdarmwn this is weird, what tests are failing?

rizdarmwn commented 1 month ago

@rizdarmwn this is weird, what tests are failing?

Some components are straight up do not showing. Some are timed out. Example: UI/Data/Field/Input/RelationToOneFieldInput Couldn't find the text of 'John Wick'. I think the problem was on MSW/Mocks.

image

This is on Modules/CommandMenu/CommandMenu › MatchingPersonCompanyActivityCreateNavigate, but the other errors are almost the same as this.

charlesBochet commented 1 month ago

That's weird as they are passing on the CI Could you run the storybook:

and then browse the story on localhost:6006, go to MatchingPersonCompanyActivityCreateNavigate story and send me a screenshot of what you see / check dev console / inspect your network tab

JorgeGraciaViveros commented 3 days ago

Hi @charlesBochet ! I am currently working in a group of 5 students from Carnegie Mellon taking a software engineering course and our final project is to contribute to an open-source repo. Our project has multiple checkpoints and will be due on December 8 (meaning our PR will take longer to open). Would it be possible for us to be assigned to this issue (or any issues that you think would be a good fit)? Thanks!

charlesBochet commented 2 days ago

@JorgeGraciaViveros, sure this could be a nice project!