[quality] consolidate the waitForHydration helper duplicated byte-identically across 8 e2e specs
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
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.
-
waitForHydrationexported fromtests/tools/e2e-coverage.cjs - the eight specs above import it instead of defining it
-
tests/e2e/accessibility.spec.jsimports 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
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cncf/endusers
-
[guide] Three docs still cite the /awards route removed by #1552Possibly taken @hivecommons-hive claimed this today. Open🐝 covered by PR documentation hive/claimed-by-guide
Difficulty 1/5 1-3 hours Newbie friendliness 20/100
cncf/endusers#1568 · 1 comment ·
Maintainers usually reply within 1 day
-
[quality] Node-major parity chain in tests/dev-environment.test.mjs is blind to composite actions under .github/actions/**Possibly taken @hivecommons-hive claimed this today. Open🐝 covered by PR agent/quality hive/claimed-by-quality hive/hosted-available-lke648397-260827-5n31 quality testing
Difficulty 3/5 1-2 days Newbie friendliness 20/100
cncf/endusers#1566 · 1 comment ·
Maintainers usually reply within 1 day
-
[quality] CI supply-chain and npm-script guards never scan .github/actions/** composite actionsPossibly taken @hivecommons-hive claimed this today. Open🐝 covered by PR agent/quality hive/claimed-by-quality hive/hosted-available-lke648397-260827-5n31 quality testing
Difficulty 4/5 3-5 days Newbie friendliness 25/100
cncf/endusers#1564 · 1 comment ·
Maintainers usually reply within 1 day
-
🐝 covered by PR agent/architect architecture hive/hosted-available-lke648397-260827-5n31 tech-debt
Difficulty 4/5 3-5 days Newbie friendliness 35/100
cncf/endusers#1558 · 3 comments ·
Maintainers usually reply within 1 day
-
agent/quality hive/hosted-available-lke648397-260827-5n31 needs-decision quality testing
Difficulty 4/5 1-2 days Newbie friendliness 42/100
cncf/endusers#1556 · 7 comments ·
Maintainers usually reply within 1 day
Similar issues
-
BUG
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 75/100
flarum/framework#5231 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/rocketmq-dashboard#6896 ·
Maintainers usually reply within 3 days
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
[workshop-sync] workshop/side-quest-17-06-output-injection.md: stale add_comment.cjs line referencesOpendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
githubnext/gh-aw-workshop#4679 ·
Maintainers usually reply within 1 day