Use innerText for query content in ElementsTestRunner

There is an inconsistency between debug build and release build when
running `ElementsTestRunner.dumpSelectedElementStyles` in layout tests.
Previously it didn't matter, but now since we changed the DOM structure
of the query text node [1], its textContent differs from its innerText.
This CL will make sure we always use innerText, which more accurately
reflects the content of the query text.

[1]: https://crrev.com/c/2988301

Bug: 1146422
Change-Id: I0d77ffe1ed471e10519fff6c9b8b76b86a1c63fe
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3005933
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Johan Bay <jobay@chromium.org>
This commit is contained in:
Changhao Han
2021-07-05 14:30:15 +00:00
committed by Devtools-frontend LUCI CQ
parent db01641918
commit 614769ada5
@@ -504,7 +504,11 @@ async function printStyleSection(section, omitLonghands, includeSelectorGroupMar
for (const query of queries) {
const queryElement = query.shadowRoot.querySelector('.query');
TestRunner.addResult(text(queryElement));
// InnerText is used here to ensure test output consistency
// between debug and release blink tests, since textContent
// will preserve more DOM structural information, which would
// be easy to flake later.
TestRunner.addResult(queryElement.innerText);
}
const selector =