Merge lp:~kissiel/checkbox/autopilot-scenarios into lp:checkbox

Proposed by Maciej Kisielewski
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 3716
Merged at revision: 3712
Proposed branch: lp:~kissiel/checkbox/autopilot-scenarios
Merge into: lp:checkbox
Diff against target: 179 lines (+75/-17)
4 files modified
checkbox-touch/.gitignore (+2/-0)
checkbox-touch/tests/autopilot/autopilot-provider/jobs/autopilot.pxu (+2/-2)
checkbox-touch/tests/autopilot/checkbox_touch/__init__.py (+8/-13)
checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py (+63/-2)
To merge this branch: bzr merge lp:~kissiel/checkbox/autopilot-scenarios
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+256791@code.launchpad.net

Description of the change

This MR brings several fixes to existing autopilot tests and the scenarios for resume functionality

8ab1bbc checkbox-touch:tests:autopilot: fix mismatch between job names and result
c782de0 checkbox-touch:tests:autopilot: fix start_and_select_tests() (use wait_*)
a759d59 checkbox-touch:tests:autopilot: fix pep8 issues
725a80c checkbox-touch:tests:autopilot: fix selecting on welcome page
c85f59e checkbox-touch:.gitignore: add checkbox-touch.desktop to gitignore
3851c7e checkbox-touch: add resume session autopilot scenarios

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1, thanks a lot

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-touch/.gitignore'
2--- checkbox-touch/.gitignore 2015-01-30 15:41:28 +0000
3+++ checkbox-touch/.gitignore 2015-04-20 10:51:57 +0000
4@@ -6,3 +6,5 @@
5 settings.json
6 # Ignore copied over providers
7 providers/
8+# Ignore auto-generated desktop file
9+checkbox-touch.desktop
10
11=== modified file 'checkbox-touch/tests/autopilot/autopilot-provider/jobs/autopilot.pxu'
12--- checkbox-touch/tests/autopilot/autopilot-provider/jobs/autopilot.pxu 2015-04-01 20:28:59 +0000
13+++ checkbox-touch/tests/autopilot/autopilot-provider/jobs/autopilot.pxu 2015-04-20 10:51:57 +0000
14@@ -15,7 +15,7 @@
15 Purpose of this test is to assist Autopilot in testing Checkbox-Touch.
16 This test should be failed automatically.
17 plugin: shell
18-command: true
19+command: false
20 estimated_duration: 0.1
21 flags: preserve-locale
22 category_id: normal
23@@ -25,7 +25,7 @@
24 Purpose of this test is to assist Autopilot in testing Checkbox-Touch.
25 This test should be passed automatically.
26 plugin: shell
27-command: false
28+command: true
29 estimated_duration: 0.1
30 flags: preserve-locale
31 category_id: normal
32
33=== modified file 'checkbox-touch/tests/autopilot/checkbox_touch/__init__.py'
34--- checkbox-touch/tests/autopilot/checkbox_touch/__init__.py 2015-04-07 17:55:36 +0000
35+++ checkbox-touch/tests/autopilot/checkbox_touch/__init__.py 2015-04-20 10:51:57 +0000
36@@ -3,8 +3,6 @@
37 """Ubuntu Touch App autopilot tests."""
38
39 import os
40-import subprocess
41-import time
42
43 from autopilot import input, platform
44 from autopilot.introspection.dbus import StateNotFoundError
45@@ -51,41 +49,39 @@
46 except StateNotFoundError:
47 pass
48 try:
49- welcome_page = self.app.wait_select_single(
50+ self.app.wait_select_single(
51 objectName='welcomePage', visible=True)
52 return
53 except StateNotFoundError:
54 pass
55
56-
57 def start_and_select_tests(self, category_id, job_ids):
58 self.skipResumeIfShown()
59- start_btn = self.app.select_single(objectName='startTestButton')
60- self.assertThat(start_btn.text, Eventually(Equals("Start Testing")))
61+ welcome_page = self.long_wait_select_single(
62+ self.app, objectName='welcomePage', state='loaded')
63+ start_btn = welcome_page.wait_select_single(
64+ objectName='startTestButton')
65 self.pointing_device.click_object(start_btn)
66- time.sleep(1)
67 self.main_view.get_header().click_action_button('deselectAllAction')
68 category_page = self.app.wait_select_single(
69 objectName='categorySelectionPage')
70- list_item = category_page.select_single(
71+ list_item = category_page.wait_select_single(
72 objectName='listItem', item_mod_id=category_id)
73 self.pointing_device.click_object(list_item)
74 continue_btn = category_page.wait_select_single(
75- objectName='continueButton')
76+ objectName='continueButton', visible=True)
77 self.pointing_device.click_object(continue_btn)
78- time.sleep(1)
79 self.main_view.get_header().click_action_button('deselectAllAction')
80 test_selection_page = self.app.wait_select_single(
81 objectName='testSelectionPage')
82 for job_id in job_ids:
83- list_item = test_selection_page.select_single(
84+ list_item = test_selection_page.wait_select_single(
85 objectName='listItem', item_mod_id=job_id)
86 list_item.swipe_into_view()
87 self.pointing_device.click_object(list_item)
88 continue_btn = test_selection_page.wait_select_single(
89 objectName='continueButton')
90 self.pointing_device.click_object(continue_btn)
91- time.sleep(1)
92
93 def launch_application(self):
94 if platform.model() == 'Desktop':
95@@ -134,4 +130,3 @@
96 @property
97 def main_view(self):
98 return self.app.select_single(emulators.MainView)
99-
100
101=== modified file 'checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py'
102--- checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py 2015-04-01 21:09:18 +0000
103+++ checkbox-touch/tests/autopilot/checkbox_touch/test_checkbox_touch.py 2015-04-20 10:51:57 +0000
104@@ -50,8 +50,10 @@
105 in two flavours; one that passes and one that fails.
106 """
107 self.skipResumeIfShown()
108- start_btn = self.app.select_single(objectName='startTestButton')
109- self.assertThat(start_btn.text, Eventually(Equals("Start Testing")))
110+ welcome_page = self.long_wait_select_single(
111+ self.app, objectName='welcomePage', state='loaded')
112+ start_btn = welcome_page.wait_select_single(
113+ objectName='startTestButton')
114 self.pointing_device.click_object(start_btn)
115 category_page = self.app.wait_select_single(
116 objectName='categorySelectionPage', visible=True)
117@@ -108,3 +110,62 @@
118 objectName='skippedLabel')
119 self.assertThat(lbl_skipped.text.startswith(results['skipped']),
120 Equals(True))
121+
122+
123+class SessionResumeTests(checkbox_touch.ClickAppTestCase):
124+ def select_two_tests_and_quit(self):
125+ self.start_and_select_tests(
126+ '2015.com.canonical.certification::normal', [
127+ '2015.com.canonical.certification::autopilot/user-verify-1',
128+ '2015.com.canonical.certification::autopilot/user-verify-2'])
129+ # make sure that test is shown (therefore session has been started)
130+ self.app.wait_select_single(
131+ objectName='userInteractVerifyIntroPage', visible=True)
132+ self.app.process.terminate()
133+
134+ def test_rerun_after_resume(self):
135+ self.select_two_tests_and_quit()
136+ self.launch_application()
137+ self.assertThat(self.main_view.visible, Eventually(Equals(True)))
138+ # not doing long-wait, as the app was recently launched and it
139+ # *shouldn't* take long to relaunch it
140+ resume_page = self.app.wait_select_single(
141+ objectName='resumeSessionPage', visible=True)
142+ rerun_btn = resume_page.wait_select_single(
143+ objectName='rerunButton', visible=True)
144+ self.pointing_device.click_object(rerun_btn)
145+ intro_page = self.app.wait_select_single(
146+ objectName='userInteractVerifyIntroPage', visible=True)
147+ test_name_label = intro_page.wait_select_single(
148+ objectName='testNameLabel', visible=True)
149+ self.assertThat(test_name_label.text,
150+ Eventually(Equals('autopilot/user-verify-1')))
151+
152+ def test_continue_after_resume(self):
153+ self.select_two_tests_and_quit()
154+ self.launch_application()
155+ self.assertThat(self.main_view.visible, Eventually(Equals(True)))
156+ resume_page = self.app.wait_select_single(
157+ objectName='resumeSessionPage', visible=True)
158+ continue_btn = resume_page.wait_select_single(
159+ objectName='continueButton')
160+ self.pointing_device.click_object(continue_btn)
161+ intro_page = self.app.wait_select_single(
162+ objectName='userInteractVerifyIntroPage', visible=True)
163+ test_name_label = intro_page.wait_select_single(
164+ objectName='testNameLabel', visible=True)
165+ self.assertThat(test_name_label.text,
166+ Eventually(Equals('autopilot/user-verify-2')))
167+
168+ def test_restart_after_resume(self):
169+ self.select_two_tests_and_quit()
170+ self.launch_application()
171+ self.assertThat(self.main_view.visible, Eventually(Equals(True)))
172+ resume_page = self.app.wait_select_single(
173+ objectName='resumeSessionPage', visible=True)
174+ restart_btn = resume_page.wait_select_single(
175+ objectName='restartButton')
176+ self.pointing_device.click_object(restart_btn)
177+ welcome_page = self.app.wait_select_single(
178+ objectName='welcomePage')
179+ self.assertThat(welcome_page.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches