Bug 1739371 - [devtools] Fix browser_inspector_command_findNodeFrontFromSelectors.js intermittent. r=ochameau.

The 0 timeout wasn't enough on some platform, so we reload the page before calling
the method; since we're targetting an iframe that takes a few seconds to load,
the call should time out every time.

Differential Revision: https://phabricator.services.mozilla.com/D130612
This commit is contained in:
Nicolas Chevobbe 2021-11-08 14:25:49 +00:00
parent 66e358f4a9
commit 2125a049e6

View File

@ -117,9 +117,18 @@ add_task(async () => {
);
info("Check that timeout does work");
// Reload the page so we'll have the iframe loading (for 3s) and we can check that
// putting a smaller timeout will result in the function returning null.
// we need to wait until it's fully processed to avoid pending promises.
const onNewTargetProcessed = commands.targetCommand.once(
"processed-available-target"
);
await reloadBrowser({ waitForLoad: false });
await onNewTargetProcessed;
nodeFront = await commands.inspectorCommand.findNodeFrontFromSelectors(
["#iframe-org", "#in-iframe"],
0
// timeout in ms (smaller than 3s)
100
);
is(
nodeFront,