Comparing version 0.0.5 to 0.0.6
(function() { | ||
var self = this; | ||
var _, finders, actions, query, angular; | ||
_ = require("underscore"); | ||
finders = require("./lib/finders"); | ||
actions = require("./lib/actions"); | ||
query = require("./lib/query"); | ||
var scope, angular; | ||
scope = require("./lib/scope"); | ||
angular = require("./lib/angular/bootstrap"); | ||
module.exports = function(element) { | ||
var self = this; | ||
return _.extend({}, finders(element), actions(element), query(element)); | ||
return scope(element); | ||
}; | ||
module.exports.bootstrapAngular = angular.bootstrapAngular; | ||
}).call(this); |
@@ -66,13 +66,27 @@ (function() { | ||
}, | ||
select: function(text, gen6_options, continuation) { | ||
clickLink: function(text, continuation) { | ||
var self = this; | ||
var gen6_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
text = gen6_arguments[0]; | ||
return self.click("a:contains(" + text + ")", continuation); | ||
}, | ||
clickButton: function(text, continuation) { | ||
var self = this; | ||
var gen7_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
text = gen7_arguments[0]; | ||
gen6_options = gen7_arguments[1]; | ||
return self.click("button:contains(" + text + ")", continuation); | ||
}, | ||
select: function(text, gen8_options, continuation) { | ||
var self = this; | ||
var gen9_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
text = gen9_arguments[0]; | ||
gen8_options = gen9_arguments[1]; | ||
var from; | ||
from = gen6_options !== void 0 && Object.prototype.hasOwnProperty.call(gen6_options, "from") && gen6_options.from !== void 0 ? gen6_options.from : void 0; | ||
return find(from, gen1_rethrowErrors(continuation, function(gen8_asyncResult) { | ||
from = gen8_options !== void 0 && Object.prototype.hasOwnProperty.call(gen8_options, "from") && gen8_options.from !== void 0 ? gen8_options.from : void 0; | ||
return find(from, gen1_rethrowErrors(continuation, function(gen10_asyncResult) { | ||
var selectElement; | ||
selectElement = gen8_asyncResult; | ||
selectElement = gen10_asyncResult; | ||
return continuation(void 0, selectElement.find("option").each(function(index, option) { | ||
@@ -86,13 +100,13 @@ if ($(option).text() === text) { | ||
}, | ||
fillIn: function(locator, gen9_options, continuation) { | ||
fillIn: function(locator, gen11_options, continuation) { | ||
var self = this; | ||
var gen10_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
var gen12_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
locator = gen10_arguments[0]; | ||
gen9_options = gen10_arguments[1]; | ||
locator = gen12_arguments[0]; | ||
gen11_options = gen12_arguments[1]; | ||
var withValue; | ||
withValue = gen9_options !== void 0 && Object.prototype.hasOwnProperty.call(gen9_options, "withValue") && gen9_options.withValue !== void 0 ? gen9_options.withValue : void 0; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen11_asyncResult) { | ||
withValue = gen11_options !== void 0 && Object.prototype.hasOwnProperty.call(gen11_options, "withValue") && gen11_options.withValue !== void 0 ? gen11_options.withValue : void 0; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen13_asyncResult) { | ||
var fillElement; | ||
fillElement = gen11_asyncResult; | ||
fillElement = gen13_asyncResult; | ||
fillElement.val(withValue); | ||
@@ -99,0 +113,0 @@ invoke(fillElement, "change", continuation); |
@@ -29,2 +29,17 @@ (function() { | ||
}; | ||
var gen3_asyncIfElse = function(condition, thenBody, elseBody, cb) { | ||
if (condition) { | ||
try { | ||
thenBody(cb); | ||
} catch (ex) { | ||
cb(ex); | ||
} | ||
} else { | ||
try { | ||
elseBody(cb); | ||
} catch (ex) { | ||
cb(ex); | ||
} | ||
} | ||
}; | ||
var self = this; | ||
@@ -40,17 +55,30 @@ var finders; | ||
var self = this; | ||
var gen3_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
var gen4_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
locator = gen3_arguments[0]; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen4_asyncResult) { | ||
return continuation(void 0, gen4_asyncResult.is(":visible")); | ||
locator = gen4_arguments[0]; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen5_asyncResult) { | ||
return continuation(void 0, gen5_asyncResult.is(":visible")); | ||
})); | ||
}, | ||
hasSelector: function(locator, continuation) { | ||
hasSelector: function(locator, gen6_options, continuation) { | ||
var self = this; | ||
var gen5_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
var gen7_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
locator = gen5_arguments[0]; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen6_asyncResult) { | ||
return continuation(void 0, gen6_asyncResult.length > 0); | ||
})); | ||
locator = gen7_arguments[0]; | ||
gen6_options = gen7_arguments[1]; | ||
var count; | ||
count = gen6_options !== void 0 && Object.prototype.hasOwnProperty.call(gen6_options, "count") && gen6_options.count !== void 0 ? gen6_options.count : void 0; | ||
return gen3_asyncIfElse(count, function(continuation) { | ||
var gen8_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen9_asyncResult) { | ||
return continuation(void 0, gen9_asyncResult.length === count); | ||
})); | ||
}, function(continuation) { | ||
var gen10_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen11_asyncResult) { | ||
return continuation(void 0, gen11_asyncResult.length > 0); | ||
})); | ||
}, continuation); | ||
} | ||
@@ -57,0 +85,0 @@ }; |
{ | ||
"name": "chinchilla", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "JQuery backed Capybara like browser automation", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -6,2 +6,27 @@ chinchilla | ||
This is work in progress | ||
# Purpose | ||
This framework was created specifically to test `angular` apps written in [PogoScript](http://pogoscript.org). While it could be useful to test any web appliction it will be difficult to use if you are not using PogoScript. You should really try PogoScript it is a far nicer way to write JavaScript. | ||
# How to use chinchilla | ||
## Finders | ||
``` | ||
browser.find!('.any-css-selector') | ||
``` | ||
## Actions | ||
``` | ||
browser.click!('.any-css-selector') | ||
browser.select!('Orange', from: 'select[name=fruit]') | ||
browser.fill in!('input.message', with value: 'Hello World') | ||
``` | ||
## Query | ||
``` | ||
browser.is visible!('.any-css-selector') | ||
browser.has selector!('.any-css-selector') | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1040130
27
26636
32