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:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,71 @@
/* global DeviceInteraction, exampleCmds, helper */
'use strict';
require('../helper');
suite('scope', function() {
var client = marionette.client(),
Actions,
device,
subject;
helper.require('actions', function(obj) {
Actions = obj;
});
device = new DeviceInteraction(exampleCmds, function() {
return subject;
});
suite('actions', function() {
setup(function() {
subject = new Actions(client);
});
test('can move the page', function() {
var bodyElement;
client.goUrl('http://yahoo.com');
client.waitFor(function() {
client.findElement('body', function(error, element) {
if (error) {
console.log('cannot find');
return;
}
bodyElement = element;
});
if (bodyElement !== undefined) {
return true;
}
});
subject.
press(bodyElement, 100, 100).
moveByOffset(0, 10).
perform();
// TODO: Bug 965385 - Use `Actions#wait` in integration tests
// Model this pause with an invocation of `Actions#wait` once "Bug 962645
// - Action chains only handle one press->release chain" is resolved.
client.executeAsyncScript(function() {
setTimeout(marionetteScriptFinished, 50);
});
subject.
release().
perform();
// TODO: Bug 965385 - Use `Actions#wait` in integration tests
// Model this pause with an invocation of `Actions#wait` once "Bug 962645
// - Action chains only handle one press->release chain" is resolved.
client.executeAsyncScript(function() {
setTimeout(marionetteScriptFinished, 50);
});
subject.
flick(bodyElement, 0, 0, 0, 200).
perform();
});
});
});

View file

@ -0,0 +1,29 @@
/* global marionette, setup */
'use strict';
var querystring = require('querystring');
suite('client methods', function() {
var client = marionette.client();
setup(function() {
client.goUrl('data:text/html,' + querystring.escape(
'<div id="host"></div>'));
client.executeScript(function() {
var host = document.getElementById('host');
var root = host.createShadowRoot();
var button = document.createElement('button');
button.id = 'button';
button.textContent = 'Foo';
root.appendChild(button);
});
});
test('#switchToShadowRoot', function() {
var host = client.findElement('#host');
client.switchToShadowRoot(host);
var button = client.findElement('#button');
button.click();
});
});

View file

@ -0,0 +1,18 @@
/* global assert */
'use strict';
require('../../helper');
suite('drivers/tcp-sync', function() {
var client = marionette.client();
test('can execute sync commands', function() {
client.goUrl('http://yahoo.com');
client.goUrl('http://google.com');
client.goUrl('http://yahoo.com');
var location = client.executeScript(function() {
return window.location.href;
});
assert.ok(location.indexOf('yahoo.com') !== -1);
});
});

View file

@ -0,0 +1,84 @@
/* global assert */
'use strict';
var querystring = require('querystring');
require('../helper');
suite('element methods', function() {
var client = marionette.client();
setup(function() {
client.goUrl('data:text/html,' + querystring.escape(
'<div id="el" style="width: 50px; height: 50px">cheese</div>'));
});
test('#displayed', function() {
var element = client.findElement('html');
assert.strictEqual(element.displayed(), true);
});
test('#scriptWith', function() {
var element = client.findElement('html');
var evaled = element.scriptWith(function(el, arg) {
return el.tagName + ' ' + arg;
}, ['FTW!']);
assert.equal(evaled, 'HTML FTW!');
});
test('#findElement', function() {
var el = client.findElement('html');
assert.instanceOf(el, client.Element);
});
test('#findElements', function() {
var els = client.findElements('html');
assert.isArray(els);
els.forEach(function(el) { assert.instanceOf(el, client.Element); });
});
test('#findElement - missing', function() {
var err;
try {
client.findElement('#fooobaramazingmissing');
} catch (e) {
err = e;
}
if (!err) throw new Error('missing element did not trigger an error');
assert.equal(err.type, 'NoSuchElement');
});
test('#cssProperty', function() {
var body = client.findElement('body');
var font = body.cssProperty('font-size');
assert.ok(font, 'returns a css property value');
});
test('#size', function () {
var element = client.findElement('#el');
var size = element.size();
assert.property(size, 'width');
assert.property(size, 'height');
assert.equal(size.width, 50);
assert.equal(size.height, 50);
});
test('#location', function () {
var element = client.findElement('#el');
var location = element.location();
assert.property(location, 'x');
assert.property(location, 'y');
});
test('#rect', function () {
var element = client.findElement('#el');
var rect = element.rect();
assert.property(rect, 'x');
assert.property(rect, 'y');
assert.property(rect, 'width');
assert.property(rect, 'height');
assert.equal(rect.width, 50);
assert.equal(rect.height, 50);
});
});

View file

@ -0,0 +1,43 @@
/* global assert, helper */
'use strict';
require('../helper');
suite('error handling', function() {
var MarionetteError;
helper.require('error', function(obj) {
MarionetteError = obj;
});
var client = marionette.client();
test('catch error', function() {
try {
client.executeScript(function() {
throw new Error('e');
});
} catch (e) {
e.client.screenshot();
}
});
test('throws no such element error', function() {
try {
client.findElement('cheese');
assert.fail('expected no such element error to be thrown');
} catch (e) {
assert.include(e.toString(), 'NoSuchElement');
assert.property(e, 'type');
assert.equal(e.type, 'NoSuchElement');
}
});
test('throws javascript error', function() {
try {
client.executeScript(function() { throw Error('rochefort'); });
} catch (e) {
assert.include(e.toString(), 'JavaScriptError');
assert.property(e, 'type');
assert.equal(e.type, 'JavaScriptError');
}
});
});

View file

@ -0,0 +1,18 @@
'use strict';
module.exports.skipInitialError = function (client) {
setup(function(done) {
client.executeAsyncScript(function() {
setTimeout(marionetteScriptFinished, 10);
}, function(err) {
// hacked work around for gaia exception at startup.
if (
err &&
err.message &&
err.message.indexOf('Expected IccHelper') !== -1
) {
return done();
}
done(err);
});
});
};

View file

@ -0,0 +1,36 @@
/* global assert */
'use strict';
require('../helper');
suite('scope', function() {
var client = marionette.client(),
helper = require('./helper'),
timeoutA,
timeoutB;
helper.skipInitialError(client);
setup(function() {
timeoutA = client.scope({ scriptTimeout: 1000 });
timeoutB = client.scope({ scriptTimeout: 250 });
});
test('should handle scope switching', function() {
function sleep() {
setTimeout(function() {
marionetteScriptFinished();
}, 600);
}
timeoutA.executeAsyncScript(sleep);
var err;
try {
timeoutB.executeAsyncScript(sleep);
} catch (e) {
err = e;
}
// sleep throws error on shorter timeout
assert.ok(err);
});
});

View file

@ -0,0 +1,95 @@
/* global assert */
'use strict';
require('../helper');
suite('scope', function() {
var client = marionette.client(),
helper = require('./helper');
helper.skipInitialError(client);
suite('sync waitFor', function() {
test('should not yield in sync code', function() {
var tries = 0;
var succeed = 10;
// short signature
client.waitFor(function() {
return (++tries === succeed);
});
assert.strictEqual(tries, 10);
});
test('should eventually timeout', function() {
var timeout = 450;
var start = Date.now();
var err;
try {
client.waitFor(function() {
return false;
}, { timeout: timeout });
} catch (e) {
err = e;
}
assert.ok(err);
assert.operator(Date.now() - start, '>=', timeout);
});
test('should do the mocha sync', function() {
var tries = 0, success = 3;
client.waitFor(function fn(waitForComplete) {
tries += 1;
if (tries === success) {
waitForComplete(null, true);
}
setTimeout(fn.bind(this, waitForComplete), 10);
});
assert.strictEqual(tries, success);
});
test('should do the mocha fail sync', function(done) {
var err = new Error('failure!');
try {
client.waitFor(function(waitForComplete) {
waitForComplete(err);
});
} catch (e) {
assert.strictEqual(e, err);
done();
}
});
});
suite('callback style wait for calls', function() {
test('should throw an error when given', function() {
var err = new Error('failure!');
var isSync = false;
try {
client.waitFor(function(waitForComplete) {
waitForComplete(err);
}, function(e) {
assert.strictEqual(e, err);
isSync = true;
});
} catch(e) {
assert.equal(e, err);
}
assert.ok(isSync, 'callback style is sync');
});
test('should fire when async condition is met', function() {
var tries = 0;
var success = 3;
client.waitFor(function() {
return ++tries === success;
}, function() {
assert.strictEqual(tries, 3);
});
assert.equal(tries, 3, 'is sync');
});
});
});