summaryrefslogtreecommitdiffstats
path: root/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_runtime_remote_runtime_buttons.js
blob: 563fe659ce96178bf56095041814c3b11590892d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* 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";

/**
 * Test that remote runtimes show action buttons that are hidden for 'This Firefox'.
 */
add_task(async function () {
  // enable USB devices mocks
  const mocks = new Mocks();
  mocks.createUSBRuntime(USB_RUNTIME_ID, {
    deviceName: USB_DEVICE_NAME,
    name: USB_APP_NAME,
  });

  const { document, tab, window } = await openAboutDebugging();
  await selectThisFirefoxPage(document, window.AboutDebugging.store);

  info("Checking This Firefox");
  ok(
    !document.querySelector(".qa-connection-prompt-toggle-button"),
    "This Firefox does not contain the connection prompt button"
  );
  ok(
    !document.querySelector(".qa-profile-runtime-button"),
    "This Firefox does not contain the profile runtime button"
  );
  ok(
    !document.querySelector(".qa-runtime-info__action"),
    "This Firefox does not contain the disconnect button"
  );

  info("Checking a USB runtime");
  mocks.emitUSBUpdate();
  await connectToRuntime(USB_DEVICE_NAME, document);
  await selectRuntime(USB_DEVICE_NAME, USB_APP_NAME, document);
  ok(
    !!document.querySelector(".qa-connection-prompt-toggle-button"),
    "Runtime contains the connection prompt button"
  );
  ok(
    !!document.querySelector(".qa-profile-runtime-button"),
    "Remote runtime contains the profile runtime button"
  );
  ok(
    !!document.querySelector(".qa-runtime-info__action"),
    "Runtime contains the disconnect button"
  );

  await removeTab(tab);
});