Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
46690d33
...
46690d3366afd5434ed52e6170a80a2d6bfb4ad6
authored
2013-03-06 19:28:48 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
tests should not rely on remote scripts
1 parent
33fe4345
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
tests/suites/casper/scripts.js
tests/suites/casper/scripts.js
View file @
46690d3
/*global casper*/
/*jshint strict:false*/
casper
.
test
.
begin
(
'remote script includes tests'
,
6
,
function
(
test
)
{
casper
.
options
.
remoteScripts
=
[
'includes/include1.js'
,
// local includes are actually served
'includes/include2.js'
,
// through the local test webserver
'http://code.jquery.com/jquery-1.8.3.min.js'
];
casper
.
test
.
begin
(
'remote script includes tests'
,
4
,
{
setUp
:
function
()
{
casper
.
options
.
remoteScripts
=
[
'includes/include1.js'
,
// local includes are actually served
'includes/include2.js'
// through the local test webserver
];
},
casper
.
start
(
'tests/site/index.html'
,
function
()
{
test
.
assertSelectorHasText
(
'#include1'
,
'include1'
,
'Casper.includeRemoteScripts() includes a first remote script on start'
);
test
.
assertSelectorHasText
(
'#include2'
,
'include2'
,
'Casper.includeRemoteScripts() includes a second remote script on start'
);
test
.
assertEval
(
function
()
{
return
'jQuery'
in
window
;
},
'Casper.includeRemoteScripts() includes a really remote file on first step'
);
});
tearDown
:
function
()
{
casper
.
options
.
remoteScripts
=
[];
},
casper
.
thenOpen
(
'tests/site/form.html'
,
function
()
{
test
.
assertSelectorHasText
(
'#include1'
,
'include1'
,
'Casper.includeRemoteScripts() includes a first remote script on second step'
);
test
.
assertSelectorHasText
(
'#include2'
,
'include2'
,
'Casper.includeRemoteScripts() includes a second remote script on second step'
);
test
.
assertEval
(
function
()
{
return
'jQuery'
in
window
;
},
'Casper.includeRemoteScripts() includes a really remote file on second step'
);
});
test
:
function
(
test
)
{
casper
.
start
(
'tests/site/index.html'
,
function
()
{
test
.
assertSelectorHasText
(
'#include1'
,
'include1'
,
'Casper.includeRemoteScripts() includes a first remote script on start'
);
test
.
assertSelectorHasText
(
'#include2'
,
'include2'
,
'Casper.includeRemoteScripts() includes a second remote script on start'
);
});
casper
.
run
(
function
()
{
this
.
options
.
remoteScripts
=
[];
test
.
done
();
});
casper
.
thenOpen
(
'tests/site/form.html'
,
function
()
{
test
.
assertSelectorHasText
(
'#include1'
,
'include1'
,
'Casper.includeRemoteScripts() includes a first remote script on second step'
);
test
.
assertSelectorHasText
(
'#include2'
,
'include2'
,
'Casper.includeRemoteScripts() includes a second remote script on second step'
);
});
casper
.
run
(
function
()
{
test
.
done
();
});
}
});
...
...
Please
register
or
sign in
to post a comment