tests should not rely on remote scripts
Showing
1 changed file
with
10 additions
and
10 deletions
1 | /*global casper*/ | 1 | /*global casper*/ |
2 | /*jshint strict:false*/ | 2 | /*jshint strict:false*/ |
3 | casper.test.begin('remote script includes tests', 6, function(test) { | 3 | casper.test.begin('remote script includes tests', 4, { |
4 | setUp: function() { | ||
4 | casper.options.remoteScripts = [ | 5 | casper.options.remoteScripts = [ |
5 | 'includes/include1.js', // local includes are actually served | 6 | 'includes/include1.js', // local includes are actually served |
6 | 'includes/include2.js', // through the local test webserver | 7 | 'includes/include2.js' // through the local test webserver |
7 | 'http://code.jquery.com/jquery-1.8.3.min.js' | ||
8 | ]; | 8 | ]; |
9 | }, | ||
9 | 10 | ||
11 | tearDown: function() { | ||
12 | casper.options.remoteScripts = []; | ||
13 | }, | ||
14 | |||
15 | test: function(test) { | ||
10 | casper.start('tests/site/index.html', function() { | 16 | casper.start('tests/site/index.html', function() { |
11 | test.assertSelectorHasText('#include1', 'include1', | 17 | test.assertSelectorHasText('#include1', 'include1', |
12 | 'Casper.includeRemoteScripts() includes a first remote script on start'); | 18 | 'Casper.includeRemoteScripts() includes a first remote script on start'); |
13 | test.assertSelectorHasText('#include2', 'include2', | 19 | test.assertSelectorHasText('#include2', 'include2', |
14 | 'Casper.includeRemoteScripts() includes a second remote script on start'); | 20 | 'Casper.includeRemoteScripts() includes a second remote script on start'); |
15 | test.assertEval(function() { | ||
16 | return 'jQuery' in window; | ||
17 | }, 'Casper.includeRemoteScripts() includes a really remote file on first step'); | ||
18 | }); | 21 | }); |
19 | 22 | ||
20 | casper.thenOpen('tests/site/form.html', function() { | 23 | casper.thenOpen('tests/site/form.html', function() { |
... | @@ -22,13 +25,10 @@ casper.test.begin('remote script includes tests', 6, function(test) { | ... | @@ -22,13 +25,10 @@ casper.test.begin('remote script includes tests', 6, function(test) { |
22 | 'Casper.includeRemoteScripts() includes a first remote script on second step'); | 25 | 'Casper.includeRemoteScripts() includes a first remote script on second step'); |
23 | test.assertSelectorHasText('#include2', 'include2', | 26 | test.assertSelectorHasText('#include2', 'include2', |
24 | 'Casper.includeRemoteScripts() includes a second remote script on second step'); | 27 | 'Casper.includeRemoteScripts() includes a second remote script on second step'); |
25 | test.assertEval(function() { | ||
26 | return 'jQuery' in window; | ||
27 | }, 'Casper.includeRemoteScripts() includes a really remote file on second step'); | ||
28 | }); | 28 | }); |
29 | 29 | ||
30 | casper.run(function() { | 30 | casper.run(function() { |
31 | this.options.remoteScripts = []; | ||
32 | test.done(); | 31 | test.done(); |
33 | }); | 32 | }); |
33 | } | ||
34 | }); | 34 | }); | ... | ... |
-
Please register or sign in to post a comment