????CasperJS ?????Щ????????????????? Web ??????й??????????????????????д???μ? JavaScript ????????? Google ????????

view source
print
01 var casper = require('casper').create();
02
03 casper.start('http://www.google.fr/'?? function() {
04     this.test.assertTitle('Google'?? 'google homepage title is the one expected');
05     this.test.assertExists('form[action="/search"]'?? 'main form is found');
06     this.fill('form[action="/search"]'?? {
07         q: 'foo'
08     }?? true);
09 });
10
11 casper.then(function() {
12     this.test.assertTitle('foo - Recherche Google'?? 'google title is ok');
13     this.test.assertUrlMatch(/q=foo/?? 'search term has been submitted');
14     this.test.assertEval(function() {
15         return __utils__.findAll('h3.r').length >= 10;
16     }?? 'google search for "foo" retrieves 10 or more results');
17 });
18
19 casper.run(function() {
20     this.test.renderResults(true);
21 });

??????????????casper.test ?? tester.Tester ?????????????????????????ж?????????

????tester.Tester API documentation ?? dedicated section.

?????????????????????????

????view source

????print?

????$ casperjs samples/googletest.js

?????????????н????

???????????????????????????????????

?????????????? xUnit ???