10
10
from __future__ import absolute_import
12
12
from qml_phone_shell.tests import FormFactors
13
from qml_phone_shell.tests.helpers import TestShellHelpers
14
15
from testtools.matchers import Equals, NotEquals, GreaterThan
15
16
from autopilot.matchers import Eventually
20
21
from os import path
22
class TestShell(object):
23
class TestShell(TestShellHelpers):
23
24
"""Tests the Shell"""
25
def unlock_greeter(self):
26
greeter = self.main_window.get_greeter()
28
login_loader = self.main_window.get_login_loader()
29
self.assertThat(login_loader.progress, Eventually(Equals(1)))
30
login_list = self.main_window.get_login_list()
31
path_view = login_list.get_children_by_type("QQuickPathView")[0]
32
users = path_view.get_children_by_type("QQuickItem")
35
user_label = user.get_children_by_type("Label")[0]
36
if user_label.text == "Guest":
37
self.pointing_device.move_to_object(user_label)
38
self.pointing_device.click()
42
password_field = login_list.get_children_by_type("TextField")[0]
43
self.pointing_device.move_to_object(password_field)
44
self.assertThat(password_field.opacity, Eventually(Equals(1)))
45
self.pointing_device.click()
48
rect = greeter.globalRect
49
start_x = rect[0] + rect[2] - 1
50
start_y = int(rect[1] + rect[3] / 2)
51
stop_x = int(rect[0] + rect[2] / 2)
53
self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
55
self.assertThat(greeter.shown, Eventually(Equals(False)))
58
26
def test_example_test_all(self):
59
27
self.unlock_greeter()