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
0cd63645
...
0cd6364511e7d1682ae46b609da0e9848a5207c4
authored
2012-12-29 17:55:38 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
throw real exceptions instead of die() when it makes sense
1 parent
8b140127
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
modules/casper.js
modules/casper.js
View file @
0cd6364
...
...
@@ -1687,10 +1687,10 @@ Casper.prototype.wait = function wait(timeout, then) {
this
.
checkStarted
();
timeout
=
~~
timeout
;
if
(
timeout
<
1
)
{
th
is
.
die
(
"wait() only accepts a positive integer > 0 as a timeout value"
);
th
row
new
CasperError
(
"wait() only accepts a positive integer > 0 as a timeout value"
);
}
if
(
then
&&
!
utils
.
isFunction
(
then
))
{
th
is
.
die
(
"wait() a step definition must be a function"
);
th
row
new
CasperError
(
"wait() a step definition must be a function"
);
}
return
this
.
then
(
function
_step
()
{
this
.
waitStart
();
...
...
@@ -1730,10 +1730,10 @@ Casper.prototype.waitFor = function waitFor(testFx, then, onTimeout, timeout) {
this
.
checkStarted
();
timeout
=
timeout
?
timeout
:
this
.
options
.
waitTimeout
;
if
(
!
utils
.
isFunction
(
testFx
))
{
th
is
.
die
(
"waitFor() needs a test function"
);
th
row
new
CasperError
(
"waitFor() needs a test function"
);
}
if
(
then
&&
!
utils
.
isFunction
(
then
))
{
th
is
.
die
(
"waitFor() next step definition must be a function"
);
th
row
new
CasperError
(
"waitFor() next step definition must be a function"
);
}
return
this
.
then
(
function
_step
()
{
this
.
waitStart
();
...
...
@@ -1742,7 +1742,8 @@ Casper.prototype.waitFor = function waitFor(testFx, then, onTimeout, timeout) {
var
interval
=
setInterval
(
function
_check
(
self
,
testFx
,
timeout
,
onTimeout
)
{
if
((
new
Date
().
getTime
()
-
start
<
timeout
)
&&
!
condition
)
{
condition
=
testFx
.
call
(
self
,
self
);
}
else
{
return
;
}
self
.
waitDone
();
if
(
!
condition
)
{
self
.
log
(
"Casper.waitFor() timeout"
,
"warning"
);
...
...
@@ -1759,7 +1760,6 @@ Casper.prototype.waitFor = function waitFor(testFx, then, onTimeout, timeout) {
}
}
clearInterval
(
interval
);
}
},
100
,
this
,
testFx
,
timeout
,
onTimeout
);
});
};
...
...
Please
register
or
sign in
to post a comment