Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
|
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
|
||||
marionette('default client', function() {
|
||||
// create a client.
|
||||
var client = marionette.client();
|
||||
|
||||
test('is sync', function() {
|
||||
var result = client.executeScript(function() {
|
||||
// attempt to dirty global state
|
||||
window.wrappedJSObject.I_WAS_BAD = true;
|
||||
|
||||
// do complicated math in gecko
|
||||
return 1 + 1;
|
||||
});
|
||||
|
||||
// math works
|
||||
assert.equal(result, 2, 'tests are async');
|
||||
|
||||
// state is saved inside of same test
|
||||
var bad = client.executeScript(function() {
|
||||
return window.wrappedJSObject.I_WAS_BAD;
|
||||
});
|
||||
assert.ok(bad, 'state is saved');
|
||||
});
|
||||
|
||||
test('host is reset is each test', function() {
|
||||
var bad = client.executeScript(function() {
|
||||
return window.wrappedJSObject.I_WAS_BAD;
|
||||
});
|
||||
assert.ok(!bad, 'state is clean');
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
|
||||
marionette('client with options', function() {
|
||||
// create a client.
|
||||
var options = {
|
||||
screen: {
|
||||
width: 353,
|
||||
height: 577
|
||||
}
|
||||
};
|
||||
var client = marionette.client({ profile: { hostOptions: options } });
|
||||
|
||||
test('screen size', function() {
|
||||
var result = client.executeScript(function() {
|
||||
return { width: window.innerWidth,
|
||||
height: window.innerHeight};
|
||||
});
|
||||
|
||||
assert.equal(result.width, options.screen.width);
|
||||
assert.equal(result.height, options.screen.height);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
|
||||
marionette('client async', function() {
|
||||
var Tcp = require('marionette-client').Drivers.Tcp;
|
||||
var client = marionette.client({ driver: Tcp });
|
||||
|
||||
function onePlusOne() {
|
||||
return 1 + 1;
|
||||
}
|
||||
|
||||
test('async magic', function(done) {
|
||||
var isAsync = false;
|
||||
client.executeScript(onePlusOne, function(err, result) {
|
||||
if (!isAsync) return done(new Error('is sync!'));
|
||||
assert.equal(result, 2);
|
||||
done();
|
||||
});
|
||||
isAsync = true;
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
|
||||
marionette('client with capabilities', function() {
|
||||
// create a client and set desired capabilities.
|
||||
var client = marionette.client({
|
||||
desiredCapabilities: { desiredCapability: true }
|
||||
});
|
||||
|
||||
test('test capabilities', function(done) {
|
||||
client.sessionCapabilities(function(err, capabilities) {
|
||||
// Capabilities are set
|
||||
assert.ok(capabilities.desiredCapability);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
|
||||
marionette('multi-client', function() {
|
||||
var one = marionette.client();
|
||||
var two = marionette.client();
|
||||
|
||||
test('ports are not equal', function() {
|
||||
assert.notEqual(
|
||||
one.driver.port,
|
||||
two.driver.port
|
||||
);
|
||||
});
|
||||
|
||||
// run a quick test to verify client works
|
||||
function validateClient(name, client) {
|
||||
test(name, function() {
|
||||
var result = client.executeScript(function() {
|
||||
return 1 + 1;
|
||||
});
|
||||
assert.equal(result, 2);
|
||||
});
|
||||
}
|
||||
|
||||
validateClient('first client', one);
|
||||
validateClient('second client', two);
|
||||
});
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
|
||||
// Global plugin
|
||||
marionette.plugin('globalme', function() {
|
||||
return { isGlobal: true };
|
||||
});
|
||||
|
||||
marionette('plugins', function() {
|
||||
function PluginA(client, options) {
|
||||
return PluginA;
|
||||
}
|
||||
|
||||
var pluginId = 0;
|
||||
function PluginB(client, options) {
|
||||
return { id: ++pluginId };
|
||||
}
|
||||
|
||||
// create global plugin
|
||||
marionette.plugin('a', PluginA);
|
||||
marionette.plugin('b', PluginB);
|
||||
|
||||
var client = marionette.client();
|
||||
|
||||
test('global plugin is exposed', function() {
|
||||
assert(client.globalme.isGlobal);
|
||||
});
|
||||
|
||||
test('a is exposed', function() {
|
||||
assert.strictEqual(client.a, PluginA);
|
||||
});
|
||||
|
||||
test('plugins are created for each test', function() {
|
||||
assert.equal(client.b.id, 3);
|
||||
});
|
||||
|
||||
suite('overrides plugin a', function() {
|
||||
function MyA() { return MyA; }
|
||||
|
||||
marionette.plugin('a', MyA);
|
||||
|
||||
test('can override plugins', function() {
|
||||
assert.strictEqual(client.a, MyA);
|
||||
});
|
||||
});
|
||||
|
||||
suite('a is reset after suite to original', function() {
|
||||
test('after other suite', function() {
|
||||
assert.deepEqual(client.a, PluginA);
|
||||
});
|
||||
|
||||
test('b is still plugin b', function() {
|
||||
assert.equal(client.b.id, 6);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue