Unity 8
test_tutorial.py
1 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2 #
3 # Unity Autopilot Test Suite
4 # Copyright (C) 2014, 2015 Canonical
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #
19 
20 from autopilot.matchers import Eventually
21 from testtools.matchers import Equals
22 
23 from unity8.shell import (
24  fixture_setup,
25  tests
26 )
27 # unused import to load the tutorial helpers custom proxy objects.
28 from unity8 import tutorial as tutorial_helpers # NOQA
29 
30 
31 class TutorialTestCase(tests.UnityTestCase):
32 
33  def setUp(self):
34  super().setUp()
35  self._qml_mock_enabled = False
36  self._data_dirs_mock_enabled = False
37 
38  self.useFixture(fixture_setup.Tutorial(True))
39  self.unity = self.launch_unity()
40 
41  def test_complete_tutorial(self):
42  greeter = self.main_window.get_greeter()
43  tutorial = self.unity.select_single('Tutorial')
44  self.assertThat(tutorial.running, Eventually(Equals(True)))
45  greeter.swipe()
46  page = self.unity.wait_select_single(objectName='tutorialLeft')
47  page.short_swipe_right()
48  page = self.unity.wait_select_single(objectName='tutorialLeftFinish')
49  page.tap()
50  page = self.unity.wait_select_single(objectName='tutorialRight')
51  page.swipe_left()
52  page.tap()
53  page = self.unity.wait_select_single(objectName='tutorialBottom')
54  page.swipe_up()
55  page = self.unity.wait_select_single(objectName='tutorialBottomFinish')
56  page.tap()
57  self.assertThat(tutorial.running, Eventually(Equals(False)))