browser_aboutdebugging_sidebar_usb_runtime_select.js (1306B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const RUNTIME_DEVICE_ID = "1234"; 7 const RUNTIME_DEVICE_NAME = "A device"; 8 9 // Test that we can select a runtime in the sidebar 10 add_task(async function () { 11 const mocks = new Mocks(); 12 13 const { document, tab } = await openAboutDebugging(); 14 15 mocks.createUSBRuntime(RUNTIME_DEVICE_ID, { 16 deviceName: RUNTIME_DEVICE_NAME, 17 }); 18 mocks.emitUSBUpdate(); 19 20 info("Wait until the USB sidebar item appears"); 21 await waitUntil(() => findSidebarItemByText(RUNTIME_DEVICE_NAME, document)); 22 const sidebarItem = findSidebarItemByText(RUNTIME_DEVICE_NAME, document); 23 const connectButton = sidebarItem.querySelector(".qa-connect-button"); 24 ok(connectButton, "Connect button is displayed for the USB runtime"); 25 26 info( 27 "Click on the connect button and wait until the sidebar displays a link" 28 ); 29 connectButton.click(); 30 await waitUntil(() => 31 findSidebarItemLinkByText(RUNTIME_DEVICE_NAME, document) 32 ); 33 34 info("Click on the runtime link"); 35 const link = findSidebarItemLinkByText(RUNTIME_DEVICE_NAME, document); 36 link.click(); 37 is( 38 document.location.hash, 39 `#/runtime/${RUNTIME_DEVICE_ID}`, 40 "Redirection to runtime page" 41 ); 42 43 await removeTab(tab); 44 });