-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathforms.html
429 lines (381 loc) · 20.6 KB
/
forms.html
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="Sample Web Application for Test Automation">
<meta name="author" content="Dinesh Velhal">
<title>Form Interactions</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="css/all.css">
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">
<!-- Material Design Bootstrap
<link href="css/mdb.min.css" rel="stylesheet">-->
<!-- Your custom styles (optional)
<link href="css/style.css" rel="stylesheet">-->
</head>
<body>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<!-- Brand/logo -->
<a class="navbar-brand abs" href="index.html">The Playground</a>
</nav>
<br>
<br>
<div class="container">
<div class="card text-center shadow border-success">
<div class="card-header">
<h3>Basic Form Controls</h3>
Interact with the form controls. The changed values will be shown below every element. This can be used
for validation in your autmated test.
</div>
<div class="card-body">
<form>
<div class="form-row align-items-center">
<div class="col-md-4 mb-4">
<div class="form-group">
<input type="text" class="form-control form-control-sm" id="exp"
aria-describedby="expHelp" placeholder="years of automation experience">
<span id="exp_help" class="form-text text-success"></span>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="form-group">
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="check_java" value="JAVA">
<label class="form-check-label" for="check_java">Java</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="check_python" value="PYTHON">
<label class="form-check-label" for="check_python">Python</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="check_javascript"
value="JAVASCRIPT">
<label class="form-check-label" for="check_javascript">JavaScript</label>
</div>
<span id="check_validate" class="form-text text-success"></span>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="form-group">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="rad_selenium" value="SELENIUM"
name="tool">
<label class="form-check-label" for="rad_selenium">Selenium</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="rad_protractor" value="PROTRACTOR"
name="tool">
<label class="form-check-label" for="rad_protractor">Protractor</label>
</div>
<span id="rad_validate" class="form-text text-success"></span>
</div>
</div>
</div>
<div class="form-row align-items-center">
<div class="col-md-4 mb-4">
<div class="form-group">
<label for="select_tool">Primary Skill</label>
<select class="form-control form-control-sm" id="select_tool">
<option value="sel">Selenium</option>
<option value="pro">Protractor</option>
<option value="cyp">Cypress</option>
</select>
<span id="select_tool_validate" class="form-text text-success"></span>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="form-group">
<label for="select_lang">Choose Language</label>
<select class="form-control form-control-sm" id="select_lang" size="4" multiple>
<option value="java">Java</option>
<option value="python">Python</option>
<option value="javascript">JavaScript</option>
<option value="typescript">TypeScript</option>
</select>
<span id="select_lang_validate" class="form-text text-success"></span>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="form-group">
<textarea class="form-control form-control-sm" id="notes" rows="6"
placeholder="Notes"></textarea>
<span id="area_notes_validate" class="form-text text-success"></span>
</div>
</div>
</div>
<div class="form-row align-items-center">
<div class="col-md-4 mb-4">
<label for="common_sense">Mandatory Skill (Read-Only textbox)</label>
<input class="form-control form-control-sm" type="text" id="common_sense"
placeholder="Common Sense" readonly>
</div>
<div class="col-md-4 mb-4">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="german">
<label class="custom-control-label" for="german">Speaks German?</label>
</div>
<span id="german_validate" class="form-text text-success"></span>
</div>
<div class="col-md-4 mb-4">
<label for="fluency">German Fluency Level</label>
<input type="range" class="custom-range" min="0" max="5" id="fluency">
<span id="fluency_validate" class="form-text text-success"></span>
</div>
</div>
<div class="form-row align-items-center">
<div class="col-md-4 mb-4">
<div class="form-group">
<br>
<label for="upload_cv">Upload CV (SINGLE FILE)</label>
<input type="file" class="form-control-file bg-light" id="upload_cv"
aria-describedby="fileHelp">
<span id="validate_cv" class="form-text text-success"></span>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="form-group">
<br>
<label for="upload_files">Upload Certificates (MULTIPLE FILES)</label>
<input type="file" class="form-control-file bg-light" id="upload_files"
aria-describedby="fileHelp" multiple>
<span id="validate_files" class="form-text text-success"></span>
</div>
</div>
<div class="col-md-4 mb-4">
<label for="salary">Current Salary (Disabled TextBox)</label>
<input class="form-control form-control-sm" type="text" id="salary" placeholder="You should not provide this" disabled>
<input class="form-control form-control-sm" type="text" id="invisible" placeholder="You cannot see this" hidden>
</div>
</div>
</form>
</div>
</div>
<br>
<div class="card text-center shadow border-success">
<div class="card-header">
<h3>Form with Validations</h3>
Every field, if empty, throws validation error when the form is submitted. The error text can be
validated
in your automated test.
</div>
<div class="card-body">
<form class="needs-validation" novalidate>
<div class="form-row">
<div class="col-md-6 mb-3">
<input type="text" class="form-control" id="validationCustom03" placeholder="City" required>
<div class="invalid-feedback" id="invalid_city">
Please provide a valid city.
</div>
</div>
<div class="col-md-3 mb-3">
<input type="text" class="form-control" id="validationCustom04" placeholder="State"
required>
<div class="invalid-feedback" id="invalid_state">
Please provide a valid state.
</div>
</div>
<div class="col-md-3 mb-3">
<input type="text" class="form-control" id="validationCustom05" placeholder="Zip" required>
<div class="invalid-feedback" id="invalid_zip">
Please provide a valid zip.
</div>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
<label class="form-check-label" for="invalidCheck">
Agree to terms and conditions
</label>
<div class="invalid-feedback" id="invalid_terms">
You must agree before submitting.
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Submit Form</button>
</form>
<script>
(function () {
'use strict';
window.addEventListener('load', function () {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function (form) {
form.addEventListener('submit', function (event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
</div>
</div>
<br>
<!--<div class="card text-center shadow border-success">
<div class="card-header">
<h3>HTML5 Controls</h3>
</div>
<div class="card-body">
<div class="form-group">
</div>
</div>
</div>
<br>
<br>-->
<div class="card text-center shadow border-success">
<div class="card-header">
<h3>Non-English Labels and Locators</h3>
These elements have non-English identifiers and visible text. You can test if your automation code
supports non-english characters in the locators and visible text.
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-6">
<div class="md-form">
<div class="form-group">
<input type="text" class="form-control form-control-sm" id="नाव"
aria-describedby="expHelp">
<label for="नाव" class="">आपले नांव लिहा</label>
<span id="नाव_तपासा" class="form-text text-success"></span>
</div>
</div>
</div>
<div class="col-sm-6">
<form>
<div class="form-group">
<div class="form-check form-check-inline" style="padding-right: 30px;">
<input class=" form-check-input" type="checkbox" id="मराठी" value="मराठी">
<label class="form-check-label" for="मराठी">मराठी</label>
</div>
<div class="form-check form-check-inline" style="padding-right: 30px;">
<input class="form-check-input" type="checkbox" id="ગુજરાતી" value="ગુજરાતી">
<label class="form-check-label" for="ગુજરાતી">ગુજરાતી</label>
</div>
<div class="form-check form-check-inline" style="padding-right: 30px;">
<input class="form-check-input" type="checkbox" id="ਪੰਜਾਬੀ" value="ਪੰਜਾਬੀ">
<label class="form-check-label" for="ਪੰਜਾਬੀ">ਪੰਜਾਬੀ</label>
</div>
<span id="check_validate_non_english" class="form-text text-success"></span>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<br><br><br><br>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding: 1px !important;">
<a class="navbar-brand" href="http://www.linkedin.com/in/dineshvelhal"><span class="font-weight-lighter">©
2019 Dinesh Velhal </span></a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<span class="font-weight-lighter text-light mr-3">Coordinates: </span>
</li>
<li class="nav-item active">
<a href="http://www.linkedin.com/in/dineshvelhal" class="mr-3 fab fa-linkedin-in"></a>
</li>
<li class="nav-item">
<a href="https://twitter.com/dinesh_velhal" class="fab fa-twitter"></a>
</li>
</ul>
</div>
<form class="form-inline my-2 my-lg-0">
<span><a class="btn btn-success btn-sm" href="attribution.html" role="button"><i class="fa fa-heart"></i>
Thanks
To</a>
<a class="btn btn-light btn-sm" href="index.html" role="button"><i class="fa fa-home"></i>
Home</a></span>
</form>
</nav>
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- MDB core JavaScript
<script type="text/javascript" src="js/mdb.min.js"></script>-->
<script>
$(document).ready(function () {
// textbox
$("#exp").on("change keyup paste click", function () {
$("#exp_help").text($(this).val());
});
// checkbox
$("#check_java, #check_python, #check_javascript").on("change keyup click", function () {
$("#check_validate").text(
(($("#check_java").prop("checked") ? $("#check_java").val() : "")
+ " "
+ ($("#check_python").prop("checked") ? $("#check_python").val() : "")
+ " "
+ ($("#check_javascript").prop("checked") ? $("#check_javascript").val() : "")).trim()
);
});
// radio button
$("#rad_selenium, #rad_protractor").on("change keyup click", function () {
$("#rad_validate").text(
($("#rad_selenium").prop("checked") ? $("#rad_selenium").val() : "")
+ ""
+ ($("#rad_protractor").prop("checked") ? $("#rad_protractor").val() : "")
);
});
// text area
$("#notes").on("change keyup paste click", function () {
$("#area_notes_validate").text($(this).val());
});
// dropdown
$("#select_tool").on("change keyup click", function () {
$("#select_tool_validate").text($(this).children("option:selected").val());
});
// multi-select
$("#select_lang").on("change keyup click", function () {
$("#select_lang_validate").text($(this).val());
});
// Switch
$("#german").on("change keyup click", function () {
$("#german_validate").text($(this).prop("checked"));
});
// Range slider
$("#fluency").on("change keyup click", function () {
$("#fluency_validate").text($(this).val());
});
// non-english textbox
$("#नाव").on("change keyup paste click", function () {
$("#नाव_तपासा").text($(this).val());
});
// non-english checkbox
$("#मराठी, #ગુજરાતી, #ਪੰਜਾਬੀ").on("change keyup click", function () {
$("#check_validate_non_english").text(
(($("#मराठी").prop("checked") ? $("#मराठी").val() : "")
+ " "
+ ($("#ગુજરાતી").prop("checked") ? $("#ગુજરાતી").val() : "")
+ " "
+ ($("#ਪੰਜਾਬੀ").prop("checked") ? $("#ਪੰਜਾਬੀ").val() : "")).trim()
);
});
// file upload
$("#upload_cv").on("change", function (e) {
$("#validate_cv").text(e.target.files[0].name);
});
// multi-file upload
$("#upload_files").on("change", function (e) {
var names = "", i = 0;
for (i = 0; i < e.target.files.length; i++) {
names += (" " + e.target.files[i].name);
};
$("#validate_files").text(names);
});
});
</script>
</body>
</html>