~abreu-alexandre/ubuntu-html5-theme/fix-toolbar-swipe

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntu_html5_container/tests/__init__.py

Add a better cordova qml component search pattern for the cordovaview mostly to account for the cordova 3.4 version that is to be installed locally; Add autopilot tests for the container,. Fixes: https://bugs.launchpad.net/bugs/1277665.

Approved by PS Jenkins bot, Alexandre Abreu, David Barth.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
2
# Copyright 2014 Canonical
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU Lesser General Public License version 3, as published
 
6
# by the Free Software Foundation.
 
7
 
 
8
"""Tests for the Ubuntu HTML5 Launcher package """
 
9
 
 
10
import os
 
11
from autopilot.testcase import AutopilotTestCase
 
12
 
 
13
LAUNCHER_EXEC_NAME = 'ubuntu-html5-app-launcher'
 
14
 
 
15
LOCAL_LAUNCHER_PATH = os.path.abspath("%s/%s" % (os.path.dirname(os.path.realpath(__file__))
 
16
                                        , '../../../../src/ubuntu-html5-app-launcher/' + LAUNCHER_EXEC_NAME))
 
17
INSTALLED_LAUNCHER_PATH = '/usr/bin/' + LAUNCHER_EXEC_NAME
 
18
 
 
19
 
 
20
class UbuntuHtml5LauncherTestCase (AutopilotTestCase):
 
21
    def setUp(self):
 
22
        self.app = None
 
23
        super(UbuntuHtml5LauncherTestCase, self).setUp()
 
24
 
 
25
    def tearDown(self):
 
26
        super(UbuntuHtml5LauncherTestCase, self).tearDown()
 
27
 
 
28
    def get_launcher_path(self):
 
29
        if os.path.exists(LOCAL_LAUNCHER_PATH):
 
30
            return LOCAL_LAUNCHER_PATH
 
31
        return INSTALLED_LAUNCHER_PATH
 
32
 
 
33
    def get_app(self):
 
34
        return self.app
 
35
 
 
36
    def launch_with_argument(self, args):
 
37
        try:
 
38
            self.app = self.launch_test_application(self.get_launcher_path(), args)
 
39
        except Exception, e:
 
40
            pass
 
41