Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/apps/system/test/integration/system_integration.js
blob: 1116e17ca5de099324d16ed127da1157bd11b7d2 (plain)
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
require('/tests/js/app_integration.js');
require('/tests/js/integration_helper.js');

function SystemIntegration() {
  AppIntegration.apply(this, arguments);
}

SystemIntegration.prototype = {
  __proto__: AppIntegration.prototype,

  appName: 'System',

  selectors: {
    /** notifications */
    notificationsContainer: '#notifications-container'
  },

  /**
   * Override base launch method.
   * The system app is launched by directly
   * going to its url we we determine by getting
   * all the apps and finding the 'System' apps origin.
   */
  launch: function(callback) {
    var self = this;
    this.task(function(app, next, done) {
      var device = app.device;
      yield device.setScriptTimeout(5000);

      yield IntegrationHelper.importScript(
        device,
        '/tests/atoms/gaia_apps.js',
        MochaTask.nodeNext
      );

      var result = yield device.executeAsyncScript(
        'GaiaApps.locateWithName("' + self.appName + '");'
      );

      // locate the origin of the system app.
      // We must append the /index.html because of the app:// protocol.
      yield device.goUrl(result.origin + '/index.html');

      // complete the task
      done();
    }, callback);
  }

};