The integration tests are async functions that drive the debugger in two contexts: firefox and the web.
Firefox the tests are run in the panel with mochitest. Web the tests are run in an iframe with mocha.
Open localhost:8000/integration
Tips:
- You can select tests to run or skip in the
runner.js
by replacingit
withit.only
andxit
.
The tests communicate with firefox over a websocket like the launchpad, so it's important firefox is running.
One easy thing to do to start firefox, is click the "launch Firefox" button in the launchpad app.
Because the tests communicate over the same websocket connection as the launchpad, it's important that the other debugger windows are closed. Keeping them open means that some of the messages could be dropped!
- Helpers for writing: commands, assertions, and waiting on asynchronous actions.
- Utilities for typing and clicking
- Environment specific utilities mocha.js mochitest.js
- Assertions:
ok
,is
- HTML Examples are here
Example:
async function test2(ctx) {
const { ok, is, info } = ctx;
// open the debugger and navigate the debuggee to `doc-frames.html`
const dbg = await initDebugger("doc-frames.html");
toggleCallStack(dbg);
// pause inside of startRecursion so that we can test a large call stack
invokeInTab(dbg, "startRecursion");
await waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "recurseA"), "the first frame is selected");
}
There are couple of things to do when adding a new test:
- create a new test file
- add the test to the
tests/index
- add the test to web
[runner]
- add the test mochitests
- add the test to browser.ini
diff --git a/src/test/integration/tests/expression.js b/src/test/integration/tests/expression.js
new file mode 100644
index 0000000..6d8d069
--- /dev/null
+++ b/src/test/integration/tests/expression.js
@@ -0,0 +1,14 @@
+const {
+ initDebugger,
+ assertPausedLocation,
+ findSource,
+ addBreakpoint
+} = require("../utils")
+
+// tests the watch expressions component
+
+module.exports = async function(ctx) {
+ const { ok, is, info, requestLongerTimeout } = ctx;
+ const dbg = await initDebugger("doc-scripts.html");
+ await waitForPaused(dbg);
+});
diff --git a/src/test/integration/tests/index.js b/src/test/integration/tests/index.js
index d07089d..f0b699b 100644
--- a/src/test/integration/tests/index.js
+++ b/src/test/integration/tests/index.js
@@ -3,6 +3,7 @@ module.exports = {
breaking: require("./breaking"),
breakpoints: require("./breakpoints"),
breakpointsCond: require("./breakpoints-cond"),
+ expressions: require("./expressions"),
callStack: require("./call-stack"),
debuggerButtons: require("./debugger-buttons"),
diff --git a/src/test/integration/runner.js b/src/test/integration/runner.js
index 2a2a329..63c7d24 100644
--- a/src/test/integration/runner.js
+++ b/src/test/integration/runner.js
@@ -9,6 +9,7 @@ const {
breakpoints,
breakpointsCond,
callStack,
+ expressions,
debuggerButtons,
editorSelect,
editorGutter,
@@ -92,6 +93,10 @@ describe("Tests", () => {
await editorHighlight(ctx);
});
+ it("expressions", async function() {
+ await expressions(ctx);
+ });
+
diff --git a/src/test/mochitest/browser_dbg-expression.js b/src/test/mochitest/browser_dbg-expression.js
new file mode 100644
index 0000000..43dd018
--- /dev/null
+++ b/src/test/mochitest/browser_dbg-expression.js
@@ -0,0 +1,12 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const {
+ setupTestRunner,
+ expressions
+} = require("devtools/client/debugger/new/integration-tests");
+
+add_task(function*() {
+ setupTestRunner(this);
+ yield expressions(this);
+});
diff --git a/src/test/mochitest/browser.ini b/src/test/mochitest/browser.ini
index 108a3da..d059634 100644
--- a/src/test/mochitest/browser.ini
+++ b/src/test/mochitest/browser.ini
@@ -46,6 +46,7 @@ skip-if = true
[browser_dbg-breakpoints.js]
[browser_dbg-breakpoints-cond.js]
[browser_dbg-call-stack.js]
+[browser_dbg-expressions.js]
[browser_dbg-scopes.js]
[browser_dbg-chrome-create.js]