summaryrefslogtreecommitdiffstats
path: root/toolkit/components/passwordmgr/test/mochitest/test_basic_form_3pw_1.html
blob: 30b5a319f6c5e51aa575266e9eeb2bf6499439bd (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Test autofill for forms with 3 password fields</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="pwmgr_common.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Login Manager test: forms with 3 password fields (form filling)
<script>
runChecksAfterCommonInit(() => startTest());
</script>
<p id="display"></p>

<div id="content" style="display: none">
  <p>The next three forms are <b>user/pass/passB/passC</b>, as all-empty, preuser(only), and preuser/pass</p>
  <form id="form1" action="formtest.js">
    <input  type="text"       name="uname">
    <input  type="password"   name="pword">
    <input  type="password"   name="qword">
    <input  type="password"   name="rword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

  <form id="form2" action="formtest.js">
    <input  type="text"       name="uname"  value="testuser">
    <input  type="password"   name="pword">
    <input  type="password"   name="qword">
    <input  type="password"   name="rword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

  <form id="form3" action="formtest.js">
    <input  type="text"       name="uname"  value="testuser">
    <input  type="password"   name="pword"  value="testpass">
    <input  type="password"   name="qword">
    <input  type="password"   name="rword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>


  <p>The next three forms are <b>user/passB/pass/passC</b>, as all-empty, preuser(only), and preuser/pass</p>
  <form id="form4" action="formtest.js">
    <input  type="text"       name="uname">
    <input  type="password"   name="qword">
    <input  type="password"   name="pword">
    <input  type="password"   name="rword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

  <form id="form5" action="formtest.js">
    <input  type="text"       name="uname"  value="testuser">
    <input  type="password"   name="qword">
    <input  type="password"   name="pword">
    <input  type="password"   name="rword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

  <form id="form6" action="formtest.js">
    <input  type="text"       name="uname"  value="testuser">
    <input  type="password"   name="qword">
    <input  type="password"   name="pword"  value="testpass">
    <input  type="password"   name="rword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

  <p>The next three forms are <b>user/passB/passC/pass</b>, as all-empty, preuser(only), and preuser/pass</p>
  <form id="form7" action="formtest.js">
    <input  type="text"       name="uname">
    <input  type="password"   name="qword">
    <input  type="password"   name="rword">
    <input  type="password"   name="pword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

  <form id="form8" action="formtest.js">
    <input  type="text"       name="uname"  value="testuser">
    <input  type="password"   name="qword">
    <input  type="password"   name="rword">
    <input  type="password"   name="pword">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>

  <form id="form9" action="formtest.js">
    <input  type="text"       name="uname"  value="testuser">
    <input  type="password"   name="qword">
    <input  type="password"   name="rword">
    <input  type="password"   name="pword"  value="testpass">

    <button type="submit">Submit</button>
    <button type="reset"> Reset </button>
  </form>
</div>

<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Login Manager: form fill, 3 password fields **/

// Test to make sure 3-password forms are filled properly.

function startTest() {
  // Check form 1
  is($_(1, "uname").value, "testuser", "Checking username 1");
  is($_(1, "pword").value, "testpass", "Checking password 1");
  is($_(1, "qword").value, "",         "Checking password 1 (q)");
  is($_(1, "rword").value, "",         "Checking password 1 (r)");
  // Check form 2
  is($_(2, "uname").value, "testuser", "Checking username 2");
  is($_(2, "pword").value, "testpass", "Checking password 2");
  is($_(2, "qword").value, "",         "Checking password 2 (q)");
  is($_(2, "rword").value, "",         "Checking password 2 (r)");
  // Check form 3
  is($_(3, "uname").value, "testuser", "Checking username 3");
  is($_(3, "pword").value, "testpass", "Checking password 3");
  is($_(3, "qword").value, "",         "Checking password 3 (q)");
  is($_(3, "rword").value, "",         "Checking password 3 (r)");

  // Check form 4
  is($_(4, "uname").value, "testuser", "Checking username 4");
  todo_is($_(4, "qword").value, "",         "Checking password 4 (q)");
  todo_is($_(4, "pword").value, "testpass", "Checking password 4");
  is($_(4, "rword").value, "",         "Checking password 4 (r)");
  // Check form 5
  is($_(5, "uname").value, "testuser", "Checking username 5");
  todo_is($_(5, "qword").value, "",         "Checking password 5 (q)");
  todo_is($_(5, "pword").value, "testpass", "Checking password 5");
  is($_(5, "rword").value, "",         "Checking password 5 (r)");
  // Check form 6
  is($_(6, "uname").value, "testuser", "Checking username 6");
  todo_is($_(6, "qword").value, "",         "Checking password 6 (q)");
  is($_(6, "pword").value, "testpass", "Checking password 6");
  is($_(6, "rword").value, "",         "Checking password 6 (r)");

  // Check form 7
  is($_(7, "uname").value, "testuser", "Checking username 7");
  todo_is($_(7, "qword").value, "",         "Checking password 7 (q)");
  is($_(7, "rword").value, "",         "Checking password 7 (r)");
  todo_is($_(7, "pword").value, "testpass", "Checking password 7");
  // Check form 8
  is($_(8, "uname").value, "testuser", "Checking username 8");
  todo_is($_(8, "qword").value, "",         "Checking password 8 (q)");
  is($_(8, "rword").value, "",         "Checking password 8 (r)");
  todo_is($_(8, "pword").value, "testpass", "Checking password 8");
  // Check form 9
  is($_(9, "uname").value, "testuser", "Checking username 9");
  todo_is($_(9, "qword").value, "",         "Checking password 9 (q)");
  is($_(9, "rword").value, "",         "Checking password 9 (r)");
  is($_(9, "pword").value, "testpass", "Checking password 9");

  // TODO: as with the 2-password cases, add tests to check for creating new
  // logins and changing passwords.
  SimpleTest.finish();
}
</script>
</pre>
</body>
</html>