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
59984894
...
59984894240c6cd6bc20585d98819883e95ef318
authored
2011-10-15 16:44:55 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed Casper#exists(), added Casper.Tester#assertExists() method
1 parent
e9df8be7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
samples/googletesting.js
samples/googletesting.js
0 → 100644
View file @
5998489
phantom
.
injectJs
(
"casper.js"
);
var
casper
=
new
phantom
.
Casper
({
logLevel
:
"debug"
});
casper
.
start
(
'http://www.google.fr/'
,
function
(
self
)
{
self
.
test
.
assertTitle
(
'Google'
,
'google homepage title is the one expected'
);
self
.
test
.
assertExists
(
'form[name=f]'
,
'main form is found'
);
self
.
fill
(
'form[name=f]'
,
{
q
:
'foo'
},
true
);
});
casper
.
then
(
function
(
self
)
{
self
.
test
.
assertTitle
(
'foo - Recherche Google'
,
'google title is ok'
);
self
.
test
.
assertUrlMatch
(
/q=foo/
,
'search term has been submitted'
);
self
.
test
.
assertEval
(
function
()
{
return
__utils__
.
findAll
(
'h3.r'
).
length
>=
10
;
},
'google search for "foo" retrieves 10 or more results'
);
});
casper
.
run
(
function
(
self
)
{
self
.
test
.
renderResults
(
true
);
});
\ No newline at end of file
Please
register
or
sign in
to post a comment