Bug 1212074 - Update Mochitests for Loop now that the tabs are removed from the panel. r=mikedeboer

This commit is contained in:
Mark Banner 2015-10-08 11:30:06 +01:00
parent 8535018d0c
commit 854323ec89
3 changed files with 0 additions and 87 deletions

View File

@ -32,45 +32,13 @@ registerCleanupFunction(function*() {
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:not(.slide-bar)");
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:not(.slide-bar)");
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");
// Hide the panel.
yield LoopUI.togglePanel();
// Logout to prevent interfering with the tests after this one.
MozLoopServiceInternal.fxAOAuthTokenData =
MozLoopServiceInternal.fxAOAuthProfile = null;
yield MozLoopServiceInternal.notifyStatusChanged();
});
add_task(function* test_doNotDisturb() {

View File

@ -161,9 +161,6 @@ this.UITour = {
infoPanelPosition: "leftcenter topright",
query: (aDocument) => {
let loopUI = aDocument.defaultView.LoopUI;
if (loopUI.selectedTab != "rooms") {
return null;
}
// Use the parentElement full-width container of the button so our arrow
// doesn't overlap the panel contents much.
return loopUI.browser.contentDocument.querySelector(".new-room-button").parentElement;
@ -173,9 +170,6 @@ this.UITour = {
infoPanelPosition: "leftcenter topright",
query: (aDocument) => {
let loopUI = aDocument.defaultView.LoopUI;
if (loopUI.selectedTab != "rooms") {
return null;
}
return loopUI.browser.contentDocument.querySelector(".room-list");
},
}],

View File

@ -184,55 +184,6 @@ var tests = [
});
});
},
taskify(function* test_panelTabChangeNotifications() {
// First make sure the Loop panel looks like we're logged in to have more than
// just one tab to switch to.
const fxASampleToken = {
token_type: "bearer",
access_token: "1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1752",
scope: "profile"
};
const fxASampleProfile = {
email: "test@example.com",
uid: "abcd1234"
};
MozLoopServiceInternal.fxAOAuthTokenData = fxASampleToken;
MozLoopServiceInternal.fxAOAuthProfile = fxASampleProfile;
Services.prefs.setCharPref("loop.key.fxa", "fake");
yield MozLoopServiceInternal.notifyStatusChanged("login");
// Show the Loop menu.
yield showMenuPromise("loop");
// Listen for and test the notifications that will arrive from now on.
let tabChangePromise = new Promise(resolve => {
gContentAPI.observe((event, params) => {
is(event, "Loop:PanelTabChanged", "Check Loop:PanelTabChanged notification");
is(params, "contacts", "Check the tab name param");
gContentAPI.observe((event, params) => {
is(event, "Loop:PanelTabChanged", "Check Loop:PanelTabChanged notification");
is(params, "rooms", "Check the tab name param");
gContentAPI.observe((event, params) => {
ok(false, "No more notifications should have arrived");
});
resolve();
});
});
});
// Switch to the contacts tab.
yield window.LoopUI.openCallPanel(null, "contacts");
// Logout. The panel tab will switch back to 'rooms'.
MozLoopServiceInternal.fxAOAuthTokenData =
MozLoopServiceInternal.fxAOAuthProfile = null;
Services.prefs.clearUserPref("loop.key.fxa");
yield MozLoopServiceInternal.notifyStatusChanged();
yield tabChangePromise;
}),
runOffline(function test_notifyLoopChatWindowOpenedClosed(done) {
gContentAPI.observe((event, params) => {
is(event, "Loop:ChatWindowOpened", "Check Loop:ChatWindowOpened notification");