Bug 1438702 - Skip test_credit_card_autofill_section when CC autofill is disabled. r=jaws draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 21 Feb 2018 23:00:08 -0800
changeset 758293 90c896bb1ebe84b687cc1b1d1698542fd0c69aa0
parent 758292 c0260c67218a901452602a1fbf2b6ebfd66abaa3
push id100013
push usermozilla@noorenberghe.ca
push dateThu, 22 Feb 2018 08:02:45 +0000
reviewersjaws
bugs1438702
milestone60.0a1
Bug 1438702 - Skip test_credit_card_autofill_section when CC autofill is disabled. r=jaws MozReview-Commit-ID: B1qa9BhIa05
browser/components/preferences/in-content/tests/browser.ini
browser/components/preferences/in-content/tests/browser_spotlight.js
--- a/browser/components/preferences/in-content/tests/browser.ini
+++ b/browser/components/preferences/in-content/tests/browser.ini
@@ -1,9 +1,12 @@
 [DEFAULT]
+prefs =
+  extensions.formautofill.available='on'
+  extensions.formautofill.creditCards.available=true
 support-files =
   head.js
   privacypane_tests_perwindow.js
   site_data_test.html
   service_worker_test.html
   service_worker_test.js
   addons/set_homepage.xpi
   addons/set_newtab.xpi
--- a/browser/components/preferences/in-content/tests/browser_spotlight.js
+++ b/browser/components/preferences/in-content/tests/browser_spotlight.js
@@ -20,16 +20,19 @@ add_task(async function test_address_aut
   await TestUtils.waitForCondition(() => doc.querySelector(".spotlight"),
     "Wait for the ddress-autofill section is spotlighted.");
   is(doc.querySelector(".spotlight").getAttribute("data-subcategory"), "address-autofill",
     "The ddress-autofill section is spotlighted.");
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 add_task(async function test_credit_card_autofill_section() {
+  if (!Services.prefs.getBoolPref("extensions.formautofill.creditCards.available")) {
+    return;
+  }
   let prefs = await openPreferencesViaOpenPreferencesAPI("privacy-credit-card-autofill", {leaveOpen: true});
   is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected by default");
   let doc = gBrowser.contentDocument;
   is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
   await TestUtils.waitForCondition(() => doc.querySelector(".spotlight"),
     "Wait for the credit-card-autofill section is spotlighted.");
   is(doc.querySelector(".spotlight").getAttribute("data-subcategory"), "credit-card-autofill",
     "The credit-card-autofill section is spotlighted.");