storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.68k stars 9.32k forks source link

Build: Add E2E tests for Component Testing module #29219

Closed yannbf closed 1 month ago

yannbf commented 1 month ago

Closes https://github.com/storybookjs/storybook/issues/29213

What I did

This PR introduces changes in the sandbox script to register addon test in vite-based sandboxes, as well as add an E2E to test the entire flow. It also fixes a bug where the test runner was crashing.

Unfortunately I had to add a resolution to a beta version of Vitest 2.1. That's because Vitest 2.1 introduced a bug when changing from fast-glob to tinyglobby, which is a library that does not support symlinks. This means that the addon test stories are not picked up and therefore the E2E tests would fail.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

Checklist for Maintainers

๐Ÿฆ‹ Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

_core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>_

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.7 MB 78.5 MB 794 kB Infinity 1%
initSize 152 MB 153 MB 797 kB 16.89 0.5%
diffSize 74.6 MB 74.6 MB 2.56 kB 1.45 0%
buildSize 7.28 MB 7.28 MB 378 B 0.77 0%
buildSbAddonsSize 1.87 MB 1.87 MB 0 B 0.71 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.93 MB 1.93 MB 378 B 0.79 0%
buildSbPreviewSize 312 kB 312 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.31 MB 4.31 MB 378 B 0.79 0%
buildPreviewSize 2.98 MB 2.98 MB 0 B 0.68 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 21.2s 18.5s -2s -685ms 0.35 -14.5%
generateTime 20.1s 20s -80ms 0.99 -0.4%
initTime 15.4s 14.1s -1s -311ms -1.54 ๐Ÿ”ฐ-9.3%
buildTime 9.6s 9.2s -363ms -1.1 -3.9%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 7s 6.5s -531ms -0.42 -8.1%
devManagerResponsive 4.4s 4.2s -242ms -0.4 -5.7%
devManagerHeaderVisible 663ms 909ms 246ms 3.25 ๐Ÿ”บ27.1%
devManagerIndexVisible 718ms 935ms 217ms 2.93 ๐Ÿ”บ23.2%
devStoryVisibleUncached 1.3s 1.1s -194ms -1.02 -16.4%
devStoryVisible 716ms 943ms 227ms 3.06 ๐Ÿ”บ24.1%
devAutodocsVisible 694ms 740ms 46ms 1.59 ๐Ÿ”บ6.2%
devMDXVisible 584ms 526ms -58ms -0.59 -11%
buildManagerHeaderVisible 628ms 634ms 6ms 1.32 0.9%
buildManagerIndexVisible 632ms 672ms 40ms 1.14 6%
buildStoryVisible 678ms 673ms -5ms 0.78 -0.7%
buildAutodocsVisible 515ms 579ms 64ms 0.47 11.1%
buildMDXVisible 560ms 476ms -84ms -1.71 ๐Ÿ”ฐ-17.6%

Greptile Summary

This PR introduces changes to register the addon test in vite-based sandboxes and adds E2E tests for the addon test functionality. Key modifications include:

Note: PR is currently blocked due to a Vitest 2.1 bug affecting symlink support, preventing addon test stories from being picked up.

nx-cloud[bot] commented 1 month ago

โ˜๏ธ Nx Cloud Report

CI is running/has finished running commands for commit 9570872cdc490d553e3a0b72b0fe63b1f8395a28. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

๐Ÿ“‚ See all runs for this CI Pipeline Execution


โœ… Successfully ran 1 target - [`nx run-many -t build --parallel=3`](https://cloud.nx.app/runs/G4TN1pu7NI?utm_source=pull-request&utm_medium=comment)

Sent with ๐Ÿ’Œ from NxCloud.