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
57
58
59
60
61
62
63
64
65
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const RUNTIME_NAME = "Firefox 123";
const DEVICE_NAME = "DEVICE_NAME";
const DEVICE_ID = "DEVICE_ID";
const RUNTIME_ID = "RUNTIME_ID";
// Test that unavailable runtimes:
// - are displayed without a connect button.
// - cannot be selected
// - display a specific text ("Waiting for runtime") instead of the runtime name
add_task(async function () {
const mocks = new Mocks();
const { document, tab } = await openAboutDebugging();
info("Create a device without a corresponding runtime");
mocks.addDevice(DEVICE_ID, DEVICE_NAME);
mocks.emitUSBUpdate();
info("Wait until the USB sidebar item appears");
await waitUntil(() => findSidebarItemByText(DEVICE_NAME, document));
const usbRuntimeSidebarItem = findSidebarItemByText(DEVICE_NAME, document);
ok(
usbRuntimeSidebarItem.querySelector(".qa-runtime-item-waiting-for-browser"),
"Sidebar item shows as `Waiting for browser`"
);
const hasConnectButton =
usbRuntimeSidebarItem.querySelector(".qa-connect-button");
ok(!hasConnectButton, "Connect button is not displayed");
const hasLink = usbRuntimeSidebarItem.querySelector(".qa-sidebar-link");
ok(!hasLink, "Unavailable runtime is not selectable");
info("Add a valid runtime for the same device id and emit update event");
mocks.createUSBRuntime(RUNTIME_ID, {
deviceId: DEVICE_ID,
deviceName: DEVICE_NAME,
shortName: RUNTIME_NAME,
});
mocks.removeDevice(DEVICE_ID);
mocks.emitUSBUpdate();
info("Wait until connect button appears for the USB runtime");
let updatedSidebarItem = null;
await waitUntil(() => {
updatedSidebarItem = findSidebarItemByText(DEVICE_NAME, document);
return (
updatedSidebarItem &&
updatedSidebarItem.querySelector(".qa-connect-button")
);
});
ok(
updatedSidebarItem.querySelector(".qa-runtime-item-standard"),
"Sidebar item for the USB runtime is now a standard sidebar item"
);
await removeTab(tab);
});
|