New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browser-monkey

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-monkey - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

28

index.js

@@ -122,3 +122,3 @@ var retry = require('trytryagain');

if (predicate) {
if (!predicate(els)) {
if (!predicate(els.toArray())) {
throw new Error(message || 'expected elements to pass predicate');

@@ -206,3 +206,3 @@ }

Selector.prototype.findElement = function (options) {
Selector.prototype.findElements = function (options) {
var self = this;

@@ -231,3 +231,3 @@ var allowMultiple = options && options.hasOwnProperty('allowMultiple')? options.allowMultiple: false;

}
return elements;
return elements.toArray();
};

@@ -239,3 +239,3 @@

return retry(options, function() {
return self.findElement(options);
return self.findElements(options);
});

@@ -250,3 +250,3 @@ };

try {
self.findElement({allowMultiple: true});
self.findElements({allowMultiple: true});
found = true;

@@ -266,3 +266,3 @@ } catch (e) {

Selector.prototype.shouldExist = function (options) {
return this.resolve(options);
return this.resolve(options).then(function () {});
};

@@ -279,3 +279,5 @@

Selector.prototype.element = function (options) {
return this.resolve();
return this.resolve(options).then(function (elements) {
return elements[0];
});
};

@@ -310,4 +312,4 @@

Selector.prototype.click = function(options) {
return this.resolve(options).then(function($element) {
return sendclick($element[0]);
return this.element(options).then(function(element) {
return sendclick(element);
});

@@ -317,4 +319,4 @@ };

Selector.prototype.typeIn = function(text, options) {
return this.resolve(options).then(function($element) {
return sendkeys($element[0], text);
return this.element(options).then(function(element) {
return sendkeys(element, text);
});

@@ -324,4 +326,4 @@ };

Selector.prototype.typeInHtml = function(html, options) {
return this.resolve(options).then(function($element) {
return sendkeys.html($element[0], html);
return this.element(options).then(function(element) {
return sendkeys.html(element, html);
});

@@ -328,0 +330,0 @@ };

{
"name": "browser-monkey",
"version": "1.7.0",
"version": "1.8.0",
"description": "reliable dom testing",

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

@@ -215,3 +215,3 @@ # browser monkey

Assert that a scope has certain properties
Assert that a scope has certain properties.

@@ -222,4 +222,2 @@ ```js

* `options.timeout` - length of time to wait for the element (1000ms)
* `options.interval` - time between testing the dom (10ms)
* `options.text` - a string, expects the resolved scope to have the text. If an array of strings, expects the elements to have the same number of elements as there are strings in the array, and expects each string to be found in each respective element's text.

@@ -231,1 +229,29 @@ * `options.css` - a CSS string. Expects the resolved element to be matched by the CSS selector. Note that it won't match if the element contains other elements that match the CSS selector. So if we have `{css: '.class'}` then we expect the resolved element to have a class `class`.

* `options.message` - the error message
* `options.timeout` - length of time to wait for the element (1000ms)
* `options.interval` - time between testing the dom (10ms)
## elements
Returns a promise resolving to the list of elements matched by the scope.
```js
scope.elements([options]).then(function (elements) {
});
```
* `elements` - the HTML DOM elements matched by the scope.
* `options.timeout` - length of time to wait for the element (1000ms)
* `options.interval` - time between testing the dom (10ms)
## element
Returns a promise resolving to the single element matched by the scope, it will be rejected if there are multiple.
```js
scope.element([options]).then(function (element) {
});
```
* `element` - the HTML DOM element matched by the scope.
* `options.timeout` - length of time to wait for the element (1000ms)
* `options.interval` - time between testing the dom (10ms)

@@ -163,9 +163,9 @@ var browser = require('..');

var good1 = browser.find('.element').shouldHave({elements: function (elements) {
return elements.text() == 'a';
return $(elements).text() == 'a';
}});
var good2 = browser.find('.element').shouldHave(function (elements) {
return elements.text() == 'a';
return $(elements).text() == 'a';
});
var bad1 = browser.find('.element').shouldHave({elements: function (elements) {
return elements.text() == 'b';
return $(elements).text() == 'b';
}, message: 'expected to have text b'});

@@ -204,3 +204,3 @@

return promise.then(function (element) {
expect(element.is('.outer')).to.be.true;
expect($(element).is('.outer')).to.be.true;
});

@@ -250,6 +250,6 @@ });

return browser.scope(red).find('.element').shouldExist().then(function (element) {
return browser.scope(red).find('.element').element().then(function (element) {
expect($(element).text()).to.equal('red');
}).then(function () {
return browser.scope(blue).find('.element').shouldExist();
return browser.scope(blue).find('.element').element();
}).then(function (element) {

@@ -264,6 +264,6 @@ expect($(element).text()).to.equal('blue');

return browser.scope(browser.find('.red')).find('.element').shouldExist().then(function (element) {
return browser.scope(browser.find('.red')).find('.element').element().then(function (element) {
expect($(element).text()).to.equal('red');
}).then(function () {
return browser.scope(browser.find('.blue')).find('.element').shouldExist();
return browser.scope(browser.find('.blue')).find('.element').element();
}).then(function (element) {

@@ -270,0 +270,0 @@ expect($(element).text()).to.equal('blue');

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