summaryrefslogtreecommitdiffstats
path: root/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js')
-rw-r--r--devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js
new file mode 100644
index 0000000000..e7cae28d29
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js
@@ -0,0 +1,65 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const USB_RUNTIME_ID = "1337id";
+const USB_DEVICE_NAME = "Fancy Phone";
+const USB_APP_NAME = "Lorem ipsum";
+
+const DEFAULT_PAGE = "#/runtime/this-firefox";
+
+/**
+ * Check if the disconnect button disconnects the remote runtime
+ * and redirects to the default page.
+ */
+add_task(async function () {
+ // Create a real local client and use it as the remote USB client for this
+ // test.
+ const clientWrapper = await createLocalClientWrapper();
+
+ // enable USB devices mocks
+ const mocks = new Mocks();
+ mocks.createUSBRuntime(USB_RUNTIME_ID, {
+ clientWrapper,
+ deviceName: USB_DEVICE_NAME,
+ name: USB_APP_NAME,
+ });
+
+ const { document, tab, window } = await openAboutDebugging();
+ await selectThisFirefoxPage(document, window.AboutDebugging.store);
+
+ mocks.emitUSBUpdate();
+
+ const onRequestSuccess = waitForRequestsSuccess(window.AboutDebugging.store);
+ await connectToRuntime(USB_DEVICE_NAME, document);
+ await selectRuntime(USB_DEVICE_NAME, USB_APP_NAME, document);
+ await onRequestSuccess;
+
+ const disconnectRemoteRuntimeButton = document.querySelector(
+ ".qa-runtime-info__action"
+ );
+
+ info("Check whether disconnect remote runtime button exists");
+ ok(!!disconnectRemoteRuntimeButton, "Runtime contains the disconnect button");
+
+ info("Click on the disconnect button");
+ disconnectRemoteRuntimeButton.click();
+
+ info("Wait until the runtime is disconnected");
+ await waitUntil(() => document.querySelector(".qa-connect-button"));
+
+ is(
+ document.location.hash,
+ DEFAULT_PAGE,
+ "Redirection to the default page (this-firefox)"
+ );
+
+ info("Wait until the Runtime name is displayed");
+ await waitUntil(() => {
+ const runtimeInfo = document.querySelector(".qa-runtime-name");
+ return runtimeInfo && runtimeInfo.textContent.includes("Firefox");
+ });
+
+ await removeTab(tab);
+});