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