Bug 1764717 - Part 5: Use type-specific findMessage(s) in devtools/client/webconsole/test/browser/browser_jsterm_*. r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D147025
This commit is contained in:
Tooru Fujisawa 2022-05-24 10:05:59 +00:00
Родитель 1a8bd8c676
Коммит 9ef63471c0
10 изменённых файлов: 22 добавлений и 20 удалений

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

@ -23,7 +23,7 @@ add_task(async function() {
is(getInputValue(hud), '"first item"', "null test history down");
EventUtils.synthesizeKey("KEY_Enter");
await waitFor(() => findMessage(hud, "first item", ".result"));
await waitFor(() => findEvaluationResultMessage(hud, "first item"));
is(getInputValue(hud), "", "cleared input line after submit");
setInputValue(hud, '"editing input 1"');
@ -38,7 +38,7 @@ add_task(async function() {
setInputValue(hud, '"second item"');
EventUtils.synthesizeKey("KEY_Enter");
await waitFor(() => findMessage(hud, "second item", ".result"));
await waitFor(() => findEvaluationResultMessage(hud, "second item"));
setInputValue(hud, '"editing input 2"');
EventUtils.synthesizeKey("KEY_ArrowUp");
@ -59,11 +59,15 @@ add_task(async function() {
// is properly trimmed.
setInputValue(hud, '"second item"');
EventUtils.synthesizeKey("KEY_Enter");
await waitFor(() => findMessages(hud, "second item", ".result").length == 2);
await waitFor(
() => findEvaluationResultMessages(hud, "second item").length == 2
);
setInputValue(hud, '"second item" ');
EventUtils.synthesizeKey("KEY_Enter");
await waitFor(() => findMessages(hud, "second item", ".result").length == 3);
await waitFor(
() => findEvaluationResultMessages(hud, "second item").length == 3
);
EventUtils.synthesizeKey("KEY_ArrowUp");
is(

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

@ -84,6 +84,6 @@ add_task(async function() {
EventUtils.sendString("length");
EventUtils.synthesizeKey("KEY_Enter");
await waitFor(() => !isConfirmDialogOpened(toolbox));
await waitFor(() => findMessage(hud, "3", ".result"));
await waitFor(() => findEvaluationResultMessage(hud, "3"));
ok("Expression was evaluated and tooltip was closed");
});

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

@ -54,9 +54,7 @@ add_task(async function() {
is(popup.isOpen, false, "popup is closed");
info(`Check that no error was logged`);
await waitFor(() =>
findMessage(hud, "", ".message.error:not(.network)")
).then(
await waitFor(() => findErrorMessage(hud, "", ":not(.network)")).then(
message => {
ok(false, `Got error ${JSON.stringify(message.textContent)}`);
},

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

@ -29,7 +29,7 @@ add_task(async function() {
executeButton.click();
await waitFor(
() => findMessages(hud, "foo", ".result").length === 3,
() => findEvaluationResultMessages(hud, "foo").length === 3,
"Waiting for all results to be printed in console",
1000
);

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

@ -56,7 +56,7 @@ add_task(async function() {
await resume(dbg);
info("Wait for the paused expression result to be displayed");
await waitFor(() => findMessage(hud, "pauseExpression-res", ".result"));
await waitFor(() => findEvaluationResultMessage(hud, "pauseExpression-res"));
await onAwaitResultMessage;
const messages = hud.ui.outputNode.querySelectorAll(

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

@ -16,13 +16,13 @@ add_task(async function() {
info("Before blocking");
await tryFetching();
const resp1 = await waitFor(() => findMessage(hud, "successful"));
const resp1 = await waitFor(() => findConsoleAPIMessage(hud, "successful"));
ok(resp1, "the request was not blocked");
info(`Execute the :block command and try to do execute a network request`);
await executeAndWaitForMessage(hud, blockCommand, "are now blocked");
await tryFetching();
const resp2 = await waitFor(() => findMessage(hud, "blocked"));
const resp2 = await waitFor(() => findConsoleAPIMessage(hud, "blocked"));
ok(resp2, "the request was blocked as expected");
info("Open netmonitor check the blocked filter is registered in its state");
@ -57,7 +57,7 @@ add_task(async function() {
await tryFetching();
const resp3 = await waitFor(() => findMessage(hud, "successful"));
const resp3 = await waitFor(() => findConsoleAPIMessage(hud, "successful"));
ok(resp3, "the request was not blocked");
});

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

@ -68,7 +68,7 @@ add_task(async function() {
onHighlighterHidden = highlighter.waitForHighlighterHidden();
EventUtils.synthesizeKey("KEY_Enter");
await waitFor(() => findMessage(hud, `#text "mydivtext"`, ".result"));
await waitFor(() => findEvaluationResultMessage(hud, `#text "mydivtext"`));
await waitForNoEagerEvaluationResult(hud);
isVisible = await highlighterTestFront.isHighlighting();
is(isVisible, false, "Highlighter is closed after evaluating the expression");

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

@ -14,13 +14,13 @@ add_task(async function() {
info("Wait for a bit so a warning message could be displayed");
await wait(2000);
is(
findMessage(hud, "getElementById", ".warn"),
findWarningMessage(hud, "getElementById"),
undefined,
"The eager evaluation did not triggered a warning message"
);
info("Sanity check for the warning message when the expression is evaluated");
EventUtils.synthesizeKey("KEY_Enter");
await waitFor(() => findMessage(hud, "getElementById", ".warn"));
await waitFor(() => findWarningMessage(hud, "getElementById"));
ok(true, "Evaluation of the expression does trigger the warning message");
});

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

@ -74,10 +74,10 @@ async function performEditorDisabledTests() {
// execute the 2nd expression which should have been entered but not executed
EventUtils.sendKey("return");
let msg = await waitFor(() => findMessage(hud, "10"));
let msg = await waitFor(() => findEvaluationResultMessage(hud, "10"));
ok(msg, "found evaluation result of 1st expression");
msg = await waitFor(() => findMessage(hud, "11"));
msg = await waitFor(() => findEvaluationResultMessage(hud, "11"));
ok(msg, "found evaluation result of 2nd expression");
is(getInputValue(hud), "", "input line is cleared after execution");

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

@ -51,8 +51,8 @@ add_task(async function() {
// Setting the input value.
setInputValue(hud, input);
runButton.click();
await waitFor(() => findMessage(hud, input));
await waitFor(() => findMessage(hud, output, ".message.result"));
await waitFor(() => findMessageByType(hud, input, ".command"));
await waitFor(() => findEvaluationResultMessage(hud, output));
ok(true, "The expression and its result are displayed in the output");
ok(
isInputFocused(hud),