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

Optimize CommentContainer.spec.tsx test initialization #4327

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

nick-funk
Copy link
Contributor

What does this PR do?

Use waitFor and getByTestId for the initialization of the CommentContainer.spec.tsx tests.

This cuts a problematic test render username and body's render time down from roughly 1320ms to 795ms. Since we're seeing this test take minutes to run on GitHub Actions CI, this should help it finish without timing out.

I realize replacing a findBy with a waitFor + get is considered less optimal for most occasions, I have documented why this is more optimal in the code. Several folks have found this to be the case for finding objects in particularly large test DOM's on StackOverflow and GitHub issues. For now, this is a nice quick fix to get some speed during a particularly slow test.

These changes will impact:

  • commenters
  • moderators
  • admins
  • developers

What changes to the GraphQL/Database Schema does this PR introduce?

None

Does this PR introduce any new environment variables or feature flags?

No

If any indexes were added, were they added to INDEXES.md?

No new indices.

How do I test this PR?

  • run the tests
  • see that they pass
  • watch that it passes more reliably in CI

Where any tests migrated to React Testing Library?

No

How do we deploy this PR?

No special considerations.

@netlify
Copy link

netlify bot commented Aug 24, 2023

Deploy Preview for gallant-galileo-14878c canceled.

Name Link
🔨 Latest commit 596bd71
🔍 Latest deploy log https://app.netlify.com/sites/gallant-galileo-14878c/deploys/64e787b5041f8c000804796c

@tessalt tessalt enabled auto-merge August 24, 2023 16:47
Copy link
Contributor

@kabeaty kabeaty left a comment

Choose a reason for hiding this comment

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

very nice!

@tessalt tessalt added this pull request to the merge queue Aug 24, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Aug 24, 2023
@tessalt tessalt added this pull request to the merge queue Aug 25, 2023
Merged via the queue into develop with commit ce7d87f Aug 25, 2023
@tessalt tessalt deleted the fix/optimize-comment-container-tests-again branch August 25, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants