fixed Casper#exists(), added Casper.Tester#assertExists() method
Showing
1 changed file
with
25 additions
and
0 deletions
samples/googletesting.js
0 → 100644
1 | phantom.injectJs("casper.js"); | ||
2 | |||
3 | var casper = new phantom.Casper({ | ||
4 | logLevel: "debug" | ||
5 | }); | ||
6 | |||
7 | casper.start('http://www.google.fr/', function(self) { | ||
8 | self.test.assertTitle('Google', 'google homepage title is the one expected'); | ||
9 | self.test.assertExists('form[name=f]', 'main form is found'); | ||
10 | self.fill('form[name=f]', { | ||
11 | q: 'foo' | ||
12 | }, true); | ||
13 | }); | ||
14 | |||
15 | casper.then(function(self) { | ||
16 | self.test.assertTitle('foo - Recherche Google', 'google title is ok'); | ||
17 | self.test.assertUrlMatch(/q=foo/, 'search term has been submitted'); | ||
18 | self.test.assertEval(function() { | ||
19 | return __utils__.findAll('h3.r').length >= 10; | ||
20 | }, 'google search for "foo" retrieves 10 or more results'); | ||
21 | }); | ||
22 | |||
23 | casper.run(function(self) { | ||
24 | self.test.renderResults(true); | ||
25 | }); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment