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
21cb5487
...
21cb54871c111eed110dfea8c81122c54325983a
authored
2012-03-22 21:07:00 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refs #64 - add Tester.assertTextExists
1 parent
8c9f8669
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
modules/tester.js
tests/suites/tester.js
modules/tester.js
View file @
21cb548
...
...
@@ -273,7 +273,9 @@ var Tester = function(casper, options) {
* @param String message Test description
*/
this
.
assertTextExists
=
function
assertTextExists
(
text
,
message
)
{
return
this
.
assert
(
(
casper
.
evaluate
(
function
(){
return
document
.
body
.
innerText
;
}
).
indexOf
(
text
)
!=
-
1
),
message
);
return
this
.
assert
((
casper
.
evaluate
(
function
()
{
return
document
.
body
.
innerText
;
}).
indexOf
(
text
)
!=
-
1
),
message
);
};
/**
...
...
tests/suites/tester.js
View file @
21cb548
...
...
@@ -42,4 +42,11 @@ var expected = [
});
t
.
assertEquals
(
files
,
expected
,
'findTestFiles() find test files and sort them'
);
t
.
done
();
t
.
comment
(
'Tester.assertTextExists()'
);
casper
.
start
(
'tests/site/index.html'
,
function
()
{
t
.
assertTextExists
(
'form'
,
'Tester.assertTextExists() checks that page body contains text'
);
});
casper
.
run
(
function
()
{
t
.
done
();
});
...
...
Please
register
or
sign in
to post a comment