Bug 1522760: Modify a test to confirm whether the name of sidebar item was updated. r=jdescottes
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Fri, 01 Mar 2019 00:52:32 +0000
changeset 519722 39ceb46c4c4506a846965fe03240cc854b696617
parent 519721 fc03a8b4a47b443c7839386382fb30a5fa8203a1
child 519723 62d4e16fbb2b655a82418553929c9883279273a5
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1522760
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1522760: Modify a test to confirm whether the name of sidebar item was updated. r=jdescottes Depends on D21182 Differential Revision: https://phabricator.services.mozilla.com/D21491
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_connect.js
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_connect.js
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_connect.js
@@ -1,36 +1,46 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const RUNTIME_ID = "test-runtime-id";
+const RUNTIME_NAME = "test runtime name";
 const RUNTIME_DEVICE_NAME = "test device name";
+const RUNTIME_SHORT_NAME = "test short name";
 
 // Test that USB runtimes appear and disappear from the sidebar,
 // as well as their connect button.
+// Also checks whether the label of item is updated after connecting.
 add_task(async function() {
   const mocks = new Mocks();
 
   const { document, tab } = await openAboutDebugging();
 
-  mocks.createUSBRuntime(RUNTIME_ID, { deviceName: RUNTIME_DEVICE_NAME });
+  mocks.createUSBRuntime(RUNTIME_ID, {
+    name: RUNTIME_NAME,
+    deviceName: RUNTIME_DEVICE_NAME,
+    shortName: RUNTIME_SHORT_NAME,
+  });
   mocks.emitUSBUpdate();
 
   info("Wait until the USB sidebar item appears");
   await waitUntil(() => findSidebarItemByText(RUNTIME_DEVICE_NAME, document));
   const usbRuntimeSidebarItem = findSidebarItemByText(RUNTIME_DEVICE_NAME, document);
   const connectButton = usbRuntimeSidebarItem.querySelector(".js-connect-button");
   ok(connectButton, "Connect button is displayed for the USB runtime");
 
   info("Click on the connect button and wait until it disappears");
   connectButton.click();
   await waitUntil(() => !usbRuntimeSidebarItem.querySelector(".js-connect-button"));
 
+  info("Check whether the label of item is updated after connecting");
+  ok(usbRuntimeSidebarItem.textContent.startsWith(RUNTIME_NAME), "Label of item updated");
+
   info("Remove all USB runtimes");
   mocks.removeUSBRuntime(RUNTIME_ID);
   mocks.emitUSBUpdate();
 
   info("Wait until the USB sidebar item disappears");
   await waitUntil(() => !findSidebarItemByText(RUNTIME_DEVICE_NAME, document));
 
   await removeTab(tab);