Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
5 Components.utils.import("resource://gre/modules/NetUtil.jsm");
7 function test() {
8 waitForExplicitFinish();
9 open_preferences(runTest);
10 }
12 function runTest(win) {
13 is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
15 let tab = win.document;
16 let elements = tab.getElementById("mainPrefPane").children;
18 //Test if general pane is opened correctly
19 win.gotoPref("paneGeneral");
20 for (let element of elements) {
21 let attributeValue = element.getAttribute("data-category");
22 if (attributeValue == "paneGeneral") {
23 is_element_visible(element, "General elements should be visible");
24 } else {
25 is_element_hidden(element, "Non-General elements should be hidden");
26 }
27 }
29 //Test if tabs pane is opened correctly
30 win.gotoPref("paneTabs");
31 for (let element of elements) {
32 let attributeValue = element.getAttribute("data-category");
33 if (attributeValue == "paneTabs") {
34 is_element_visible(element, "Tab elements should be visible");
35 } else {
36 is_element_hidden(element, "Non-Tab elements should be hidden");
37 }
38 }
40 //Test if content pane is opened correctly
41 win.gotoPref("paneContent");
42 for (let element of elements) {
43 let attributeValue = element.getAttribute("data-category");
44 if (attributeValue == "paneContent") {
45 is_element_visible(element, "Content elements should be visible");
46 } else {
47 is_element_hidden(element, "Non-Content elements should be hidden");
48 }
49 }
51 //Test if applications pane is opened correctly
52 win.gotoPref("paneApplications");
53 for (let element of elements) {
54 let attributeValue = element.getAttribute("data-category");
55 if (attributeValue == "paneApplications") {
56 is_element_visible(element, "Application elements should be visible");
57 } else {
58 is_element_hidden(element, "Non-Application elements should be hidden");
59 }
60 }
62 //Test if privacy pane is opened correctly
63 win.gotoPref("panePrivacy");
64 for (let element of elements) {
65 let attributeValue = element.getAttribute("data-category");
66 if (attributeValue == "panePrivacy") {
67 is_element_visible(element, "Privacy elements should be visible");
68 } else {
69 is_element_hidden(element, "Non-Privacy elements should be hidden");
70 }
71 }
73 //Test if security pane is opened correctly
74 win.gotoPref("paneSecurity");
75 for (let element of elements) {
76 let attributeValue = element.getAttribute("data-category");
77 if (attributeValue == "paneSecurity") {
78 is_element_visible(element, "Security elements should be visible");
79 } else {
80 is_element_hidden(element, "Non-Security elements should be hidden");
81 }
82 }
84 //Test if sync pane is opened correctly
85 win.gotoPref("paneSync");
86 for (let element of elements) {
87 let attributeValue = element.getAttribute("data-category");
88 if (attributeValue == "paneSync") {
89 is_element_visible(element, "Sync elements should be visible");
90 } else {
91 is_element_hidden(element, "Non-Sync elements should be hidden");
92 }
93 }
95 //Test if advanced pane is opened correctly
96 win.gotoPref("paneAdvanced");
97 for (let element of elements) {
98 let attributeValue = element.getAttribute("data-category");
99 if (attributeValue == "paneAdvanced") {
100 is_element_visible(element, "Advanced elements should be visible");
101 } else {
102 is_element_hidden(element, "Non-Advanced elements should be hidden");
103 }
104 }
106 gBrowser.removeCurrentTab();
107 win.close();
108 finish();
109 }