summaryrefslogtreecommitdiffstats
path: root/toolkit/components/certviewer/tests/browser/browser_checkNonEmptyFields.js
blob: e6c48dc3d1e965f1170fd7a62c2522d35f952263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

async function checkNonEmptyFields(url) {
  await BrowserTestUtils.withNewTab(url, async function (browser) {
    await SpecialPowers.spawn(browser, [], async function () {
      let certificateSection = await ContentTaskUtils.waitForCondition(() => {
        return content.document.querySelector("certificate-section");
      }, "Certificate section found");

      let tabs =
        certificateSection.shadowRoot.querySelector(
          ".certificate-tabs"
        ).children;

      Assert.ok(tabs, "Tabs were found");
      Assert.greater(tabs.length, 0, "There must at least one tab");

      function clickTabAndCheckSelection(tabID) {
        let selectedTabBefore = 0;

        for (let i = 0; i < tabs.length; i++) {
          if (tabs[i].className.includes("selected")) {
            selectedTabBefore = i;
            break;
          }
        }

        let tabButton = certificateSection.shadowRoot.querySelector(
          `.certificate-tabs .tab[idnumber="${tabID}"]`
        );
        tabButton.click();

        if (tabID !== 0) {
          Assert.notEqual(
            selectedTabBefore,
            tabID,
            "A new tab should be selected now"
          );
        }
      }

      for (let i = 0; i < tabs.length; i++) {
        clickTabAndCheckSelection(i);

        let infoGroups =
          certificateSection.shadowRoot.querySelectorAll("info-group");
        Assert.ok(infoGroups, "infoGroups found");

        for (let infoGroup of infoGroups) {
          let infoItems = infoGroup.shadowRoot.querySelectorAll("info-item");
          Assert.ok(infoItems, "infoItems found");

          for (let infoItem of infoItems) {
            let item = infoItem.shadowRoot.querySelector(".info");
            if (item.textContent.length === 0) {
              await ContentTaskUtils.waitForCondition(
                () => parseInt(item.textContent.length) > 0,
                "info-item has not been localized."
              );
            }
          }
        }
      }
    });
  });
}

add_task(async function test() {
  const url1 =
    "about:certificate?cert=MIIIIDCCBwigAwIBAgIQdFFdOvtZKGMnFerJav62lzANBgkqhkiG9w0BAQsFADBUMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUwIwYDVQQDExxHb29nbGUgSW50ZXJuZXQgQXV0aG9yaXR5IEczMB4XDTE5MDcyOTE4NDQyN1oXDTE5MTAyMTE4MjMwMFowZjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEzARBgNVBAoMCkdvb2dsZSBMTEMxFTATBgNVBAMMDCouZ29vZ2xlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABOOufVj7d5UF%2FN49KyXmA0Z0rlQPEicHK5CbO122uECXYbWwepNlWlqM7V1GF0vRutC8YyAlxrCsUmOTrpem7NWjggWlMIIFoTATBgNVHSUEDDAKBggrBgEFBQcDATAOBgNVHQ8BAf8EBAMCB4AwggRqBgNVHREEggRhMIIEXYIMKi5nb29nbGUuY29tgg0qLmFuZHJvaWQuY29tghYqLmFwcGVuZ2luZS5nb29nbGUuY29tghIqLmNsb3VkLmdvb2dsZS5jb22CGCouY3Jvd2Rzb3VyY2UuZ29vZ2xlLmNvbYIGKi5nLmNvgg4qLmdjcC5ndnQyLmNvbYIRKi5nY3BjZG4uZ3Z0MS5jb22CCiouZ2dwaHQuY26CFiouZ29vZ2xlLWFuYWx5dGljcy5jb22CCyouZ29vZ2xlLmNhggsqLmdvb2dsZS5jbIIOKi5nb29nbGUuY28uaW6CDiouZ29vZ2xlLmNvLmpwgg4qLmdvb2dsZS5jby51a4IPKi5nb29nbGUuY29tLmFygg8qLmdvb2dsZS5jb20uYXWCDyouZ29vZ2xlLmNvbS5icoIPKi5nb29nbGUuY29tLmNvgg8qLmdvb2dsZS5jb20ubXi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