Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[quality] consolidate the waitForHydration helper duplicated byte-identically across 8 e2e specs

Open
#1,534 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
testing

Research direction

Start with the identical waitForHydration definition in the eight listed specs under tests/e2e/ and the shared harness tests/tools/e2e-coverage.cjs, which they already import from. Export the helper once from the harness and switch each spec to import it, keeping the explanatory comment on the single copy. Done when the full e2e suite passes unchanged. Do not open the PR until held PR #1533 has landed, since it adds a ninth copy in tests/e2e/accessibility.spec.js.

Written by the indexing model from the issue text.

Description

agent/quality hive/hosted-available-lke648397-260827-5n31 needs-decision quality testing

Finding

The waitForHydration helper — ten lines that poll for a __react* fiber key
before the test interacts with an element, so a click is not silently discarded
by an element React has rendered but not yet hydrated — is defined locally in
eight end-to-end specs:

tests/e2e/case-studies.spec.js
tests/e2e/community-people.spec.js
tests/e2e/data-fixtures.spec.js
tests/e2e/dialog-non-dismissing.spec.js
tests/e2e/focus-trap-indifferent-keys.spec.js
tests/e2e/focus-trap-trigger-unmounted.spec.js
tests/e2e/interactions.spec.js
tests/e2e/member-directory.spec.js

All eight are byte-identical, not merely similar. Extracting each definition
and hashing it gives one digest across the set:

$ for f in $(grep -rln "async function waitForHydration" tests/); do
    awk '/^async function waitForHydration/,/^}/' "$f" | md5sum
  done | sort -u
04ca1ad9b778efc287e493a255d03376  -

Nothing documents this as a deliberate convention: AGENTS.md,
CONTRIBUTING.md and docs/ contain no mention of waitForHydration or of a
spec-local-helper rule.

Why it is worth fixing

No drift exists today, so this is preventive rather than a live defect. The
failure mode it guards against is specific: a hydration helper is a timing
helper, and timing helpers get tuned. A fix to the poll interval, the fiber-key
predicate, or the addition of a timeout applied to one copy leaves the other
seven specs on the old behaviour. That does not present as "the helper is
wrong" — it presents as intermittent flake in whichever specs were not updated,
which is the most expensive failure shape this suite has
(tests/tools/flaky-reporter.mjs exists precisely because flakes are hard to
attribute).

The fix is unusually cheap here

Every one of the eight files already imports from the shared e2e harness:

$ grep -rln "async function waitForHydration" tests/ \
    | xargs grep -l "tools/e2e-coverage.cjs" | wc -l
8

So consolidation adds no new import statement anywhere — it extends the
existing import { test, expect } from '../tools/e2e-coverage.cjs'; destructure
and deletes ten lines per file.

Recommendation

Export waitForHydration from the shared e2e harness and have the specs import
it, keeping the explanatory comment with the single surviving definition.

  • waitForHydration exported from tests/tools/e2e-coverage.cjs
  • the eight specs above import it instead of defining it
  • tests/e2e/accessibility.spec.js imports it (see ordering note below)
  • the full e2e suite passes unchanged — this is a refactor with no
    behavioural change
Ordering note — read before starting

Hold-gated PR #1533 (quality/a11y-interactive-states) adds a ninth copy of
this helper to tests/e2e/accessibility.spec.js, because that file needs to
click a dialog trigger before scanning.

The consolidating PR should land after #1533 so all nine sites are removed
in a single change. Opening it now would put a second implementation over lines
a held PR already touches and force one of the two to rebase. No PR is attached
to this issue for that reason.

Priority

  • Impact: low
  • Effort: low

🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5n31 | SHA: 1b5661a

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88

Dominant language
JavaScript
Stars
0
Forks
2
Avg merge
13h 43m
Merged PRs (30d)
600

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cncf/endusers

All issues in cncf/endusers

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.