Commit 0b5aa6b0 0b5aa6b03a8ed53371dbee800ec648175b786dc3 by Nicolas Perriault

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

1 parent 59984894
Showing 1 changed file with 26 additions and 12 deletions
......@@ -296,24 +296,14 @@
},
/**
* Exits phantom.
*
* @param Number status Status
* @return Casper
*/
exit: function(status) {
phantom.exit(status);
return this;
},
/**
* Checks if an element matching the provided CSS3 selector exists in
* current page DOM.
*
* @param String selector A CSS3 selector
* @return Boolean
*/
exists: function(selector) {
return self.evaluate(function() {
return this.evaluate(function() {
return __utils__.exists('%selector%');
}, {
selector: selector
......@@ -321,6 +311,17 @@
},
/**
* Exits phantom.
*
* @param Number status Status
* @return Casper
*/
exit: function(status) {
phantom.exit(status);
return this;
},
/**
* Fills a form with provided field values.
*
* @param String selector A CSS3 selector to the target form to fill
......@@ -983,6 +984,19 @@
};
/**
* Asserts that an element matching the provided CSS3 selector exists in
* remote DOM.
*
* @param String selector CSS3 selectore
* @param String message Test description
*/
this.assertExists = function(selector, message) {
var f = casper.exists(selector)
console.log('plop')
return this.assert(casper.exists(selector), message);
};
/**
* Asserts that a provided string matches a provided RegExp pattern.
*
* @param String subject The string to test
......