Bug 1137141 - Extend Loop toolbarbutton tests to check for correct panel states upon opening. r=Standard8, a=sledru
authorMike de Boer <mdeboer@mozilla.com>
Fri, 27 Feb 2015 12:25:20 +0100
changeset 250148 824656d7ad0d
parent 250147 d5def3938b6e
child 250149 759ad062242f
push id4513
push userryanvm@gmail.com
push date2015-03-02 19:36 +0000
treeherdermozilla-beta@824656d7ad0d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, sledru
bugs1137141
milestone37.0
Bug 1137141 - Extend Loop toolbarbutton tests to check for correct panel states upon opening. r=Standard8, a=sledru
browser/components/loop/test/mochitest/browser_toolbarbutton.js
--- a/browser/components/loop/test/mochitest/browser_toolbarbutton.js
+++ b/browser/components/loop/test/mochitest/browser_toolbarbutton.js
@@ -33,26 +33,34 @@ add_task(function* test_LoopUI_getters()
   Assert.ok(LoopUI.panel, "LoopUI panel element should be set");
   Assert.strictEqual(LoopUI.browser, null, "Browser element should not be there yet");
   Assert.strictEqual(LoopUI.selectedTab, null, "No tab should be selected yet");
 
   // Load and show the Loop panel for the very first time this session.
   yield loadLoopPanel();
   Assert.ok(LoopUI.browser, "Browser element should be there");
   Assert.strictEqual(LoopUI.selectedTab, "rooms", "Initially the rooms tab should be selected");
+  let panelTabs = LoopUI.browser.contentDocument.querySelectorAll(".tab-view > li");
+  Assert.strictEqual(panelTabs.length, 1, "Only one tab, 'rooms', should be visible");
 
   // Hide the panel.
   yield LoopUI.togglePanel();
   Assert.strictEqual(LoopUI.selectedTab, "rooms", "Rooms tab should still be selected");
 
   // Make sure the contacts tab shows up by simulating a login.
   MozLoopServiceInternal.fxAOAuthTokenData = fxASampleToken;
   MozLoopServiceInternal.fxAOAuthProfile = fxASampleProfile;
   yield MozLoopServiceInternal.notifyStatusChanged("login");
 
+  yield LoopUI.togglePanel();
+  Assert.strictEqual(LoopUI.selectedTab, "rooms", "Rooms tab should still be selected");
+  panelTabs = LoopUI.browser.contentDocument.querySelectorAll(".tab-view > li");
+  Assert.strictEqual(panelTabs.length, 2, "Two tabs should be visible");
+  yield LoopUI.togglePanel();
+
   // Programmatically select the contacts tab.
   yield LoopUI.togglePanel(null, "contacts");
   Assert.strictEqual(LoopUI.selectedTab, "contacts", "Contacts tab should be selected now");
 
   // Switch back to the rooms tab.
   yield LoopUI.openCallPanel(null, "rooms");
   Assert.strictEqual(LoopUI.selectedTab, "rooms", "Rooms tab should be selected now");