Merge lp:~nskaggs/ubuntu-clock-app/smoke-tests-fix into lp:ubuntu-clock-app/saucy

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 174
Merged at revision: 167
Proposed branch: lp:~nskaggs/ubuntu-clock-app/smoke-tests-fix
Merge into: lp:ubuntu-clock-app/saucy
Diff against target: 150 lines (+23/-20)
2 files modified
tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py (+5/-5)
tests/autopilot/ubuntu_clock_app/tests/test_timer.py (+18/-15)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-clock-app/smoke-tests-fix
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Clock Developers Pending
Review via email: mp+180030@code.launchpad.net

Commit message

Fix for autopilot tests; fix emulator issues, remove lambda silliness

Description of the change

Fix for autopilot tests; fix emulator issues, remove lambda silliness

To post a comment you must log in.
174. By Nicholas Skaggs

swap for Eventually(NotEquals(None)))

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py'
2--- tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 2013-08-07 22:43:17 +0000
3+++ tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 2013-08-14 02:08:37 +0000
4@@ -20,7 +20,7 @@
5
6 from __future__ import absolute_import
7
8-from testtools.matchers import Equals, NotEquals
9+from testtools.matchers import Equals, NotEquals, Is, Not
10 from autopilot.matchers import Eventually
11
12 from ubuntu_clock_app.tests import ClockAppTestCase
13@@ -45,16 +45,16 @@
14 def test_start_stop_reset_stopwatch(self):
15 """Test to check the proper functioning of the start/stop/reset of stopwatch"""
16
17+ self.assertThat(self.main_view.get_stopwatch_button, Eventually(Not(Is(None))))
18 start_stop_button = self.main_view.get_stopwatch_button()
19- self.assertThat(lambda: start_stop_button, Eventually(NotEquals(None)))
20+ self.assertThat(self.main_view.get_stopwatch_label, Eventually(Not(Is(None))))
21 stopwatch_label = self.main_view.get_stopwatch_label()
22- self.assertThat(lambda: stopwatch_label, Eventually(NotEquals(None)))
23+ self.assertThat(self.main_view.get_reset_button, Eventually(Not(Is(None))))
24 reset_button = self.main_view.get_reset_button()
25- self.assertThat(lambda: reset_button, Eventually(NotEquals(None)))
26
27 # Press the start button to start the stopwatch
28+ self.assertThat(self.main_view.get_stopwatch_label, Eventually(Not(Is(None))))
29 stopwatch_label_before = self.main_view.get_stopwatch_label().text
30- self.assertThat(lambda: stopwatch_label_before, Eventually(NotEquals(None)))
31 self.pointing_device.click_object(start_stop_button)
32 self.assertThat(stopwatch_label.text, Eventually(NotEquals("00:00.0")))
33
34
35=== modified file 'tests/autopilot/ubuntu_clock_app/tests/test_timer.py'
36--- tests/autopilot/ubuntu_clock_app/tests/test_timer.py 2013-08-07 22:43:17 +0000
37+++ tests/autopilot/ubuntu_clock_app/tests/test_timer.py 2013-08-14 02:08:37 +0000
38@@ -20,7 +20,7 @@
39
40 from __future__ import absolute_import
41
42-from testtools.matchers import Equals, NotEquals
43+from testtools.matchers import Equals, NotEquals, Is, Not
44 from autopilot.matchers import Eventually
45 from time import sleep
46 from autopilot.platform import model
47@@ -42,8 +42,9 @@
48
49
50 def drag_page_up_to_show_input_box(self):
51- timer_page = self.select_single("TimerPage")
52- self.assertThat(timer_page, Eventually(NotEquals(None)))
53+ timerFunc = lambda: self.main_view.select_single("TimerPage")
54+ self.assertThat(timerFunc, Eventually(Not(Is(None))))
55+ timer_page = self.main_view.select_single("TimerPage")
56
57 x, y, w, h = timer_page.globalRect
58 tx = x + (w / 2)
59@@ -55,8 +56,10 @@
60 Eventually(Equals(False)))
61
62 def drag_page_down_to_previous_state(self):
63- timer_page = self.select_single("TimerPage")
64- self.assertThat(timer_page, Eventually(NotEquals(None)))
65+ timerFunc = lambda: self.main_view.select_single("TimerPage")
66+ self.assertThat(timerFunc, Eventually(Not(Is(None))))
67+ timer_page = self.main_view.select_single("TimerPage")
68+
69
70 x, y, w, h = timer_page.globalRect
71 tx = x + (w / 2)
72@@ -74,8 +77,8 @@
73 self.main_view.open_toolbar()
74
75 # Click the add preset button
76+ self.assertThat(self.main_view.get_toolbar_timer_add_preset_button, Eventually(Not(Is(None))))
77 add_preset_button = self.main_view.get_toolbar_timer_add_preset_button()
78- self.assertThat(lambda: add_preset_button, Eventually(NotEquals(None)))
79 self.pointing_device.click_object(add_preset_button)
80
81 #For now close the toolbar due to https://bugs.launchpad.net/ubuntu-clock-app/+bug/1209024
82@@ -84,8 +87,8 @@
83 # Write in the label
84 if model() != "Desktop":
85 self.drag_page_up_to_show_input_box()
86+ self.assertThat(self.main_view.get_timer_name_preset, Eventually(Not(Is(None))))
87 label = self.main_view.get_timer_name_preset()
88- self.assertThat(lambda: label, Eventually(NotEquals(None)))
89 self.pointing_device.click_object(label)
90 self.assertThat(label.focus, Eventually(Equals(True)))
91 self.keyboard.type("test")
92@@ -95,18 +98,18 @@
93 self.drag_page_down_to_previous_state()
94
95 # Set hour
96+ self.assertThat(self.main_view.get_timer_hour_hand, Eventually(Not(Is(None))))
97 hour = self.main_view.get_timer_hour_hand()
98- self.assertThat(lambda: hour, Eventually(NotEquals(None)))
99 x, y, w, h = hour.globalRect
100 tx = x + (w / 2)
101 ty = y + (h / 2)
102 self.pointing_device.drag(tx, ty - (h / 4), tx + (w / 2), ty + (h / 2))
103
104+ self.assertThat(self.main_view.get_num_of_presets, Eventually(Not(Is(None))))
105 num_of_presets_old = self.main_view.get_num_of_presets()
106- self.assertThat(lambda: num_of_presets_old, Eventually(NotEquals(None)))
107 # Press "Done" button
108+ self.assertThat(self.main_view.get_timer_clock_center_label, Eventually(Not(Is(None))))
109 label = self.main_view.get_timer_clock_center_label()
110- self.assertThat(lambda: label, Eventually(NotEquals(None)))
111 self.pointing_device.click_object(label)
112
113 # Check if the preset has been saved
114@@ -119,10 +122,10 @@
115 # Create a new preset
116 self.test_add_preset()
117
118+ self.assertThat(self.main_view.get_num_of_presets, Eventually(Not(Is(None))))
119 num_of_presets_old = self.main_view.get_num_of_presets()
120- self.assertThat(lambda: num_of_presets_old, Eventually(NotEquals(None)))
121+ self.assertThat(self.main_view.get_first_preset_list_item, Eventually(Not(Is(None))))
122 first_preset = self.main_view.get_first_preset_list_item()
123- self.assertThat(lambda: first_preset, Eventually(NotEquals(None)))
124
125 if model() != "Desktop":
126 self.drag_page_up_to_show_input_box()
127@@ -143,8 +146,8 @@
128 self.test_add_preset()
129
130 # Click to select the preset
131+ self.assertThat(self.main_view.get_first_preset_list_item, Eventually(Not(Is(None))))
132 first_preset = self.main_view.get_first_preset_list_item()
133- self.assertThat(lambda: first_preset, Eventually(NotEquals(None)))
134 if model() != "Desktop":
135 self.drag_page_up_to_show_input_box()
136 self.pointing_device.click_object(first_preset)
137@@ -153,11 +156,11 @@
138 self.drag_page_down_to_previous_state()
139
140 # Click to start the preset
141+ self.assertThat(self.main_view.get_timer_clock_center_label, Eventually(Not(Is(None))))
142 label = self.main_view.get_timer_clock_center_label()
143- self.assertThat(lambda: label, Eventually(NotEquals(None)))
144 self.pointing_device.click_object(label)
145
146 # Check if timer is started
147+ self.assertThat(self.main_view.get_label_timer, Eventually(Not(Is(None))))
148 label_timer = self.main_view.get_label_timer()
149- self.assertThat(lambda: label_timer, Eventually(NotEquals(None)))
150 self.assertThat(label_timer.text, Eventually(NotEquals("23:00:00")))

Subscribers

People subscribed via source and target branches