Assert Altis QM panels from raw response, drop UI clicks for QM v4#1057
Merged
Conversation
Query Monitor v4.0 rewrote its UI into a React app inside a shadow DOM (#query-monitor-container) and moves the server-rendered panel HTML from <div id="query-monitor-fallbacks"> into the shadow tree once React boots. Codeception's see() only walks the light DOM and seeInPageSource() reads the post-React serialized DOM, so neither can reach the panel content. The data-qm-href tab buttons used by the old test also no longer exist - tabs are now shadow-DOM buttons with role="tab". Rewrite the test to fetch the raw server response over a same- session XHR and assert against that. Scope narrowed to the three Altis-specific panel outputters (Altis Config, ElasticPress, AWS X-Ray) - QM owns its own UI rendering and is tested upstream; the Hooks & Actions panel is QM's, not Altis dev-tools'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
The server-rendered panel gets moved into the shadow DOM when a user clicks on the corresponding menu item, not when the QM component mounts. That should mean you can directly inspect the |
Contributor
Author
|
Claude mentioned that Codeception can't see anything |
Member
|
Ah that's annoying |
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.
Summary
DevToolsCest::testQueryMonitorto assert against the raw server response rather than the live DOM, since Query Monitor v4 renders its UI client-side in a shadow DOM and Codeception can't reach it.Background
QM 4.0 changed how panels are rendered:
<div id="query-monitor-fallbacks">block.<div id="query-monitor-container">using a shadow root, then moves the fallback nodes into the shadow tree.That broke the existing test in three different ways:
$I->see('Module', 'th')walks only the light DOM — by the time it runs, the<th>is in the shadow tree, so "no<th>found".data-qm-hreftab buttons no longer exist (tabs are<button role="tab">inside the shadow DOM with nodata-qm-hrefattribute, and they're behind the shadow boundary anyway).seeInPageSource()also won't work —WebDriver::getPageSource()returns the post-React serialized DOM, where the fallback nodes have already been moved out.Caught by product-dev nightly CI (run 25669000209).
Approach
Use
executeJSto run a synchronousXMLHttpRequestagainst the current URL inside the authenticated browser session. That gives us the raw server response (before any React mutation), which is what we actually want to verify — the three Altis-specific panel PHP outputters are wired up and emitting the expected markup. QM owns its own client-side rendering and is tested upstream.Synchronous XHR is technically deprecated but still works in Chrome and avoids needing to thread session cookies into a separate PHP HTTP client.
Test plan
composer dev-tools codecept run -p vendor/altis/dev-tools/tests/ -- acceptance DevToolsCestpasses locally — 6 assertions across the three panels.🤖 Generated with Claude Code