Merge lp:~elopio/ubuntuone-testing/testability-devices into lp:ubuntuone-testing

Proposed by Leo Arias
Status: Merged
Approved by: Rick McBride
Approved revision: 93
Merged at revision: 90
Proposed branch: lp:~elopio/ubuntuone-testing/testability-devices
Merge into: lp:ubuntuone-testing
Diff against target: 388 lines (+261/-46)
7 files modified
ubuntuone/client/qt/tests/testabilitydriver/controlpanel/devices.rb (+66/-0)
ubuntuone/client/qt/tests/testabilitydriver/controlpanel/header-tests.rb (+39/-39)
ubuntuone/client/qt/tests/testabilitydriver/shared/actions/common.rb (+22/-0)
ubuntuone/client/qt/tests/testabilitydriver/shared/actions/controlpanel.rb (+44/-0)
ubuntuone/client/qt/tests/testabilitydriver/shared/actions/devices.rb (+68/-0)
ubuntuone/client/qt/tests/testabilitydriver/shared/actions/header.rb (+0/-7)
ubuntuone/client/qt/tests/testabilitydriver/shared/actions/wizard.rb (+22/-0)
To merge this branch: bzr merge lp:~elopio/ubuntuone-testing/testability-devices
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
Review via email: mp+102415@code.launchpad.net

Commit message

Added the actions to remove the device, and a test that removes it.

Description of the change

Added the actions to remove the device, and a test that removes it.
Of course, this test will make the previous fail because they expect to be on the control panel dashboard. Coming up next are the actions for the SSO login, to fix this.

