chore(dom): merge test suites#14763
Open
jcfranco wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates browser test coverage by removing the separate dom2 browser spec and merging its test cases into the existing dom browser spec, while also relocating a custom Vitest Browser locator extension into the shared browser test setup.
Changes:
- Removed
dom2.browser.spec.tsxand merged itsqueryElementRoots-related tests intodom.browser.spec.tsx. - Refactored parts of
dom.browser.spec.tsxto use@arcgis/lumina-compiler/testing’smount+ Vitest Browserpagelocators. - Moved the
getBySelectorlocator extension from a shared test util into the global browsersetup.ts.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/components/src/utils/dom2.browser.spec.tsx | Deleted as part of merging test suites. |
| packages/components/src/utils/dom.browser.spec.tsx | Absorbs dom2 tests and refactors multiple tests to use mount/Vitest Browser locators. |
| packages/components/src/tests/commonTests/browser/utils.ts | Removes locator extension code and keeps only shared browser-test utilities. |
| packages/components/src/tests/browser/setup.ts | Adds global getBySelector locator extension for browser tests. |
Comments suppressed due to low confidence (7)
packages/components/src/utils/dom.browser.spec.tsx:48
- suggestion:
queryElementRootsis being tested twice in this file (the newdescribe("queries")block and the existingdescribe(queryElementRoots)block). This increases runtime and also defines two different LitElement classes with the samestatic tagName = "test-component", which can lead to custom element registration conflicts depending on howmount(..., { dynamicComponents })registers elements. Consider consolidating into a single suite and reusing oneTestComponentdefinition/tag name.
packages/components/src/utils/dom.browser.spec.tsx:364 - blocking: This test uses a global locator (
page.getBySelector("slot")) inside a suite that does not clear the DOM between tests, so it can accidentally bind to a<slot>from a previous test run and become order-dependent/flaky. Prefer scoping the query to the element returned bymount(e.g.el.shadowRoot!.querySelector(...)).
packages/components/src/utils/dom.browser.spec.tsx:405 - blocking: Similar to the previous case, using
page.getBySelector("slot")here can match slots from earlier mounts since this suite doesn't reset the DOM. Scoping toel.shadowRootmakes the test deterministic and avoids cross-test coupling.
packages/components/src/utils/dom.browser.spec.tsx:480 - blocking: This test also uses a global
page.getBySelector("slot")which can bind to a slot from a previous test since the DOM isn't cleared in this suite. Query the slot from the mounted element'sshadowRootinstead to keep the test isolated.
packages/components/src/utils/dom.browser.spec.tsx:524 - blocking: Using
page.getBySelector("slot")here can select slots from previous tests/mounts because this suite doesn't reset DOM state. Scoping toel.shadowRoot!.querySelectorAll("slot")avoids flakiness.
packages/components/src/utils/dom.browser.spec.tsx:1189 - blocking: This test uses
page.getBySelector("span")(global) even though each test mounts new markup. If prior tests leave spans in the DOM, the locator may resolve to an earlier instance and make the test order-dependent. Scope the query to thecontainerreturned frommount.
packages/components/src/utils/dom.browser.spec.tsx:1205 - blocking: Same issue as the previous test:
page.getBySelector("span")is global and can match a stale element from earlier mounts. Use thecontainerreturned frommountto scope the query.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
packages/components/src/utils/dom.browser.spec.tsx:939
expect(button).toBeDefined()is a no-op here (the Locator object is always defined) and doesn’t actually assert that the button element was found before callinggetShadowRootNode. Capture the underlying element and assert on that instead.
jcfranco
marked this pull request as ready for review
July 14, 2026 23:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue: N/A
Summary
Merges
dom.tstests now that browser mode allows them to share the same environment.Noteworthy changes
defaults+reflectscommon test helpers to browser mode #13323)