michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); michael@0: Components.utils.import("resource://gre/modules/NetUtil.jsm"); michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: open_preferences(runTest); michael@0: } michael@0: michael@0: function runTest(win) { michael@0: is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded"); michael@0: michael@0: let tab = win.document; michael@0: let elements = tab.getElementById("mainPrefPane").children; michael@0: michael@0: //Test if general pane is opened correctly michael@0: win.gotoPref("paneGeneral"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "paneGeneral") { michael@0: is_element_visible(element, "General elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-General elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: //Test if tabs pane is opened correctly michael@0: win.gotoPref("paneTabs"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "paneTabs") { michael@0: is_element_visible(element, "Tab elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-Tab elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: //Test if content pane is opened correctly michael@0: win.gotoPref("paneContent"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "paneContent") { michael@0: is_element_visible(element, "Content elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-Content elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: //Test if applications pane is opened correctly michael@0: win.gotoPref("paneApplications"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "paneApplications") { michael@0: is_element_visible(element, "Application elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-Application elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: //Test if privacy pane is opened correctly michael@0: win.gotoPref("panePrivacy"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "panePrivacy") { michael@0: is_element_visible(element, "Privacy elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-Privacy elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: //Test if security pane is opened correctly michael@0: win.gotoPref("paneSecurity"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "paneSecurity") { michael@0: is_element_visible(element, "Security elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-Security elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: //Test if sync pane is opened correctly michael@0: win.gotoPref("paneSync"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "paneSync") { michael@0: is_element_visible(element, "Sync elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-Sync elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: //Test if advanced pane is opened correctly michael@0: win.gotoPref("paneAdvanced"); michael@0: for (let element of elements) { michael@0: let attributeValue = element.getAttribute("data-category"); michael@0: if (attributeValue == "paneAdvanced") { michael@0: is_element_visible(element, "Advanced elements should be visible"); michael@0: } else { michael@0: is_element_hidden(element, "Non-Advanced elements should be hidden"); michael@0: } michael@0: } michael@0: michael@0: gBrowser.removeCurrentTab(); michael@0: win.close(); michael@0: finish(); michael@0: }