From 614769ada577bd35ee2c52cabd6bb018642a6dd1 Mon Sep 17 00:00:00 2001 From: Changhao Han Date: Mon, 5 Jul 2021 13:37:47 +0000 Subject: [PATCH] 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 Reviewed-by: Mathias Bynens Reviewed-by: Johan Bay --- .../elements_test_runner/ElementsTestRunner.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js b/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js index d49a650550..fe3dc732da 100644 --- a/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +++ b/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js @@ -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 =