Commit 59984894 59984894240c6cd6bc20585d98819883e95ef318 by Nicolas Perriault

fixed Casper#exists(), added Casper.Tester#assertExists() method

1 parent e9df8be7
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