Bug 1460737 - Wait for tab-switch to finish before executing checks. r?jaws draft fix_check_failure
authorlayely <ablayelyfondou@gmail.com>
Mon, 14 May 2018 19:20:31 +0000
branchfix_check_failure
changeset 794920 1476f11b5c546a84223a1aec15e0e91cf2c13534
parent 794135 21f09d7e7214eaebf1e0980494159bd846e1bdd9
push id109821
push userbmo:ablayelyfondou@gmail.com
push dateMon, 14 May 2018 20:04:22 +0000
reviewersjaws
bugs1460737
milestone62.0a1
Bug 1460737 - Wait for tab-switch to finish before executing checks. r?jaws MozReview-Commit-ID: KRJZdKmzViG
browser/base/content/test/tabs/browser_multiselect_tabs_using_Ctrl.js
--- a/browser/base/content/test/tabs/browser_multiselect_tabs_using_Ctrl.js
+++ b/browser/base/content/test/tabs/browser_multiselect_tabs_using_Ctrl.js
@@ -17,17 +17,20 @@ async function addTab() {
 }
 
 add_task(async function clickWithoutPrefSet() {
   let tab = await addTab();
   let mSelectedTabs = gBrowser._multiSelectedTabsMap;
 
   isnot(gBrowser.selectedTab, tab, "Tab doesn't have focus");
 
-  await triggerClickOn(tab, { ctrlKey: true });
+  // We make sure that the tab-switch is completely done before executing checks
+  await BrowserTestUtils.switchTab(gBrowser, () => {
+    triggerClickOn(tab, { ctrlKey: true });
+  });
 
   ok(!tab.multiselected && !mSelectedTabs.has(tab),
     "Multi-select tab doesn't work when multi-select pref is not set");
   is(gBrowser.selectedTab, tab,
     "Tab has focus, selected tab has changed after Ctrl/Cmd + click");
 
   BrowserTestUtils.removeTab(tab);
 });