From 80d8efe286c37a79fa3628426f86ff3e7613dbc3 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Mon, 3 Jan 2022 13:24:29 +0000 Subject: [PATCH] Bug 1739320 - Replace synthesizeMouseAtCenter() with click() in clickJsonNode(). r=Honza This approach seemed to fix bug 1734940. Differential Revision: https://phabricator.services.mozilla.com/D134660 --- .../client/jsonview/test/browser_jsonview_row_selection.js | 3 +++ devtools/client/jsonview/test/head.js | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/devtools/client/jsonview/test/browser_jsonview_row_selection.js b/devtools/client/jsonview/test/browser_jsonview_row_selection.js index 193bde9607bf..59856b9e9b15 100644 --- a/devtools/client/jsonview/test/browser_jsonview_row_selection.js +++ b/devtools/client/jsonview/test/browser_jsonview_row_selection.js @@ -93,6 +93,9 @@ add_task(async function() { await assertRowSelected(1); // Synthetize multiple down arrow keydowns to select following rows. + await SpecialPowers.spawn(tab.linkedBrowser, [], function() { + content.document.querySelector(".treeTable").focus(); + }); for (let i = 2; i < numRows; ++i) { await BrowserTestUtils.synthesizeKey( "VK_DOWN", diff --git a/devtools/client/jsonview/test/head.js b/devtools/client/jsonview/test/head.js index e01a88640368..f9c0a56280d7 100644 --- a/devtools/client/jsonview/test/head.js +++ b/devtools/client/jsonview/test/head.js @@ -136,8 +136,10 @@ async function addJsonViewTab( function clickJsonNode(selector) { info("Expanding node: '" + selector + "'"); - const browser = gBrowser.selectedBrowser; - return BrowserTestUtils.synthesizeMouseAtCenter(selector, {}, browser); + // eslint-disable-next-line no-shadow + return ContentTask.spawn(gBrowser.selectedBrowser, selector, selector => { + content.document.querySelector(selector).click(); + }); } /**