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

feat: better storybook stories for the notification pages #27861

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

matteoscurati
Copy link
Contributor

@matteoscurati matteoscurati commented Oct 15, 2024

Description

This pull request enhances the Storybook stories for the notification pages. The improvements aim to provide better clarity and usability for developers working with notification components. The changes include more detailed and organized stories, making it easier to understand and test different notification states and components.

### Important

  1. some of the components rendered by the new stories (ui/pages/notification-details/notification-details.stories.tsx) need to use an RPC endpoint to fetch certain data
  2. to avoid the fetch using the Infura ID used by the application in PROD, this PR introduces:
  • an environment variable to determine if the current env is Storybook (eg. "storybook": "STORYBOOK_ENV=true storybook dev -p 6006 -c .storybook", in package.json)
  • if yes, use a dedicated Infura ID (.metamaskrc.dist)
  • if yes, in the utility XXX, the XXX header is not used (ui/helpers/utils/notification.util.ts)

Related issues

N/A

Manual testing steps

  1. Open Storybook in your development environment
  2. Navigate to the notification pages section
  3. Review the updated stories for clarity and completeness
  4. Verify that all notification states are represented and functioning as expected

Screenshots/Recordings

Before

N/A

After

Screen.Recording.2024-10-24.at.17.23.49.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@matteoscurati matteoscurati added the team-notifications Notifications team label Oct 15, 2024
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

Builds ready [cf66689]
Page Load Metrics (1909 ± 109 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint35025111827406195
domContentLoaded159324981878226109
load159725141909227109
domInteractive16184573718
backgroundConnect883332613
firstReactRender46210884321
getState56014167
initialActions01000
loadScripts116820501432219105
setupStore1272372512
uiStartup180027112135232112
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

sonarcloud bot commented Oct 16, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [2322c20]
Page Load Metrics (1795 ± 141 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint28329841714440211
domContentLoaded151529231770287138
load151929561795294141
domInteractive27162482814
backgroundConnect889292211
firstReactRender453061025326
getState47414189
initialActions01000
loadScripts108325431309300144
setupStore1190292613
uiStartup173931872022324156
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [36288c3]
Page Load Metrics (1948 ± 98 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16532377193616378
domContentLoaded16042084187713766
load16532622194820398
domInteractive1995532412
backgroundConnect94947110751
firstReactRender494171329144
getState5225305125
initialActions00000
loadScripts11691600140411555
setupStore11304526531
uiStartup179744232298565271
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [7f9b8c6]
Page Load Metrics (1990 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint34224221813502241
domContentLoaded16742386194819594
load16822402199020297
domInteractive279547199
backgroundConnect10118453215
firstReactRender6413695168
getState484272512
initialActions01000
loadScripts12031880144416680
setupStore1088332211
uiStartup187830952225285137
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@matteoscurati matteoscurati marked this pull request as ready for review October 22, 2024 10:19
@matteoscurati matteoscurati requested review from a team as code owners October 22, 2024 10:19
@metamaskbot
Copy link
Collaborator

Builds ready [4096501]
Page Load Metrics (1875 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1722208018779345
domContentLoaded1705202518438943
load1720208318758842
domInteractive25100552110
backgroundConnect980322311
firstReactRender501641012210
getState561182110
initialActions01000
loadScripts1211155813678440
setupStore1269312411
uiStartup1937227720789043
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [d44e45b]
Page Load Metrics (1868 ± 64 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16812174188213766
domContentLoaded16582102184313263
load16702145186813364
domInteractive168648189
backgroundConnect86429189
firstReactRender492071154120
getState55615168
initialActions01000
loadScripts1219156113719847
setupStore1068232110
uiStartup18352579210419192
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@legobeat legobeat changed the title feat: ✨ better storybook stories for the notification pages feat: better storybook stories for the notification pages Oct 22, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [14cacbc]
Page Load Metrics (1879 ± 64 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16532101188313163
domContentLoaded15992082184612962
load16082102187913464
domInteractive16208554119
backgroundConnect883382512
firstReactRender453011046632
getState481212311
initialActions01000
loadScripts11591573136710952
setupStore1176292512
uiStartup179726932112220105
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [5c3ba50]
Page Load Metrics (2121 ± 89 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint53224872034389187
domContentLoaded17742469208718589
load17852476212118589
domInteractive298855178
backgroundConnect10105312914
firstReactRender501691062311
getState564282311
initialActions01000
loadScripts12901870155916278
setupStore11117322813
uiStartup19982763236620197
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [be54666]
Page Load Metrics (2022 ± 98 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint172124172033208100
domContentLoaded16752380198319895
load17112412202220598
domInteractive198052199
backgroundConnect10100312612
firstReactRender5312298188
getState577272412
initialActions01000
loadScripts12371786148416177
setupStore1178292311
uiStartup187328202241242116
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 37 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@@ -4,6 +4,10 @@
; This variable is required
INFURA_PROJECT_ID=00000000000

; This variable is not required but it's necessary for the storybook
; to render stories that use onchain data.
INFURA_STORYBOOK_PROJECT_ID=
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new ENV introduced to handle a dedicated Infura ID only for Storybook builds

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to discuss with someone on how we can populate this into our CI system.

###
# Storybook
###
- STORYBOOK_ENV: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ENV is set to false by default

"storybook": "storybook dev -p 6006 -c .storybook",
"storybook:build": "storybook build -c .storybook -o storybook-build",
"storybook:deploy": "storybook-to-ghpages --existing-output-dir storybook-build --remote storybook --branch master",
"storybook": "STORYBOOK_ENV=true storybook dev -p 6006 -c .storybook",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of running one of these Storybook-related commands, the STORYBOOK_ENV is set to true

headers: process.env.STORYBOOK_ENV
? undefined
: {
'Infura-Source': 'metamask/metamask',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sub-optimal solution was previously introduced to handle a dedicated header for RPC calls to the Infura endpoint. In this PR, the use of this call is managed without the header in the case of a Storybook build

@metamaskbot
Copy link
Collaborator

Builds ready [312be96]
Page Load Metrics (1740 ± 51 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16112049175111656
domContentLoaded1599190016968541
load16111989174010651
domInteractive255739105
backgroundConnect9172504421
firstReactRender44285915024
getState4130263517
initialActions01000
loadScripts1176135712506230
setupStore10109282713
uiStartup178727031955236113
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 46 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

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

Successfully merging this pull request may close these issues.

3 participants