forked from cypress-io/cypress-example-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xhr.hbs
29 lines (28 loc) · 776 Bytes
/
xhr.hbs
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
<!DOCTYPE html>
<html>
<head>
<title>Bootstrapping your App with Test Data</title>
</head>
<body>
<h2>xhr.html</h2>
<p>
This example has the client app.js make an XHR for the bootstrapped data from the server.
</p>
<p>
In this recipe we are going to modify this bootstrapped data with Cypress so we can control the initial data payload.
</p>
<pre></pre>
<script type="text/javascript" src="/node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="/app.js"></script>
<script type="text/javascript">
$(function(){
// fetch the bootstrapped data.json file
// and then start the app
$.getJSON("/data.json")
.done(function(data){
App.start(data)
})
})
</script>
</body>
</html>