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

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

Open
1 of 2 tasks
charlesBochet opened this issue Oct 8, 2024 · 6 comments
Open
1 of 2 tasks
Labels

Comments

@charlesBochet
Copy link
Member

charlesBochet commented Oct 8, 2024

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:

  • stories comes with Interactions tests (wrote in the "play" callback in the .stories.tsx)
  • we run Chromatic on top of the final state of the story which does pixel diff between main and the upcoming branch.

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:

  • If you computer struggles you can play with the maxWorker options (see nx.json options), this will adjust how many stories are run in parallel
  • You can also run the only desired story by running: cd packages/twenty-front + npx @storybook/test-runner <path of the story file>

What to do

  • Pick any unassigned issue in the sub-issue list below.
  • Follow "How to work on a story" section above
  • Compute the coverage before and after your work (running the tests will output it)
  • Open a PR containing the sub-issue link, before and after coverages, and a screenshot of your fixed / newly introduced story

Sub-issue list

  1. good first issue
  2. 🕹️ 150 points good first issue 🕹️ oss.gg
    rizdarmwn
@charlesBochet charlesBochet changed the title Improve Storybook Component Coverages [Storybook Testing] Main issue: Improve Storybook Component Coverage Oct 8, 2024
@charlesBochet charlesBochet added the good first issue Good for newcomers label Oct 8, 2024
@rizdarmwn
Copy link
Contributor

rizdarmwn commented Oct 10, 2024

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
Copy link

/assign

1 similar comment
@coderkhushal
Copy link

/assign

@charlesBochet
Copy link
Member Author

@rizdarmwn this is weird, what tests are failing?

@rizdarmwn
Copy link
Contributor

@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
Copy link
Member Author

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

  • npx nx run twenty-front:storybook:serve:dev --configuration=modules

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants