зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1350226 - Fix mochitest failures r=Honza
MozReview-Commit-ID: 4BVN0V26kjX --HG-- extra : rebase_source : 8989a9874fa4a3514da5e64450df8d461b779a7f
This commit is contained in:
Родитель
af753a230e
Коммит
6174a87d75
|
@ -45,26 +45,19 @@ add_task(function* () {
|
|||
time: true
|
||||
});
|
||||
|
||||
wait = waitForDOM(document, "#response-panel .editor-mount iframe");
|
||||
wait = waitForDOM(document, ".CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
let [editorFrame] = yield wait;
|
||||
|
||||
yield once(editorFrame, "DOMContentLoaded");
|
||||
yield waitForDOM(editorFrame.contentDocument, ".CodeMirror-code");
|
||||
yield wait;
|
||||
yield testResponse("br");
|
||||
|
||||
yield teardown(monitor);
|
||||
|
||||
function* testResponse(type) {
|
||||
switch (type) {
|
||||
case "br": {
|
||||
let text = editorFrame.contentDocument
|
||||
.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
is(text, "X".repeat(64),
|
||||
is(document.querySelector(".CodeMirror-line").textContent, "X".repeat(64),
|
||||
"The text shown in the source editor is incorrect for the brotli request.");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -58,12 +58,10 @@ add_task(function* () {
|
|||
|
||||
// Wait for all tree sections and editor updated by react
|
||||
let waitSections = waitForDOM(document, "#params-panel .tree-section", 2);
|
||||
let waitEditor = waitForDOM(document, "#params-panel .editor-mount iframe");
|
||||
let waitSourceEditor = waitForDOM(document, "#params-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[5]);
|
||||
let [, editorFrames] = yield Promise.all([waitSections, waitEditor]);
|
||||
yield once(editorFrames[0], "DOMContentLoaded");
|
||||
yield waitForDOM(editorFrames[0].contentDocument, ".CodeMirror-code");
|
||||
yield Promise.all([waitSections, waitSourceEditor]);
|
||||
testParamsTab2("a", "b", "?foo=bar", "text");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
|
@ -85,7 +83,7 @@ add_task(function* () {
|
|||
|
||||
ok(tabpanel.querySelector(".treeTable"),
|
||||
"The request params box should be displayed.");
|
||||
ok(tabpanel.querySelector(".editor-mount") === null,
|
||||
ok(tabpanel.querySelector(".CodeMirror-code") === null,
|
||||
"The request post data editor should not be displayed.");
|
||||
|
||||
let treeSections = tabpanel.querySelectorAll(".tree-section");
|
||||
|
@ -126,7 +124,7 @@ add_task(function* () {
|
|||
|
||||
ok(tabpanel.querySelector(".treeTable"),
|
||||
"The request params box should be displayed.");
|
||||
is(tabpanel.querySelector(".editor-mount") === null,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null,
|
||||
isJSON,
|
||||
"The request post data editor should be not displayed.");
|
||||
|
||||
|
@ -161,8 +159,7 @@ add_task(function* () {
|
|||
"JSON property value " + i + " should be displayed correctly");
|
||||
}
|
||||
} else {
|
||||
let editor = editorFrames[0].contentDocument.querySelector(".CodeMirror-code");
|
||||
ok(editor.textContent.includes(requestPayload),
|
||||
ok(document.querySelector(".CodeMirror-code").textContent.includes(requestPayload),
|
||||
"The text shown in the source editor is incorrect.");
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +176,7 @@ add_task(function* () {
|
|||
|
||||
ok(!tabpanel.querySelector(".treeTable"),
|
||||
"The request params box should be hidden.");
|
||||
ok(!tabpanel.querySelector(".editor-mount iframe"),
|
||||
ok(!tabpanel.querySelector(".CodeMirror-code"),
|
||||
"The request post data editor should be hidden.");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -135,25 +135,25 @@ add_task(function* () {
|
|||
}
|
||||
);
|
||||
|
||||
yield selectIndexAndWaitForEditor(0);
|
||||
yield selectIndexAndWaitForSourceEditor(0);
|
||||
yield testResponseTab("xml");
|
||||
|
||||
yield selectIndexAndWaitForEditor(1);
|
||||
yield selectIndexAndWaitForSourceEditor(1);
|
||||
yield testResponseTab("css");
|
||||
|
||||
yield selectIndexAndWaitForEditor(2);
|
||||
yield selectIndexAndWaitForSourceEditor(2);
|
||||
yield testResponseTab("js");
|
||||
|
||||
yield selectIndexAndWaitForJSONView(3);
|
||||
yield testResponseTab("json");
|
||||
|
||||
yield selectIndexAndWaitForEditor(4);
|
||||
yield selectIndexAndWaitForSourceEditor(4);
|
||||
yield testResponseTab("html");
|
||||
|
||||
yield selectIndexAndWaitForImageView(5);
|
||||
yield testResponseTab("png");
|
||||
|
||||
yield selectIndexAndWaitForEditor(6);
|
||||
yield selectIndexAndWaitForSourceEditor(6);
|
||||
yield testResponseTab("gzip");
|
||||
|
||||
yield teardown(monitor);
|
||||
|
@ -169,7 +169,7 @@ add_task(function* () {
|
|||
is(jsonView.textContent !== L10N.getStr("jsonScopeName"),
|
||||
box != "json",
|
||||
"The response json view doesn't display");
|
||||
is(tabpanel.querySelector(".editor-mount") === null,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null,
|
||||
box != "textarea",
|
||||
"The response editor doesn't display");
|
||||
is(tabpanel.querySelector(".response-image-box") === null,
|
||||
|
@ -181,8 +181,7 @@ add_task(function* () {
|
|||
case "xml": {
|
||||
checkVisibility("textarea");
|
||||
|
||||
let editor = tabpanel.querySelector(".editor-mount iframe");
|
||||
let text = editor.contentDocument .querySelector(".CodeMirror-line").textContent;
|
||||
let text = document .querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
is(text, "<label value='greeting'>Hello XML!</label>",
|
||||
"The text shown in the source editor is incorrect for the xml request.");
|
||||
|
@ -191,8 +190,7 @@ add_task(function* () {
|
|||
case "css": {
|
||||
checkVisibility("textarea");
|
||||
|
||||
let editor = tabpanel.querySelector(".editor-mount iframe");
|
||||
let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent;
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
is(text, "body:pre { content: 'Hello CSS!' }",
|
||||
"The text shown in the source editor is incorrect for the css request.");
|
||||
|
@ -201,8 +199,7 @@ add_task(function* () {
|
|||
case "js": {
|
||||
checkVisibility("textarea");
|
||||
|
||||
let editor = tabpanel.querySelector(".editor-mount iframe");
|
||||
let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent;
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
is(text, "function() { return 'Hello JS!'; }",
|
||||
"The text shown in the source editor is incorrect for the js request.");
|
||||
|
@ -234,8 +231,7 @@ add_task(function* () {
|
|||
case "html": {
|
||||
checkVisibility("textarea");
|
||||
|
||||
let editor = document.querySelector(".editor-mount iframe");
|
||||
let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent;
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
is(text, "<blink>Not Found</blink>",
|
||||
"The text shown in the source editor is incorrect for the html request.");
|
||||
|
@ -258,8 +254,7 @@ add_task(function* () {
|
|||
case "gzip": {
|
||||
checkVisibility("textarea");
|
||||
|
||||
let editor = tabpanel.querySelector(".editor-mount iframe");
|
||||
let text = editor.contentDocument.querySelector(".CodeMirror-line").textContent;
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
is(text, new Array(1000).join("Hello gzip!"),
|
||||
"The text shown in the source editor is incorrect for the gzip request.");
|
||||
|
@ -268,19 +263,18 @@ add_task(function* () {
|
|||
}
|
||||
}
|
||||
|
||||
function* selectIndexAndWaitForEditor(index) {
|
||||
let editor = document.querySelector("#response-panel .editor-mount iframe");
|
||||
function* selectIndexAndWaitForSourceEditor(index) {
|
||||
let editor = document.querySelector("#response-panel .CodeMirror-code");
|
||||
if (!editor) {
|
||||
let waitDOM = waitForDOM(document, "#response-panel .editor-mount iframe");
|
||||
gStore.dispatch(Actions.selectRequestByIndex(index));
|
||||
let waitDOM = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
document.querySelector("#response-tab").click();
|
||||
[editor] = yield waitDOM;
|
||||
yield once(editor, "DOMContentLoaded");
|
||||
yield waitDOM;
|
||||
} else {
|
||||
gStore.dispatch(Actions.selectRequestByIndex(index));
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
}
|
||||
|
||||
yield waitForDOM(editor.contentDocument, ".CodeMirror-code");
|
||||
}
|
||||
|
||||
function* selectIndexAndWaitForJSONView(index) {
|
||||
|
|
|
@ -42,17 +42,14 @@ add_task(function* () {
|
|||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
wait = waitForDOM(document, "#response-panel .editor-mount iframe");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
let [editor] = yield wait;
|
||||
yield once(editor, "DOMContentLoaded");
|
||||
yield waitForDOM(editor.contentDocument, ".CodeMirror-code");
|
||||
let text = editor.contentDocument
|
||||
.querySelector(".CodeMirror-line").textContent;
|
||||
yield wait;
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
ok(text.includes("\u0411\u0440\u0430\u0442\u0430\u043d"),
|
||||
"The text shown in the source editor is correct.");
|
||||
|
||||
yield teardown(monitor);
|
||||
return teardown(monitor);
|
||||
});
|
||||
|
|
|
@ -37,14 +37,11 @@ add_task(function* () {
|
|||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
wait = waitForDOM(document, "#response-panel .editor-mount iframe");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
let [editor] = yield wait;
|
||||
yield once(editor, "DOMContentLoaded");
|
||||
yield waitForDOM(editor.contentDocument, ".CodeMirror-code");
|
||||
let text = editor.contentDocument
|
||||
.querySelector(".CodeMirror-code").textContent;
|
||||
yield wait;
|
||||
let text = document.querySelector(".CodeMirror-lines").textContent;
|
||||
|
||||
ok(text.includes("\u0411\u0440\u0430\u0442\u0430\u043d"),
|
||||
"The text shown in the source editor is correct.");
|
||||
|
|
|
@ -37,7 +37,7 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".editor-mount iframe") === null, true,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
|
|
@ -67,7 +67,7 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".editor-mount iframe") === null, true,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
|
|
@ -40,14 +40,12 @@ add_task(function* () {
|
|||
fullMimeType: "text/json; charset=utf-8"
|
||||
});
|
||||
|
||||
wait = waitForDOM(document, "#response-panel .editor-mount iframe");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
let [editor] = yield wait;
|
||||
yield once(editor, "DOMContentLoaded");
|
||||
yield waitForDOM(editor.contentDocument, ".CodeMirror-code");
|
||||
yield wait;
|
||||
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
is(tabpanel.querySelector(".response-error-header") === null, false,
|
||||
|
@ -63,16 +61,13 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), false,
|
||||
"The response json view doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".editor-mount iframe") === null, false,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
// Strip CodeMirror line number through slice(1)
|
||||
let text = editor.contentDocument
|
||||
.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
is(text, "{ \"greeting\": \"Hello malformed JSON!\" },",
|
||||
is(document.querySelector(".CodeMirror-line").textContent,
|
||||
"{ \"greeting\": \"Hello malformed JSON!\" },",
|
||||
"The text shown in the source editor is incorrect.");
|
||||
|
||||
yield teardown(monitor);
|
||||
|
|
|
@ -55,7 +55,7 @@ add_task(function* () {
|
|||
let jsonView = panel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(panel.querySelector(".editor-mount iframe") === null, true,
|
||||
is(panel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(panel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
|
|
@ -61,7 +61,7 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".editor-mount iframe") === null, true,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
|
|
@ -62,7 +62,7 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".editor-mount iframe") === null, true,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
|
|
@ -83,7 +83,7 @@ add_task(function* () {
|
|||
is(tabpanel.querySelector(".tree-section .treeLabel").textContent,
|
||||
L10N.getFormatStr("jsonpScopeName", func),
|
||||
"The response json view has the intened visibility and correct title.");
|
||||
is(tabpanel.querySelector(".editor-mount iframe") === null, true,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".responseImageBox") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
|
|
@ -43,17 +43,14 @@ add_task(function* () {
|
|||
statusText: "OK"
|
||||
});
|
||||
|
||||
let waitDOM = waitForDOM(document, "#response-panel .editor-mount iframe");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
let [editor] = yield waitDOM;
|
||||
yield once(editor, "DOMContentLoaded");
|
||||
yield waitForDOM(editor.contentDocument, ".CodeMirror-code");
|
||||
yield wait;
|
||||
|
||||
let text = editor.contentDocument
|
||||
.querySelector(".CodeMirror-line").textContent;
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
ok(text.match(/^<p>/), "The text shown in the source editor is incorrect.");
|
||||
|
||||
|
|
|
@ -73,12 +73,10 @@ add_task(function* () {
|
|||
|
||||
// Wait for all tree sections and editor updated by react
|
||||
let waitForSections = waitForDOM(document, "#params-panel .tree-section", 2);
|
||||
let waitForEditor = waitForDOM(document, "#params-panel .editor-mount iframe");
|
||||
let waitForSourceEditor = waitForDOM(document, "#params-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
let [, editorFrames] = yield Promise.all([waitForSections, waitForEditor]);
|
||||
yield once(editorFrames[0], "DOMContentLoaded");
|
||||
yield waitForDOM(editorFrames[0].contentDocument, ".CodeMirror-code");
|
||||
yield Promise.all([waitForSections, waitForSourceEditor]);
|
||||
yield testParamsTab("multipart");
|
||||
|
||||
return teardown(monitor);
|
||||
|
@ -89,7 +87,7 @@ add_task(function* () {
|
|||
function checkVisibility(box) {
|
||||
is(!tabpanel.querySelector(".treeTable"), !box.includes("params"),
|
||||
"The request params doesn't have the indended visibility.");
|
||||
is(tabpanel.querySelector(".editor-mount") === null,
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null,
|
||||
!box.includes("editor"),
|
||||
"The request post data doesn't have the indended visibility.");
|
||||
}
|
||||
|
@ -133,8 +131,7 @@ add_task(function* () {
|
|||
|
||||
is(labels.length, 3, "There should be 3 param values displayed in this tabpanel.");
|
||||
|
||||
let text = editorFrames[0].contentDocument.querySelector(".CodeMirror-code")
|
||||
.textContent;
|
||||
let text = document.querySelector(".CodeMirror-code").textContent;
|
||||
|
||||
ok(text.includes("Content-Disposition: form-data; name=\"text\""),
|
||||
"The text shown in the source editor is incorrect (1.1).");
|
||||
|
|
|
@ -57,39 +57,32 @@ add_task(function* () {
|
|||
|
||||
gStore.dispatch(Actions.selectRequest(null));
|
||||
|
||||
yield selectIndexAndWaitForEditor(0);
|
||||
yield selectIndexAndWaitForSourceEditor(0);
|
||||
// the hls-m3u8 part
|
||||
testEditorContent(REQUESTS[0]);
|
||||
|
||||
yield selectIndexAndWaitForEditor(1);
|
||||
yield selectIndexAndWaitForSourceEditor(1);
|
||||
// the mpeg-dash part
|
||||
testEditorContent(REQUESTS[1]);
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
function* selectIndexAndWaitForEditor(index) {
|
||||
let editor = document.querySelector("#response-panel .editor-mount iframe");
|
||||
function* selectIndexAndWaitForSourceEditor(index) {
|
||||
let editor = document.querySelector("#response-panel .CodeMirror-code");
|
||||
if (!editor) {
|
||||
let waitDOM = waitForDOM(document, "#response-panel .editor-mount iframe");
|
||||
let waitDOM = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
document.querySelector("#response-tab").click();
|
||||
[editor] = yield waitDOM;
|
||||
yield once(editor, "DOMContentLoaded");
|
||||
yield waitDOM;
|
||||
} else {
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
}
|
||||
|
||||
yield waitForDOM(editor.contentDocument, ".CodeMirror-code");
|
||||
}
|
||||
|
||||
function testEditorContent([ fmt, textRe ]) {
|
||||
let editor = document.querySelector("#response-panel .editor-mount iframe");
|
||||
let text = editor.contentDocument
|
||||
.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
ok(text.match(textRe),
|
||||
ok(document.querySelector(".CodeMirror-line").textContent.match(textRe),
|
||||
"The text shown in the source editor for " + fmt + " is correct.");
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче