Mercurial > hg > webaudioevaluationtool
comparison php/test.html @ 3018:03b0e5dc57e6
Merge branch 'vnext' into Dev_main
# Conflicts:
# python/pythonServer.py
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 12 Sep 2017 14:05:38 +0100 |
parents | 260efd43fe52 |
children |
comparison
equal
deleted
inserted
replaced
3016:f5bfac0557bb | 3018:03b0e5dc57e6 |
---|---|
1 <html lang="en"> | |
2 | |
3 <head> | |
4 <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
5 | |
6 | |
7 <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame | |
8 Remove this if you use the .htaccess --> | |
9 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
10 | |
11 <title>Web Audio Evaluation Tool</title> | |
12 <meta name="description" content="" /> | |
13 <meta name="author" content="" /> | |
14 | |
15 <!-- Load up the default core JS and CSS files--> | |
16 <link rel='stylesheet' type='text/css' href='../css/core.css'> | |
17 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/3.5.2/mocha.min.css" integrity="sha256-Flo6sV8k+IPfHh6Hx97ReUJDLOwIwvhdGlKOz3UgHRE=" crossorigin="anonymous" /> | |
18 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
19 <!-- Use jQuery hosted from Google CDN --> | |
20 <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>--> | |
21 <script type="text/javascript" src="../js/showdown.min.js"></script> | |
22 <script type="text/javascript" src="../js/jquery-2.1.4.js"></script> | |
23 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> | |
24 <script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.1.2/chai.min.js" integrity="sha256-iP6sMGdjKeRM2DuED2Lsi/n7MNTKhGpkhuSdCHXIgYc=" crossorigin="anonymous"></script> | |
25 <script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/3.5.2/mocha.min.js" integrity="sha256-rw/35Nx9y5f+fLTdO7Tipm6ju+tRGwnplU1CJyPM3nE=" crossorigin="anonymous"></script> | |
26 <script> | |
27 mocha.setup('bdd'); | |
28 var expect = chai.expect; | |
29 var should = chai.should(); | |
30 var key1; | |
31 describe("requestKey.php", function() { | |
32 it("should give a key", function(done) { | |
33 var xhr = new XMLHttpRequest(); | |
34 xhr.open("GET", "requestKey.php"); | |
35 xhr.onload = function() { | |
36 var doc = xhr.response; | |
37 var state = doc.querySelector("state").textContent; | |
38 key1 = doc.querySelector("key").textContent; | |
39 expect(state).to.equal("OK"); | |
40 done(); | |
41 } | |
42 xhr.responseType = "document"; | |
43 xhr.send(); | |
44 }); | |
45 it("should create an empty file with that key", function(done) { | |
46 var xhr = new XMLHttpRequest(); | |
47 xhr.open("GET", "../saves/save-" + key1 + ".xml"); | |
48 xhr.onload = function() { | |
49 var parser = new DOMParser(); | |
50 doc = parser.parseFromString(xhr.responseText, "text/xml"); | |
51 var state = doc.querySelector("waetresult").getAttribute("key"); | |
52 expect(state).to.equal(key1); | |
53 done(); | |
54 } | |
55 xhr.responseType = ""; | |
56 xhr.send(); | |
57 }); | |
58 it("should give a different key on second request", function(done) { | |
59 var xhr = new XMLHttpRequest(); | |
60 xhr.open("GET", "requestKey.php"); | |
61 xhr.onload = function() { | |
62 var doc = xhr.response; | |
63 var state = doc.querySelector("state").textContent; | |
64 var key = doc.querySelector("key").textContent; | |
65 expect(state).to.equal("OK"); | |
66 expect(key).not.to.equal(key1); | |
67 done(); | |
68 } | |
69 xhr.responseType = "document"; | |
70 xhr.send(); | |
71 }); | |
72 }); | |
73 describe("Saves permissions", function() { | |
74 it("should write \"test-save.xml\" to saves and delete", function(done) { | |
75 var xhr = new XMLHttpRequest(); | |
76 xhr.open("GET", "test_write.php"); | |
77 xhr.onload = function() { | |
78 var doc = xhr.response; | |
79 var response = doc.querySelector("response"); | |
80 var message = doc.querySelector("message"); | |
81 expect(response.getAttribute("state")).to.equal("OK"); | |
82 done(); | |
83 } | |
84 xhr.responseType = "document"; | |
85 xhr.send(); | |
86 }); | |
87 }); | |
88 window.onload = function() { | |
89 mocha.run(); | |
90 } | |
91 | |
92 </script> | |
93 </head> | |
94 | |
95 <body class="container"> | |
96 <div> | |
97 <h1>WAET PHP Server Tests</h1> | |
98 <p class="lead">This page will test your PHP server for any implementation issues.</p> | |
99 <p>Make sure your <span>saves</span> directory is clean before testing and that you empty it afterwards as intermediary files will be made there.</p> | |
100 | |
101 </div> | |
102 <div id="mocha"></div> | |
103 </body> | |
104 | |
105 </html> |