| 1 |
#!/usr/bin/sh -x |
| 2 |
|
| 3 |
cp /usr/share/javascript/jquery/jquery.js /tmp |
| 4 |
cp /usr/share/javascript/jquery-validation/jquery.validate.js /tmp |
| 5 |
cp /usr/share/javascript/jquery-validation/additional-methods.js /tmp |
| 6 |
|
| 7 |
cat > /tmp/test.html <<"EOF" |
| 8 |
<!DOCTYPE html> |
| 9 |
<html lang="en"> |
| 10 |
<head> |
| 11 |
<meta charset="utf-8"> |
| 12 |
<title>jQuery validation plug-in - comment form example</title> |
| 13 |
<link rel="stylesheet" href="css/screen.css"> |
| 14 |
<link rel="stylesheet" href="css/cmxform.css"> |
| 15 |
<script src="jquery.js"></script> |
| 16 |
<script src="jquery.validate.js"></script> |
| 17 |
<script src="additional-methods.js"></script> |
| 18 |
<script> |
| 19 |
$(document).ready(function() { |
| 20 |
$("#fileForm").validate(); |
| 21 |
}); |
| 22 |
</script> |
| 23 |
<script> window.onerror = function(msg, url, line, col, err) { console.error("JS ERROR:", msg); window.close(); }; </script> |
| 24 |
</head> |
| 25 |
<body> |
| 26 |
<form class="cmxform" id="fileForm" method="post" action=""> |
| 27 |
<fieldset> |
| 28 |
<legend>Select the indicated type of files?</legend> |
| 29 |
<p> |
| 30 |
<label for="file1">Select a plain text file (e.g. *.txt)</label> |
| 31 |
<input type="file" id="file1" name="file1" class="required" accept="text/plain"> |
| 32 |
</p> |
| 33 |
<p> |
| 34 |
<label for="file2">Select any image file</label> |
| 35 |
<input type="file" id="file2" name="file2" class="required" accept="image/*"> |
| 36 |
</p> |
| 37 |
<p> |
| 38 |
<label for="file3">Select either a PDF or a EPS file</label> |
| 39 |
<input type="file" id="file3" name="file3" class="required" accept="image/x-eps,application/pdf"> |
| 40 |
</p> |
| 41 |
<p> |
| 42 |
<label for="file4">Select any audio or image file</label> |
| 43 |
<input type="file" id="file4" name="file4" class="required" accept="image/*,audio/*"> |
| 44 |
</p> |
| 45 |
<p> |
| 46 |
<label for="file5">Select one or more plain text files (e.g. *.txt)</label> |
| 47 |
<input type="file" id="file5" name="file5" class="required" multiple accept="text/plain"> |
| 48 |
</p> |
| 49 |
<p> |
| 50 |
<input class="submit" type="submit" value="Submit"> |
| 51 |
</p> |
| 52 |
</fieldset> |
| 53 |
</form> |
| 54 |
</body> |
| 55 |
</html> |
| 56 |
EOF |
| 57 |
|
| 58 |
if chromium --headless --disable-gpu --dump-dom file:///tmp/test.html; then |
| 59 |
echo "Page loaded correctly" |
| 60 |
exit 0 |
| 61 |
else |
| 62 |
echo "Page failed to load" |
| 63 |
exit 1 |
| 64 |
fi |