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: setup Storybook Interaction Testing #12444

Merged
merged 22 commits into from
May 27, 2024

Conversation

TylerAPfledderer
Copy link
Contributor

@TylerAPfledderer TylerAPfledderer commented Mar 14, 2024

Sets up testing for storybook and applies testing for FeedbackWidget and QuizWidget

  • Adds @storybook/test
  • Adds interaction test for FeedbackWidget, which creates a snapshot capture for the modal.
  • Adds mock user interaction of the QuizWidget, which runs a quiz with all correct answers.

Copy link
Contributor

coderabbitai bot commented Mar 14, 2024

Important

Auto Review Skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added dependencies 📦 Changes related to project dependencies review needed 👀 labels Mar 14, 2024
Copy link

netlify bot commented Mar 14, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 89ca84c
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/6651f93e5e77840008ea9bb9
😎 Deploy Preview https://deploy-preview-12444--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 32 (🔴 down 6 from production)
Accessibility: 92 (no change from production)
Best Practices: 89 (🔴 down 3 from production)
SEO: 93 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@TylerAPfledderer TylerAPfledderer marked this pull request as ready for review April 2, 2024 13:41
@wackerow
Copy link
Member

wackerow commented Apr 8, 2024

Hey @TylerAPfledderer, checking this out...

image

The layer-2 quiz seems to work great, but the others are not yet...

image

Were we looking to add those here as well or in a separate task?

image

FeedbackWidget modal passing on my end 👍

@TylerAPfledderer
Copy link
Contributor Author

Hey @TylerAPfledderer, checking this out...

image

The layer-2 quiz seems to work great, but the others are not yet...

image

Were we looking to add those here as well or in a separate task?

image

FeedbackWidget modal passing on my end 👍

To clarify, how you are checking the other quizzes? Are you just replacing the name of the key in the story?

I was only considering just one of the quiz banks to be able to verify that the object shape is valid. If one works, then they should all work. 🤔

I didn't want to run all of them because that would mean creating a story per quiz, and that would bloat the amount of snapshots created.

I would add one to verify when some questions are answered incorrectly, though!

These interaction tests should be about how the user is navigating the quizzes and what they should be seeing, nothing more.

If you are seeing an inconsistency, then I wonder if my implementation of the testing is wrong.

@wackerow
Copy link
Member

To clarify, how you are checking the other quizzes? Are you just replacing the name of the key in the story?

Under "Controls" > quizKey* downdown:

image

If one works, then they should all work. 🤔

Okay yeah, hah sounds reasonable

I would add one to verify when some questions are answered incorrectly, though!

Agree, that would be a nice case to test

Thanks for clarifying!

@wackerow
Copy link
Member

@TylerAPfledderer Did you want to include a test case for a wrong answer in this PR, or keep that separate?

@TylerAPfledderer
Copy link
Contributor Author

TylerAPfledderer commented Apr 10, 2024

@TylerAPfledderer Did you want to include a test case for a wrong answer in this PR, or keep that separate?

I probably should add it here.

I would simply call on the layer-2 question bank again and randomly select two questions to have an incorrect answer

@pettinarip
Copy link
Member

Nice! @TylerAPfledderer

Seeing this on Chromatic, it seems that it takes the snapshot once the interactive test is finished, right? Its fine for me, just wondering how it would be to take a snapshot for the initial state. I guess we would need to have a separate story for that. If that is correct, we could have 1 snapshot for the initial state, 1 for success and 1 for the error state.

@TylerAPfledderer
Copy link
Contributor Author

TylerAPfledderer commented Apr 12, 2024

To clarify, how you are checking the other quizzes? Are you just replacing the name of the key in the story?

Under "Controls" > quizKey* downdown:

image > If one works, then they should all work. 🤔

Okay yeah, hah sounds reasonable

I would add one to verify when some questions are answered incorrectly, though!

Agree, that would be a nice case to test

Thanks for clarifying!

Cool!

Now that I finally had a chance to properly check this. I have this setup constrained to just pulling content data for the layer 2 quiz in the story file.

I should remove the ability to change the key in the dashboard

@wackerow
Copy link
Member

Great, looking good...

image

I noticed this string is showing up by it's key... would we fix that here? I don't see that bug in production

@TylerAPfledderer
Copy link
Contributor Author

Great, looking good...

image

I noticed this string is showing up by it's key... would we fix that here? I don't see that bug in production

I haven't quite figured out why it's an issue here, because the intl file this key is a part of is exposed in storybook (common.json). So I wouldn't know if it's a quick fix.

If it's not a quick fix, then it should be addressed separately; I don't think it's a blocker for this PR.

@TylerAPfledderer
Copy link
Contributor Author

TylerAPfledderer commented Apr 19, 2024

Outstanding tasks:

  • Update the PR with dev branch to make sure fix from Fix bad syntax in json files #12781 is included
  • Add interaction test for Tooltip to ensure the rendered popover is viewable in a snapshot (currently breaking)

@TylerAPfledderer TylerAPfledderer force-pushed the feat/sb-interaction-testing branch from 8f522c5 to cd46b7f Compare April 23, 2024 18:10
@TylerAPfledderer TylerAPfledderer marked this pull request as draft April 30, 2024 19:24
@TylerAPfledderer
Copy link
Contributor Author

Sticking back into draft for a brief time. Still pesky issues with the tooltip snapshot. Will put to "Ready for review" when either the issue is resolved, or that test is scrapped and to be addressed in a future PR.

Currently working with a developer from Chromatic to help figure out the issue.

@TylerAPfledderer TylerAPfledderer force-pushed the feat/sb-interaction-testing branch from 5b9cd7f to c521253 Compare May 14, 2024 02:06
@TylerAPfledderer TylerAPfledderer marked this pull request as ready for review May 14, 2024 02:15
@TylerAPfledderer
Copy link
Contributor Author

Ready to go here, but seeing unexpected build errors unrelated to the PR

@wackerow wackerow added config ⚙️ Changes to configuration files and removed internal 🏠 labels May 22, 2024
@wackerow wackerow added the needs design approval 🧑‍🎨 Approval from a designer is needed before merging label May 25, 2024
@nloureiro
Copy link
Contributor

@wackerow @TylerAPfledderer, what kind of approval can I do here? What should I look for?

@TylerAPfledderer
Copy link
Contributor Author

@wackerow @TylerAPfledderer, what kind of approval can I do here? What should I look for?

For a PR like this, I don't think we need your explicit approval. No component affected should have their design altered.

@wackerow wackerow merged commit f49d9da into ethereum:dev May 27, 2024
8 of 10 checks passed
@TylerAPfledderer TylerAPfledderer deleted the feat/sb-interaction-testing branch May 27, 2024 15:11
This was referenced Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config ⚙️ Changes to configuration files dependencies 📦 Changes related to project dependencies needs design approval 🧑‍🎨 Approval from a designer is needed before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants