Bug 1465717 - Missing test for opening links when devtools are in a separate window. r=jdescottes
MozReview-Commit-ID: 2yK63fjjXvs
--- a/devtools/client/application/src/components/WorkerListEmpty.js
+++ b/devtools/client/application/src/components/WorkerListEmpty.js
@@ -66,17 +66,19 @@ class WorkerListEmpty extends Component
Localized({
id: "serviceworker-empty-suggestions-debugger",
a: a({ className: "link", onClick: () => this.switchToDebugger() })
},
li({ className: "worker-list-empty__tips__item" })
),
Localized({
id: "serviceworker-empty-suggestions-aboutdebugging",
- a: a({ className: "link", onClick: () => this.openAboutDebugging() })
+ a: a({
+ className: "link js-trusted-link",
+ onClick: () => this.openAboutDebugging() })
},
li({ className: "worker-list-empty__tips__item" })
),
)
);
}
}
--- a/devtools/client/application/test/browser.ini
+++ b/devtools/client/application/test/browser.ini
@@ -16,8 +16,9 @@ support-files =
!/devtools/client/shared/test/shared-head.js
!/devtools/client/shared/test/telemetry-test-helpers.js
[browser_application_panel_debug-service-worker.js]
[browser_application_panel_list-domain-workers.js]
[browser_application_panel_list-several-workers.js]
[browser_application_panel_list-single-worker.js]
[browser_application_panel_list-unicode.js]
+[browser_application_panel_open-links.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/application/test/browser_application_panel_open-links.js
@@ -0,0 +1,41 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const { Toolbox } = require("devtools/client/framework/toolbox");
+
+/**
+ * Check that links work when the devtools are detached in a separate window.
+ */
+
+const TAB_URL = URL_ROOT + "service-workers/empty.html";
+
+add_task(async function() {
+ await enableApplicationPanel();
+
+ const {
+ panel,
+ toolbox
+ } = await openNewTabAndApplicationPanel(TAB_URL);
+
+ const doc = panel.panelWin.document;
+
+ // detach devtools in a separate window
+ await toolbox.switchHost(Toolbox.HostType.WINDOW);
+
+ // click on the link and wait for the new tab to open
+ const onTabLoaded = BrowserTestUtils
+ .waitForNewTab(gBrowser, "about:debugging#workers");
+ doc.querySelector(".js-trusted-link").click();
+ info("Opening link in a new tab.");
+ const newTab = await onTabLoaded;
+
+ // We only need to check that newTab is truthy since
+ // BrowserTestUtils.waitForNewTab checks the URL.
+ ok(newTab, "The expected tab was opened.");
+
+ // close the tab
+ info("Closing the tab.");
+ await BrowserTestUtils.removeTab(newTab);
+});