Bug 1408938 - Enable and rename browser_webconsole_history.js; r=nchevobbe
MozReview-Commit-ID: GU4Z3ghCTmv
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -207,16 +207,17 @@ skip-if = true # Bug 1403188
[browser_jsterm_autocomplete_inside_text.js]
[browser_jsterm_autocomplete_nav_and_tab_key.js]
[browser_jsterm_autocomplete_return_key_no_selection.js]
[browser_jsterm_autocomplete_return_key.js]
[browser_jsterm_autocomplete-properties-with-non-alphanumeric-names.js]
[browser_jsterm_completion.js]
[browser_jsterm_copy_command.js]
[browser_jsterm_dollar.js]
+[browser_jsterm_history.js]
[browser_jsterm_history_persist.js]
[browser_jsterm_inspect.js]
[browser_jsterm_no_autocompletion_on_defined_variables.js]
[browser_jsterm_no_input_and_tab_key_pressed.js]
[browser_jsterm_no_input_change_and_tab_key_pressed.js]
[browser_jsterm_popup_close_on_tab_switch.js]
[browser_jsterm_popup.js]
[browser_jsterm_selfxss.js]
@@ -285,18 +286,16 @@ skip-if = true # Bug 1408937
skip-if = true # Bug 1404382
[browser_webconsole_filter_scroll.js]
skip-if = true # Bug 1404392
[browser_webconsole_filters.js]
[browser_webconsole_filters_persist.js]
[browser_webconsole_highlighter_console_helper.js]
skip-if = true # Bug 1404853
# old console skip-if = true # Requires direct access to content nodes
-[browser_webconsole_history.js]
-skip-if = true # Bug 1408938
[browser_webconsole_history_arrow_keys.js]
skip-if = true # Bug 1408939
[browser_webconsole_history_nav.js]
skip-if = true # Bug 1408940
[browser_webconsole_hpkp_invalid-headers.js]
skip-if = true # Bug 1405340
# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001
[browser_webconsole_hsts_invalid-headers.js]
rename from devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_history.js
rename to devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_history.js
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_history.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_history.js
@@ -2,61 +2,55 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests the console history feature accessed via the up and down arrow keys.
"use strict";
-const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
- "test/test-console.html";
-
-// Constants used for defining the direction of JSTerm input history navigation.
+const TEST_URI = "data:text/html;charset=UTF-8,test";
const HISTORY_BACK = -1;
const HISTORY_FORWARD = 1;
-
-add_task(function* () {
- yield loadTab(TEST_URI);
- let hud = yield openConsole();
- hud.jsterm.clearOutput();
+const COMMANDS = ["document", "window", "window.location"];
- let jsterm = hud.jsterm;
- let input = jsterm.inputNode;
+add_task(async function () {
+ const { jsterm } = await openNewTabAndConsole(TEST_URI);
+ const { inputNode } = jsterm;
+ jsterm.clearOutput();
- let executeList = ["document", "window", "window.location"];
-
- for (let item of executeList) {
- input.value = item;
- yield jsterm.execute();
+ for (let command of COMMANDS) {
+ info(`Executing command ${command}`);
+ jsterm.setInputValue(command);
+ await jsterm.execute();
}
- for (let x = executeList.length - 1; x != -1; x--) {
+ for (let x = COMMANDS.length - 1; x != -1; x--) {
jsterm.historyPeruse(HISTORY_BACK);
- is(input.value, executeList[x], "check history previous idx:" + x);
+ is(inputNode.value, COMMANDS[x], "check history previous idx:" + x);
}
jsterm.historyPeruse(HISTORY_BACK);
- is(input.value, executeList[0], "test that item is still index 0");
+ is(inputNode.value, COMMANDS[0], "test that item is still index 0");
jsterm.historyPeruse(HISTORY_BACK);
- is(input.value, executeList[0], "test that item is still still index 0");
+ is(inputNode.value, COMMANDS[0], "test that item is still still index 0");
- for (let i = 1; i < executeList.length; i++) {
+ for (let i = 1; i < COMMANDS.length; i++) {
jsterm.historyPeruse(HISTORY_FORWARD);
- is(input.value, executeList[i], "check history next idx:" + i);
+ is(inputNode.value, COMMANDS[i], "check history next idx:" + i);
}
jsterm.historyPeruse(HISTORY_FORWARD);
- is(input.value, "", "check input is empty again");
+ is(inputNode.value, "", "check input is empty again");
// Simulate pressing Arrow_Down a few times and then if Arrow_Up shows
// the previous item from history again.
jsterm.historyPeruse(HISTORY_FORWARD);
jsterm.historyPeruse(HISTORY_FORWARD);
jsterm.historyPeruse(HISTORY_FORWARD);
- is(input.value, "", "check input is still empty");
+ is(inputNode.value, "", "check input is still empty");
- let idxLast = executeList.length - 1;
+ let idxLast = COMMANDS.length - 1;
jsterm.historyPeruse(HISTORY_BACK);
- is(input.value, executeList[idxLast], "check history next idx:" + idxLast);
+ is(inputNode.value, COMMANDS[idxLast], "check history next idx:" + idxLast);
});