Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chinchilla

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chinchilla - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

build/lib/assertions.js

8

build/index.js
(function() {
var self = this;
var scope, angular;
var scope, assertions, angular;
scope = require("./lib/scope");
assertions = require("./lib/assertions");
angular = require("./lib/angular/bootstrap");
module.exports = function(element) {
module.exports = function(element, config) {
var self = this;
return scope(element);
return scope(element, config);
};
module.exports.bootstrapAngular = angular.bootstrapAngular;
module.exports.assertions = assertions;
}).call(this);

@@ -30,8 +30,5 @@ (function() {

var self = this;
var finders;
finders = require("./finders");
module.exports = function(element) {
module.exports = function(scope) {
var self = this;
var find, invoke;
find = finders(element).find;
var invoke;
invoke = function(el, eventName, continuation) {

@@ -58,3 +55,3 @@ el.one(eventName, function(e) {

first = gen3_options !== void 0 && Object.prototype.hasOwnProperty.call(gen3_options, "first") && gen3_options.first !== void 0 ? gen3_options.first : false;
return find(locator, gen1_rethrowErrors(continuation, function(gen5_asyncResult) {
return scope.find(locator, gen1_rethrowErrors(continuation, function(gen5_asyncResult) {
var el;

@@ -90,3 +87,3 @@ el = gen5_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) {
return scope.find(from, gen1_rethrowErrors(continuation, function(gen10_asyncResult) {
var selectElement;

@@ -110,3 +107,3 @@ selectElement = gen10_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) {
return scope.find(locator, gen1_rethrowErrors(continuation, function(gen13_asyncResult) {
var fillElement;

@@ -113,0 +110,0 @@ fillElement = gen13_asyncResult;

@@ -32,3 +32,3 @@ (function() {

waitUntil = require("./waitUntil").waitUntil;
module.exports = function(element) {
module.exports = function(scope) {
var self = this;

@@ -47,6 +47,8 @@ return {

}
return continuation(void 0, element.find(locator).length > 0);
return continuation(void 0, scope.element.find(locator).length > 0);
}, {
scope: scope
}, gen2_rethrowErrors(continuation, function(gen5_asyncResult) {
gen5_asyncResult;
return continuation(void 0, element.find(locator));
return continuation(void 0, scope.element.find(locator));
}));

@@ -53,0 +55,0 @@ }

@@ -29,55 +29,32 @@ (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;
var finders;
finders = require("./finders");
module.exports = function(element) {
module.exports = function(scope) {
var self = this;
var find;
find = finders(element).find;
return {
isVisible: function(locator, continuation) {
var self = this;
var gen4_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1);
var gen3_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1);
continuation = gen2_continuationOrDefault(arguments);
locator = gen4_arguments[0];
return find(locator, gen1_rethrowErrors(continuation, function(gen5_asyncResult) {
return continuation(void 0, gen5_asyncResult.is(":visible"));
locator = gen3_arguments[0];
return scope.find(locator, gen1_rethrowErrors(continuation, function(gen4_asyncResult) {
return continuation(void 0, gen4_asyncResult.is(":visible"));
}));
},
hasSelector: function(locator, gen6_options, continuation) {
hasSelector: function(locator, gen5_options, continuation) {
var self = this;
var gen7_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1);
var gen6_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1);
continuation = gen2_continuationOrDefault(arguments);
locator = gen7_arguments[0];
gen6_options = gen7_arguments[1];
locator = gen6_arguments[0];
gen5_options = gen6_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);
count = gen5_options !== void 0 && Object.prototype.hasOwnProperty.call(gen5_options, "count") && gen5_options.count !== void 0 ? gen5_options.count : void 0;
return scope.find(locator, gen1_rethrowErrors(continuation, function(gen7_asyncResult) {
var numberOfElements;
numberOfElements = gen7_asyncResult.length;
if (count) {
return continuation(void 0, numberOfElements === count);
} else {
return continuation(void 0, numberOfElements > 0);
}
}));
}

@@ -84,0 +61,0 @@ };

@@ -30,3 +30,3 @@ (function() {

var self = this;
var _, finders, actions, query;
var _, finders, actions, query, defaultConfig;
_ = require("underscore");

@@ -36,11 +36,20 @@ finders = require("./finders");

query = require("./query");
module.exports = function(element) {
defaultConfig = {
timeout: 1e3
};
module.exports = function(element, config) {
var self = this;
return _.extend({}, finders(element), actions(element), query(element), module.exports.scope(element));
var scope;
if (!config) {
config = defaultConfig;
}
scope = {
timeout: config.timeout,
element: element
};
return _.extend(scope, finders(scope), actions(scope), query(scope), module.exports.scope(scope));
};
module.exports.scope = function(element) {
module.exports.scope = function(scope) {
var self = this;
var find, scope;
find = finders(element).find;
return scope = {
return {
within: function(locator, block, continuation) {

@@ -55,3 +64,3 @@ var self = this;

}
return find(locator, gen1_rethrowErrors(continuation, function(gen4_asyncResult) {
return scope.find(locator, gen1_rethrowErrors(continuation, function(gen4_asyncResult) {
var element;

@@ -58,0 +67,0 @@ element = gen4_asyncResult;

@@ -23,6 +23,13 @@ (function() {

gen2_options = gen3_arguments[1];
var timeout, waitBetweenChecks;
timeout = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "timeout") && gen2_options.timeout !== void 0 ? gen2_options.timeout : 1e3;
var scope, timeout, waitBetweenChecks;
scope = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "scope") && gen2_options.scope !== void 0 ? gen2_options.scope : void 0;
timeout = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "timeout") && gen2_options.timeout !== void 0 ? gen2_options.timeout : void 0;
waitBetweenChecks = gen2_options !== void 0 && Object.prototype.hasOwnProperty.call(gen2_options, "waitBetweenChecks") && gen2_options.waitBetweenChecks !== void 0 ? gen2_options.waitBetweenChecks : 20;
var maxNumberOfRuns, numberOfRuns, wait;
if (!timeout && scope) {
timeout = scope.timeout;
}
if (!timeout) {
timeout = 1e3;
}
maxNumberOfRuns = Math.round(timeout / waitBetweenChecks);

@@ -29,0 +36,0 @@ numberOfRuns = 0;

{
"name": "chinchilla",
"version": "0.0.6",
"version": "0.0.7",
"description": "JQuery backed Capybara like browser automation",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -12,2 +12,9 @@ chinchilla

You will want to use this with browserify:
```
chinchilla = require 'chinchilla'
browser = chinchilla($('body'))
```
## Finders

@@ -23,2 +30,4 @@

browser.click!('.any-css-selector')
browser.click link!('text in link')
browser.click button!('text in button')
browser.select!('Orange', from: 'select[name=fruit]')

@@ -33,2 +42,10 @@ browser.fill in!('input.message', with value: 'Hello World')

browser.has selector!('.any-css-selector')
browser.has selector?('.cart .product', count: 5)
```
## Scope
```
browser.within('.product') @(scope)
scope.click button!('buy now')
```

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc