VulpesOS/gaia/tests/jsmarionette/plugins/marionette-apps/test/close_test.js
OverSu b38dea0597 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.
2026-09-30 23:13:03 +02:00

68 lines
1.7 KiB
JavaScript
Executable file

'use strict';
var assert = require('assert');
marionette('close', function() {
// requires
var Apps = require('../lib/apps'),
close = require('../lib/close').close,
launch = require('../lib/launch').launch,
client = marionette.client();
marionette.plugin('mozApps', Apps);
suite('close app', function() {
var origin = 'app://calendar.gaiamobile.org';
setup(function(done) {
launch(client.mozApps, origin, done);
});
setup(function(done) {
close(client.mozApps, origin, done);
});
test('iframe is gone', function(done) {
client.setSearchTimeout(100);
client.findElement('iframe[src*="' + origin + '"]', function(err, el) {
assert.ok(err, 'has error');
assert.equal(err.type, 'NoSuchElement', 'element is missing');
done();
});
});
});
suite('close entrypoint app', function() {
var origin = 'app://communications.gaiamobile.org';
// launch some other entrypoint
setup(function(done) {
launch(client.mozApps, origin, 'dialer', done);
});
// launch contacts (which we will close later)
var contacts;
setup(function(done) {
launch(client.mozApps, origin, 'contacts', function(err, app) {
contacts = app;
done(err);
});
});
setup(function(done) {
close(client.mozApps, origin, 'contacts', done);
});
test('closes right app', function(done) {
var source = origin + '/' + contacts.entrypoint.details.launch_path;
client.setSearchTimeout(100);
client.findElement('iframe[src*="' + source + '"]', function(err, el) {
assert.ok(err, 'has error');
assert.equal(err.type, 'NoSuchElement', 'element is missing');
done();
});
});
});
});