This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
/
app_uninstall_pending_test.js
76 lines (58 loc) · 1.99 KB
/
app_uninstall_pending_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* global __dirname */
'use strict';
var assert = require('assert');
var AppInstall =
require('../../../../apps/system/test/marionette/lib/app_install');
var createAppServer = require('./server/parent');
marionette('Homescreen - App uninstall while pending', function() {
var client = marionette.client({
profile: require(__dirname + '/client_options.js'),
desiredCapabilities: { raisesAccessibilityExceptions: false }
});
var actions, home, system, appInstall;
var server;
setup(function(done) {
var app = __dirname + '/fixtures/template_app';
createAppServer(app, client, function(err, _server) {
server = _server;
done(err);
});
});
setup(function() {
appInstall = new AppInstall(client);
actions = client.loader.getActions();
home = client.loader.getAppClass('homescreen');
system = client.loader.getAppClass('system');
// ensure that the zip file does not get sent
server.cork(server.applicationZipUri);
// wait for the system app to be running
system.waitForFullyLoaded();
client.apps.launch(home.URL);
// install the app
client.switchToFrame();
appInstall.installPackage(server.packageManifestURL);
// switch to the homescreen
client.switchToFrame(system.getHomescreenIframe());
});
test('uninstall the app', function() {
var icon = home.getIcon(server.packageManifestURL);
home.scrollIconToCenter(icon);
// remove the icon
actions.longPress(icon, 1).perform();
home.waitForEditBar();
home.removeButton.tap();
// confirm the dialog to ensure it was removed.
client.switchToFrame();
home.confirmDialog('remove');
// ensure the icon disappears
client.switchToFrame(system.getHomescreenIframe());
client.helper.waitForElementToDisappear(icon);
// make sure app has gone after restart
home.restart();
icon = null;
try {
icon = home.getIcon(server.packageManifestURL);
} catch(e) { }
assert.ok(!icon, 'app was not removed');
});
});