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
8c7d533f
...
8c7d533fb27dfa66f2c51906bd73d28d80c7494c
authored
2013-02-16 11:14:12 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refs #369 - fixing asserts not performed on wait timeout
1 parent
edfade4b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
modules/casper.js
modules/tester.js
modules/casper.js
View file @
8c7d533
...
...
@@ -1765,8 +1765,8 @@ Casper.prototype.waitFor = function waitFor(testFx, then, onTimeout, timeout) {
self
.
waitDone
();
if
(
!
condition
)
{
self
.
log
(
"Casper.waitFor() timeout"
,
"warning"
);
self
.
emit
(
'waitFor.timeout'
);
var
onWaitTimeout
=
onTimeout
?
onTimeout
:
self
.
options
.
onWaitTimeout
;
self
.
emit
(
'waitFor.timeout'
,
timeout
,
onWaitTimeout
);
if
(
!
utils
.
isFunction
(
onWaitTimeout
))
{
throw
new
CasperError
(
'Invalid timeout function, exiting.'
);
}
...
...
modules/tester.js
View file @
8c7d533
...
...
@@ -143,7 +143,17 @@ var Tester = function Tester(casper, options) {
// casper events
this
.
casper
.
on
(
'error'
,
function
onCasperError
(
msg
,
backtrace
)
{
this
.
test
.
fail
(
msg
,
{
type
:
'error'
,
doThrow
:
false
,
values
:
{
stack
:
backtrace
}
});
});
this
.
casper
.
on
(
'waitFor.timeout'
,
function
onWaitForTimeout
(
timeout
)
{
this
.
warn
(
f
(
'wait timeout of %dms reached'
,
timeout
));
});
function
errorHandler
(
error
,
backtrace
)
{
...
...
@@ -186,10 +196,6 @@ var Tester = function Tester(casper, options) {
return
;
}
// onRunComplete
this
.
casper
.
options
.
onRunComplete
=
function
test_onRunComplete
(
casper
)
{
};
// specific timeout callbacks
this
.
casper
.
options
.
onStepTimeout
=
function
test_onStepTimeout
(
timeout
,
step
)
{
throw
new
TimedOutError
(
f
(
"Step timeout occured at step %s (%dms)"
,
step
,
timeout
));
...
...
@@ -235,11 +241,12 @@ Tester.prototype.assertTrue = function assert(subject, message, context) {
standard
:
"Subject is strictly true"
,
message
:
message
,
file
:
this
.
currentTestFile
,
doThrow
:
true
,
values
:
{
subject
:
utils
.
getPropertyPath
(
context
,
'values.subject'
)
||
subject
}
},
context
||
{});
if
(
!
result
.
success
)
{
if
(
!
result
.
success
&&
result
.
doThrow
)
{
throw
new
AssertionError
(
message
,
result
);
}
return
this
.
processAssertionResult
(
result
);
...
...
@@ -970,13 +977,15 @@ Tester.prototype.exec = function exec(file) {
* Adds a failed test entry to the stack.
*
* @param String message
* @param Object Failure context (optional)
*/
Tester
.
prototype
.
fail
=
function
fail
(
message
)
{
Tester
.
prototype
.
fail
=
function
fail
(
message
,
context
)
{
"use strict"
;
return
this
.
assert
(
false
,
message
,
{
context
=
context
||
{};
return
this
.
assert
(
false
,
message
,
utils
.
mergeObjects
({
type
:
"fail"
,
standard
:
"explicit call to fail()"
});
}
,
context
)
);
};
/**
...
...
Please
register
or
sign in
to post a comment