Bug 1501877 - Remove errant .only() from about:studies tests. r=Gijs
☠☠ backed out by d08c28ed42f1 ☠ ☠
authorMichael Cooper <mcooper@mozilla.com>
Thu, 25 Oct 2018 16:14:38 +0000
changeset 491358 ae8cdf156f9a61151a9bbcec47b9c6f5a4a05f33
parent 491357 f5a40dea590259a0ac9bb2c79190f8245b16b6eb
child 491359 f0ed99b29aafb5fd7f613a000634b53927af4259
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersGijs
bugs1501877
milestone65.0a1
Bug 1501877 - Remove errant .only() from about:studies tests. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D9737
toolkit/components/normandy/content/about-studies/about-studies.js
toolkit/components/normandy/test/browser/browser_about_studies.js
--- a/toolkit/components/normandy/content/about-studies/about-studies.js
+++ b/toolkit/components/normandy/content/about-studies/about-studies.js
@@ -145,25 +145,25 @@ class StudyList extends React.Component 
     }
 
     activeStudies.sort((a, b) => b.sortDate - a.sortDate);
     inactiveStudies.sort((a, b) => b.sortDate - a.sortDate);
 
     return (
       r("div", {},
         r("h2", {}, translations.activeStudiesList),
-        r("ul", { className: "study-list" },
+        r("ul", { className: "study-list active-study-list" },
           activeStudies.map(study => (
             study.type === "addon"
             ? r(AddonStudyListItem, { key: study.name, study, translations })
             : r(PreferenceStudyListItem, { key: study.name, study, translations })
           )),
         ),
         r("h2", {}, translations.completedStudiesList),
-        r("ul", { className: "study-list" },
+        r("ul", { className: "study-list inactive-study-list" },
           inactiveStudies.map(study => (
             study.type === "addon"
             ? r(AddonStudyListItem, { key: study.name, study, translations })
             : r(PreferenceStudyListItem, { key: study.name, study, translations })
           )),
         ),
       )
     );
--- a/toolkit/components/normandy/test/browser/browser_about_studies.js
+++ b/toolkit/components/normandy/test/browser/browser_about_studies.js
@@ -66,16 +66,17 @@ decorate_task(
       "about:preferences#privacy",
       "Clicking Update Preferences opens the privacy section of the new about:preferences.",
     );
 
     BrowserTestUtils.removeTab(tab);
   }
 );
 
+// Test that the study listing shows studies in the proper order and grouping
 decorate_task(
   AddonStudies.withStudies([
     addonStudyFactory({
       name: "A Fake Add-on Study",
       active: true,
       description: "A fake description",
       studyStartDate: new Date(2018, 0, 4),
     }),
@@ -194,29 +195,29 @@ decorate_task(
       );
       ok(
         !inactivePrefStudy.querySelector(".remove-button"),
         "Inactive studies do not show a remove button"
       );
 
       activeAddonStudy.querySelector(".remove-button").click();
       await ContentTaskUtils.waitForCondition(() => (
-        getStudyRow(doc, addonStudies[0].name).matches(".study--disabled")
+        getStudyRow(doc, addonStudies[0].name).matches(".study.disabled")
       ));
       ok(
-        getStudyRow(doc, addonStudies[0].name).matches(".study--disabled"),
+        getStudyRow(doc, addonStudies[0].name).matches(".study.disabled"),
         "Clicking the remove button updates the UI to show that the study has been disabled."
       );
 
       activePrefStudy.querySelector(".remove-button").click();
       await ContentTaskUtils.waitForCondition(() => (
-        getStudyRow(doc, prefStudies[0].name).matches(".study--disabled")
+        getStudyRow(doc, prefStudies[0].name).matches(".study.disabled")
       ));
       ok(
-        getStudyRow(doc, prefStudies[0].name).matches(".study--disabled"),
+        getStudyRow(doc, prefStudies[0].name).matches(".study.disabled"),
         "Clicking the remove button updates the UI to show that the study has been disabled."
       );
     });
 
     const updatedAddonStudy = await AddonStudies.get(addonStudies[0].recipeId);
     ok(
       !updatedAddonStudy.active,
       "Clicking the remove button marks addon studies as inactive in storage."
@@ -225,16 +226,17 @@ decorate_task(
     const updatedPrefStudy = await PreferenceExperiments.get(prefStudies[0].name);
     ok(
       updatedPrefStudy.expired,
       "Clicking the remove button marks preference studies as expired in storage."
     );
   }
 );
 
+// Test that a message is shown when no studies have been run
 decorate_task(
   AddonStudies.withStudies([]),
   withAboutStudies,
   async function testStudyListing(studies, browser) {
     await ContentTask.spawn(browser, null, async () => {
       const doc = content.document;
       await ContentTaskUtils.waitForCondition(() => doc.querySelectorAll(".study-list-info").length);
       const studyRows = doc.querySelectorAll(".study-list .study");
@@ -243,16 +245,17 @@ decorate_task(
         doc.querySelector(".study-list-info").textContent,
         "You have not participated in any studies.",
         "A message is shown when no studies exist",
       );
     });
   }
 );
 
+// Test that the message shown when studies are disabled and studies exist
 decorate_task(
   withAboutStudies,
   async function testStudyListing(browser) {
     try {
       RecipeRunner.disable();
 
       await ContentTask.spawn(browser, null, async () => {
         const doc = content.document;
@@ -264,9 +267,10 @@ decorate_task(
           "A message is shown when studies are disabled",
         );
       });
     } finally {
       // reset RecipeRunner.enabled
       RecipeRunner.checkPrefs();
     }
   }
-).only();
+);
+