1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2013 Canonical
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 3, as published
6
# by the Free Software Foundation.
8
"""Filemanager app autopilot tests."""
12
from autopilot.input import Mouse, Touch, Pointer
13
from autopilot.platform import model
14
from autopilot.testcase import AutopilotTestCase
16
from time import sleep
18
from ubuntu_filemanager_app.emulators.main_window import MainWindow
21
class FileManagerTestCase(AutopilotTestCase):
23
"""A common test case class that provides several useful methods for
24
filemanager-app tests.
27
if model() == 'Desktop':
28
scenarios = [('with mouse', dict(input_device_class=Mouse))]
30
scenarios = [('with touch', dict(input_device_class=Touch))]
32
local_location = "../../ubuntu-filemanager-app.qml"
35
self.pointing_device = Pointer(self.input_device_class.create())
36
super(FileManagerTestCase, self).setUp()
37
if os.path.exists(self.local_location):
38
self.launch_test_local()
40
self.launch_test_installed()
42
def launch_test_local(self):
43
self.app = self.launch_test_application(
48
def launch_test_installed(self):
49
self.app = self.launch_test_application(
51
"/usr/share/ubuntu-filemanager-app/ubuntu-filemanager-app.qml",
52
"--desktop_file_hint=/usr/share/applications/ubuntu-filemanager-app.desktop",
55
def tap_item(self, item):
56
self.pointing_device.move_to_object(item)
57
self.pointing_device.press()
59
self.pointing_device.release()
62
def main_window(self):
63
return MainWindow(self.app)