Bug 1386221 - Fix test for inspect binding on 56 beta. r=bgrins.

The test was failing on 56 beta because the new console frontend isn't enabled there and thus
the ObjectInspector that were tested not in the old frontend.
This patch adds a branch in the test so we can wait for the correct element (VariableView or ObjectInspector)
depending on whether the new console frontend is enabled or not.

MozReview-Commit-ID: HGGgr7CWMpe

--HG--
extra : rebase_source : ef8e21d1f0a1b074fd798ed2b05fb18a9a9335cc
This commit is contained in:
Nicolas Chevobbe 2017-08-01 19:59:24 +02:00
Родитель 21c8b4f6c5
Коммит 8356937ddd
1 изменённых файлов: 25 добавлений и 12 удалений

Просмотреть файл

@ -121,21 +121,34 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() {
const splitPanelOpenedPromise = (async () => {
await toolbox.once("split-console");
let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
const {hud} = toolbox.getPanel("webconsole");
let {jsterm} = hud;
// Wait for the message to appear on the console.
const messageNode = await new Promise(resolve => {
jsterm.hud.on("new-messages", function onThisMessage(e, messages) {
for (let m of messages) {
resolve(m.node);
jsterm.hud.off("new-messages", onThisMessage);
return;
}
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1386221.
if (jsterm.hud.NEW_CONSOLE_OUTPUT_ENABLED === true) {
// Wait for the message to appear on the console.
const messageNode = await new Promise(resolve => {
jsterm.hud.on("new-messages", function onThisMessage(e, messages) {
for (let m of messages) {
resolve(m.node);
jsterm.hud.off("new-messages", onThisMessage);
return;
}
});
});
let objectInspectors = [...messageNode.querySelectorAll(".tree")];
is(objectInspectors.length, 1, "There is the expected number of object inspectors");
} else {
const options = await new Promise(resolve => {
jsterm.once("variablesview-open", (evt, view, options) => resolve(options));
});
});
let objectInspectors = [...messageNode.querySelectorAll(".tree")];
is(objectInspectors.length, 1, "There is the expected number of object inspectors");
const objectType = options.objectActor.type;
const objectPreviewProperties = options.objectActor.preview.ownProperties;
is(objectType, "object", "The inspected object has the expected type");
Assert.deepEqual(Object.keys(objectPreviewProperties), ["testkey"],
"The inspected object has the expected preview properties");
}
})();
const inspectJSObjectPromise = extension.awaitMessage(`inspectedWindow-eval-result`);