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

marionette-helper

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marionette-helper - npm Package Compare versions

Comparing version 0.0.1 to 0.0.3

profile.js

21

index.js

@@ -43,3 +43,2 @@ /**

* Only ever use this for debugging!
* @param {Marionette.Client} client marionette client to use.
* @param {number} millis number of seconds to sleep.

@@ -101,13 +100,25 @@ */

* Find some element and wait for it to be displayed.
* @param {Marionette.Client} client marionette client to use.
* @param {Marionette.Element|string} el element or some css selector.
* @return {Marionette.Element} Element we find with css selector.
*/
waitForElement: function(client, el) {
waitForElement: function(el) {
var client = this.client;
// make sure that we could get the element in DOM
if (typeof el === 'string') {
el = this.client.findElement(el);
client.waitFor(function() {
var condition = false;
client.findElement(el, function(error, element) {
if (error) {
return;
}
el = element;
condition = true;
});
return condition;
});
}
this.client.waitFor(function() { return el.displayed(); });
client.waitFor(function() { return el.displayed(); });
return el;
}
};
{
"name": "marionette-helper",
"version": "0.0.1",
"version": "0.0.3",
"author": {

@@ -10,3 +10,3 @@ "name": "Gareth Aye",

"dependencies": {
"marionette-client": "0.10.0"
"marionette-client": "~0.12.0"
},

@@ -16,4 +16,6 @@

"marionette-host-environment": "0.3.3",
"marionette-js-runner": "0.0.1-alpha.3",
"mocha": "1.12.0"
"marionette-js-runner": "~0.0.1",
"mozilla-download": "~0.2.1",
"mocha": "1.12.0",
"sinon": "1.7.2"
},

@@ -38,4 +40,4 @@

"type": "git",
"url": "https://github.com/mozilla-b2g/marionette-helper.git"
"url": "https://github.com/evanxd/marionette-helper.git"
}
}
suite('MarionetteHelper', function() {
Helper.client({
plugins: {
helper: require('../index')
}
});
var subject;
var subject;
var client = createClient();
marionette.plugin('helper', require('../index'));
setup(function() {
subject = this.client.helper;
subject = client.helper;
});

@@ -12,0 +10,0 @@

@@ -1,3 +0,2 @@

var Host = require('marionette-host-environment'),
Marionette = require('marionette-client');
var Marionette = require('marionette-client');

@@ -8,120 +7,22 @@

global.path = require('path');
global.sinon = require('sinon');
/**
* File path to B2G.
* @const {string}
* wrapper for marionette.client but with async/sync switching.
*
* @return {Marionette.Client} client instance.
*/
global.B2G_PATH = path.resolve(__dirname, '../b2g');
global.Helper = {
/**
* Creates the marionette client given some options.
*
* suite('my test', function() {
* Helper.client({
* plugins: {
* 'apps': require('apps')
* }
* });
*
* test('apps', function() {
* this.client.apps = xx;
* });
* });
*/
client: function(options) {
var b2g;
setup(function(done) {
Helper.spawn(options, function(client, child) {
b2g = child;
this.client = client;
done();
}.bind(this));
});
teardown(function(done) {
this.client.deleteSession(function() {
b2g.kill();
done();
});
});
},
/**
* Spawn a b2g instance and connect to its marionette server.
*
* Options:
* - (Boolean) sync: when true uses sync driver.
*
* @param {Object} options for spawn.
* @param {Function} cb Some function to call when we finish.
*/
spawn: function(spawnOpts, cb) {
if (typeof spawnOpts === 'function') {
cb = spawnOpts;
spawnOpts = {};
global.createClient = function() {
// profile
var profile = {
settings: {
'ftu.manifestURL': null,
'lockscreen.enabled': false
}
};
var options = {
settings: {
'ftu.manifestURL': null,
'lockscreen.enabled': false
}
};
Host.spawn(B2G_PATH, options, function(err, port, childProcess) {
if (err) {
throw err;
}
if (process.env.DEBUG) {
childProcess.stdout.pipe(process.stdout);
}
var driverClass = process.env.SYNC ?
Marionette.Drivers.TcpSync : Marionette.Drivers.Tcp;
var driver = new driverClass({ port: port });
driver.connect(function() {
client = new Marionette.Client(driver);
if (spawnOpts && spawnOpts.plugins) {
for (var key in spawnOpts.plugins) {
client.plugin(key, spawnOpts.plugins[key]);
}
}
client.startSession(function() {
cb(client, childProcess);
});
});
});
},
/**
* Sets up the plugin.
*
* Helper.setup(function(client, process, apps) {
*
* });
*
* @param {Object} options see #spawn.
* @param {Function} callback see above.
*/
setup: function(opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
var Apps = require('../lib/apps');
this.spawn(opts, function(client, process) {
client.plugin('appsCore', Apps);
callback(client, process);
});
}
var Driver = (process.env.SYNC) ?
Marionette.Drivers.TcpSync : Marionette.Drivers.Tcp;
return marionette.client(profile, Driver);
};

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