To post a comment you must log in.
Revision history for this message
Rick McBride (rmcbride) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'ubuntuone/client/qt/tests/testabilitydriver/controlpanel/devices.rb'
2--- ubuntuone/client/qt/tests/testabilitydriver/controlpanel/devices.rb 1970-01-01 00:00:00 +0000
3+++ ubuntuone/client/qt/tests/testabilitydriver/controlpanel/devices.rb 2012-04-18 01:46:18 +0000
4@@ -0,0 +1,66 @@
5+#!/usr/bin/env ruby1.8
6+=begin
7+/*
8+ * Copyright 2012 Canonical Ltd.
9+ *
10+ * This program is free software; you can redistribute it and/or modify
11+ * it under the terms of the GNU General Public License as published by
12+ * the Free Software Foundation; version 3.
13+ *
14+ * This program is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ * GNU General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU General Public License
20+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21+ */
22+=end
23+
24+require '../run-tests.rb' unless $INIT_COMPLETED
25+require $actions_path + '/devices.rb'
26+require $actions_path + '/wizard.rb'
27+require $actions_path + '/controlpanel.rb'
28+
29+# Test Suite
30+context "Devices tests" do
31+
32+ # Run once at the beginning of this test suite
33+ startup do
34+ $SUT.execute_shell_command 'killall ubuntuone-control-panel-qt'
35+ end
36+
37+ # Run once at the end of this test suite
38+ teardown do
39+ $SUT.execute_shell_command 'killall ubuntuone-control-panel-qt'
40+ end
41+
42+ # Run before each test case begins
43+ setup do
44+ # Execute the application
45+ @controlpanel = $SUT.run(:name=>'python',
46+ :start_command=>'ubuntuone-control-panel-qt ' +
47+ '-testability',
48+ :sleep_time=>5)
49+ wait_for_control_panel
50+ end
51+
52+ # Run after each test case completes
53+ teardown do
54+ $SUT.execute_shell_command 'pkill -nf ubuntuone-control-panel-qt'
55+ end
56+
57+ # Test cases
58+
59+ test "Remove this device" do
60+ open_devices_tab
61+ remove_this_device
62+ verify_true(5) {
63+ is_wizard_visible?
64+ }
65+ verify_false {
66+ is_control_panel_visible?
67+ }
68+ end
69+
70+end
71
72=== modified file 'ubuntuone/client/qt/tests/testabilitydriver/controlpanel/header-tests.rb'
73--- ubuntuone/client/qt/tests/testabilitydriver/controlpanel/header-tests.rb 2012-04-17 21:47:41 +0000
74+++ ubuntuone/client/qt/tests/testabilitydriver/controlpanel/header-tests.rb 2012-04-18 01:46:18 +0000
75@@ -18,47 +18,47 @@
76 =end
77
78 require '../run-tests.rb' unless $INIT_COMPLETED
79-require $actions_path + '/controlpanel.rb'
80+require $actions_path + '/header.rb'
81
82-############################# Test Suite #############################
83+# Test Suite
84 context "Header tests" do
85
86- # Run once at the beginning of this test suite
87- startup do
88- $SUT.execute_shell_command 'killall ubuntuone-control-panel-qt'
89- end
90-
91- # Run once at the end of this test suite
92- teardown do
93- $SUT.execute_shell_command 'killall ubuntuone-control-panel-qt'
94- end
95-
96- # Run before each test case begins
97- setup do
98- # Execute the application
99- @controlpanel = $SUT.run(:name=>'python',
100- :start_command=>'ubuntuone-control-panel-qt ' +
101- '-testability')
102- end
103-
104- # Run after each test case completes
105- teardown do
106- $SUT.execute_shell_command 'pkill -nf ubuntuone-control-panel-qt'
107- end
108-
109- # Test cases
110-
111- test "Disconnect from service" do
112- connect_and_wait_for_file_sync_update
113- disconnect
114- verify_true(3, 'test disconnected') {
115- is_disconnected?
116- }
117- end
118-
119- test "Connect to service" do
120- disconnect
121- connect_and_wait_for_file_sync_update
122- end
123+ # Run once at the beginning of this test suite
124+ startup do
125+ $SUT.execute_shell_command 'killall ubuntuone-control-panel-qt'
126+ end
127+
128+ # Run once at the end of this test suite
129+ teardown do
130+ $SUT.execute_shell_command 'killall ubuntuone-control-panel-qt'
131+ end
132+
133+ # Run before each test case begins
134+ setup do
135+ # Execute the application
136+ @controlpanel = $SUT.run(:name=>'python',
137+ :start_command=>'ubuntuone-control-panel-qt ' +
138+ '-testability')
139+ end
140+
141+ # Run after each test case completes
142+ teardown do
143+ $SUT.execute_shell_command 'pkill -nf ubuntuone-control-panel-qt'
144+ end
145+
146+ # Test cases
147+
148+ test "Disconnect from service" do
149+ connect_and_wait_for_file_sync_update
150+ disconnect
151+ verify_true(3, 'test disconnected') {
152+ is_disconnected?
153+ }
154+ end
155+
156+ test "Connect to service" do
157+ disconnect
158+ connect_and_wait_for_file_sync_update
159+ end
160
161 end
162
163=== added file 'ubuntuone/client/qt/tests/testabilitydriver/shared/actions/common.rb'
164--- ubuntuone/client/qt/tests/testabilitydriver/shared/actions/common.rb 1970-01-01 00:00:00 +0000
165+++ ubuntuone/client/qt/tests/testabilitydriver/shared/actions/common.rb 2012-04-18 01:46:18 +0000
166@@ -0,0 +1,22 @@
167+#!/usr/bin/env ruby1.8
168+=begin
169+/*
170+ * Copyright 2012 Canonical Ltd.
171+ *
172+ * This program is free software; you can redistribute it and/or modify
173+ * it under the terms of the GNU General Public License as published by
174+ * the Free Software Foundation; version 3.
175+ *
176+ * This program is distributed in the hope that it will be useful,
177+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
178+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
179+ * GNU General Public License for more details.
180+ *
181+ * You should have received a copy of the GNU General Public License
182+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
183+ */
184+=end
185+
186+def click_yes_on_dialog_button
187+ @controlpanel.QDialogButtonBox(:name=>'qt_msgbox_buttonbox').QPushButton(:text=>'&Yes').tap
188+end
189
190=== added file 'ubuntuone/client/qt/tests/testabilitydriver/shared/actions/controlpanel.rb'
191--- ubuntuone/client/qt/tests/testabilitydriver/shared/actions/controlpanel.rb 1970-01-01 00:00:00 +0000
192+++ ubuntuone/client/qt/tests/testabilitydriver/shared/actions/controlpanel.rb 2012-04-18 01:46:18 +0000
193@@ -0,0 +1,44 @@
194+#!/usr/bin/env ruby1.8
195+=begin
196+/*
197+ * Copyright 2012 Canonical Ltd.
198+ *
199+ * This program is free software; you can redistribute it and/or modify
200+ * it under the terms of the GNU General Public License as published by
201+ * the Free Software Foundation; version 3.
202+ *
203+ * This program is distributed in the hope that it will be useful,
204+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
205+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
206+ * GNU General Public License for more details.
207+ *
208+ * You should have received a copy of the GNU General Public License
209+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
210+ */
211+=end
212+
213+def is_control_panel_visible?
214+ return @controlpanel.QWidget(:name=>'management'). \
215+ attribute('visible') == 'true'
216+end
217+
218+def wait_for_control_panel
219+ wait_for_information
220+ wait_for_tab_bar
221+end
222+
223+def wait_for_information
224+ verify_not(30, 'Information not loaded') {
225+ @controlpanel.LoadingOverlay(:name=>'Form')
226+ }
227+end
228+
229+def wait_for_tab_bar
230+ verify_equal('true', 10, 'Tab bar not displayed') {
231+ get_tab_bar.attribute('visible')
232+ }
233+end
234+
235+def get_tab_bar
236+ return @controlpanel.QTabBar(:name=>'qt_tabwidget_tabbar')
237+end
238
239=== added file 'ubuntuone/client/qt/tests/testabilitydriver/shared/actions/devices.rb'
240--- ubuntuone/client/qt/tests/testabilitydriver/shared/actions/devices.rb 1970-01-01 00:00:00 +0000
241+++ ubuntuone/client/qt/tests/testabilitydriver/shared/actions/devices.rb 2012-04-18 01:46:18 +0000
242@@ -0,0 +1,68 @@
243+#!/usr/bin/env ruby1.8
244+=begin
245+/*
246+ * Copyright 2012 Canonical Ltd.
247+ *
248+ * This program is free software; you can redistribute it and/or modify
249+ * it under the terms of the GNU General Public License as published by
250+ * the Free Software Foundation; version 3.
251+ *
252+ * This program is distributed in the hope that it will be useful,
253+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
254+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
255+ * GNU General Public License for more details.
256+ *
257+ * You should have received a copy of the GNU General Public License
258+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
259+ */
260+=end
261+
262+require $actions_path + '/common.rb'
263+require $actions_path + '/controlpanel.rb'
264+
265+def open_devices_tab
266+ click_devices_tab
267+ wait_for_information
268+ wait_for_devices_panel
269+end
270+
271+def click_devices_tab
272+ # XXX do not use coordinates. How to click a tab?
273+ get_tab_bar.tap_object(150,20)
274+end
275+
276+def wait_for_devices_panel
277+ verify_equal('true', 10, 'Devices panel not displayed') {
278+ @controlpanel.DevicesPanel(:name=>'devices_tab').attribute('visible')
279+ }
280+ verify_equal('true', 10, 'Devices panel not displayed') {
281+ get_remove_this_device_button.attribute('enabled')
282+ }
283+end
284+
285+def remove_this_device(confirm=true)
286+ click_remove_this_device
287+ if confirm
288+ confirm_device_removal
289+ else
290+ cancel_device_removal
291+ end
292+end
293+
294+def click_remove_this_device
295+ get_remove_this_device_button.tap
296+end
297+
298+def get_remove_this_device_button
299+ return @controlpanel.DeviceWidget(:name=>'local_device'). \
300+ QPushButton(:name=>'remove_device_button')
301+end
302+
303+def confirm_device_removal
304+ click_yes_on_dialog_button
305+end
306+
307+def cancel_device_removal
308+ # TODO
309+ raise "Not implemented"
310+end
311
312=== renamed file 'ubuntuone/client/qt/tests/testabilitydriver/shared/actions/controlpanel.rb' => 'ubuntuone/client/qt/tests/testabilitydriver/shared/actions/header.rb'
313--- ubuntuone/client/qt/tests/testabilitydriver/shared/actions/controlpanel.rb 2012-04-17 21:47:41 +0000
314+++ ubuntuone/client/qt/tests/testabilitydriver/shared/actions/header.rb 2012-04-18 01:46:18 +0000
315@@ -27,17 +27,14 @@
316 return get_sync_status_button_text == 'Disconnect'
317 end
318
319-private
320 def get_sync_status_button_text
321 return get_sync_status_button.attribute('text')
322 end
323
324-private
325 def get_sync_status_button
326 return @controlpanel.QPushButton(:name=>'sync_status_button')
327 end
328
329-private
330 def click_sync_status_button
331 get_sync_status_button.tap
332 end
333@@ -47,12 +44,10 @@
334 get_sync_status_label_text == 'File Sync is disconnected.'
335 end
336
337-private
338 def get_sync_status_label_text
339 return get_sync_status_label.attribute('text')
340 end
341
342-private
343 def get_sync_status_label
344 return @controlpanel.QLabel(:name=>'sync_status_label')
345 end
346@@ -64,7 +59,6 @@
347 wait_for_file_sync_update
348 end
349
350-private
351 def wait_for_file_sync_update
352 # TODO define a timeout.
353 verify_true(360, 'test connected') {
354@@ -72,7 +66,6 @@
355 }
356 end
357
358-private
359 def is_file_sync_up_to_date?
360 return get_sync_status_label_text == 'File Sync is up-to-date.'
361 end
362
363=== added file 'ubuntuone/client/qt/tests/testabilitydriver/shared/actions/wizard.rb'
364--- ubuntuone/client/qt/tests/testabilitydriver/shared/actions/wizard.rb 1970-01-01 00:00:00 +0000
365+++ ubuntuone/client/qt/tests/testabilitydriver/shared/actions/wizard.rb 2012-04-18 01:46:18 +0000
366@@ -0,0 +1,22 @@
367+#!/usr/bin/env ruby1.8
368+=begin
369+/*
370+ * Copyright 2012 Canonical Ltd.
371+ *
372+ * This program is free software; you can redistribute it and/or modify
373+ * it under the terms of the GNU General Public License as published by
374+ * the Free Software Foundation; version 3.
375+ *
376+ * This program is distributed in the hope that it will be useful,
377+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
378+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
379+ * GNU General Public License for more details.
380+ *
381+ * You should have received a copy of the GNU General Public License
382+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
383+ */
384+=end
385+
386+def is_wizard_visible?
387+ return @controlpanel.UbuntuOneWizard.attribute('visible') == 'true'
388+end

Subscribers

People subscribed via source and target branches