market icon indicating copy to clipboard operation
market copied to clipboard

added @shared components stories

Open EnzoVezzaro opened this issue 2 years ago • 8 comments

  • Fixes #1400

Changes proposed in this PR:

  • added ...

EnzoVezzaro avatar May 30 '22 13:05 EnzoVezzaro

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
market ✅ Ready (Inspect) Visit Preview Jul 7, 2022 at 11:07AM (UTC)
1 Ignored Deployment
Name Status Preview Updated
market-v3 ⬜️ Ignored (Inspect) Jul 7, 2022 at 11:07AM (UTC)

vercel[bot] avatar May 30 '22 13:05 vercel[bot]

Please @claudiaHash take some time to review the market as this last commit touches few files. Also, it will break the CI, but I'd prefer to bring some of the work to review while I'm trying to fix the CI issues.

EnzoVezzaro avatar Jun 02 '22 14:06 EnzoVezzaro

Please @claudiaHash take some time to review the market as this last commit touches few files. Also, it will break the CI, but I'd prefer to bring some of the work to review while I'm trying to fix the CI issues.

Even though the locale change brings some modifications in a lot of files, from a writing stories perspective it makes our job easier

claudiaHash avatar Jun 03 '22 08:06 claudiaHash

Please @claudiaHash take some time to review the market as this last commit touches few files. Also, it will break the CI, but I'd prefer to bring some of the work to review while I'm trying to fix the CI issues.

Even though the locale change brings some modifications in a lot of files, from a writing stories perspective it makes our job easier

Yeah. I couldn't find a way to work around all the issues that our hooks create on storybook and testing.

I found also that our script to automate the tests is actually running some tests twice or is ignoring our customs .test files.

For example: I'm working on AssetList. This component needs a custom .test file to run correctly. The custom test runs correctly, but the automated script also runs on the component which fails because it's missing what's on our custom .test file.

Our custom AssetList/index.test.tsx passes, but .storybook/storyshots.test.tsx fails Screen Shot 2022-06-03 at 6 56 18 AM

This is the automated test Screen Shot 2022-06-03 at 6 42 07 AM

If you run the single test npm run jest AssetList, it passes 😅

Screen Shot 2022-06-03 at 6 54 52 AM

EnzoVezzaro avatar Jun 03 '22 10:06 EnzoVezzaro

Greener and greener 💚

Screen Shot 2022-06-10 at 7 44 44 AM

Test coverage is on the rise. We still need to deal with a couple of issues:

  • Automated test fails: @shared/FormFields/AssetSelection/index.stories.tsx
Screen Shot 2022-06-10 at 7 42 48 AM
  • Automated test fails: @shared/AssetList/index.tsx (manual test passes)
Screen Shot 2022-06-10 at 7 42 37 AM

EnzoVezzaro avatar Jun 10 '22 11:06 EnzoVezzaro

Code Climate has analyzed commit b3260d88 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 3

The test coverage on the diff in this pull request is 14.1% (50% is the threshold).

This pull request will bring the total coverage in the repository to 13.0% (7.9% change).

View more on Code Climate.

codeclimate[bot] avatar Jun 10 '22 11:06 codeclimate[bot]

just quickly looking over this, refactoring all components to not use any hooks is not feasible. That's the point of hooks, to not using a gazillion props on everything, which for some components this PR now does.

You need to mock hooks like useWeb3() or useUserPreferences() so that whenever Jest runs, those hook calls in the components are returning your mocked values.

kremalicious avatar Jun 14 '22 12:06 kremalicious

Let's recap the current state of this PR before moving forward.

Current State of the Art:

Screen Shot 2022-06-23 at 9 13 36 AM

Issues unsolved:

  • [ ] Automated test should stop when encountered console.error

  • [ ] Automated test should ignore components with custom .test.tsx file passed (see here)

  • [ ] Test failing on package is-url-superb Screen Shot 2022-06-23 at 9 21 28 AM

  • [ ] Error fetchData: Cannot read properties of undefined (reading query) : errors with contexts (we need to mock correctly the context as suggested). Example: MarketMetadataContext

  • [ ] An update to AssetList inside a test was not wrapped in act : see here

As for right now, We should stop moving forward as these are critical issues we need to solve to be able to keep going effectively. As stated previously, we need to mock our context providers. At that point we'll probably endup with custom .test.tsx files to maintain. At the moment we don't see feasible decoupling logic from UI, and also doesn't make much sense to keep going on storybook if we'll need to do custom work on the testing side of things. On that regard, we wanted to ask you @kremalicious, what you think is the best way to move forward here?

EnzoVezzaro avatar Jun 23 '22 13:06 EnzoVezzaro

can be ignored for now, huge merge conflict is not worth solving here. Have another branch prepared where some of the things in here are copied over

kremalicious avatar Oct 11 '22 10:10 kremalicious