Merge lp:~josharenson/unity8/location_page_test into lp:unity8

Proposed by Josh Arenson on 2015-05-21
Status: Merged
Approved by: Albert Astals Cid on 2015-07-20
Approved revision: 1795
Merged at revision: 1870
Proposed branch: lp:~josharenson/unity8/location_page_test
Merge into: lp:unity8
Prerequisite: lp:~josharenson/unity8/settings_wizard_tests
Diff against target: 139 lines (+67/-9)
2 files modified
tests/autopilot/unity8/settings_wizard/__init__.py (+48/-5)
tests/autopilot/unity8/settings_wizard/tests/test_settings_wizard.py (+19/-4)
To merge this branch: bzr merge lp:~josharenson/unity8/location_page_test
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) 2015-05-21 Approve on 2015-07-20
PS Jenkins bot continuous-integration Needs Fixing on 2015-07-17
Review via email: mp+259801@code.launchpad.net

Commit Message

Add handling for the location page to the autopilot settings wizard test

Description of the Change

* Are there any related MPs required for this MP to build/function as expected? Please list.
Yes. lp:~josharenson/unity8/settings_wizard_tests

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.
1794. By Josh Arenson on 2015-05-21

Restore location file

1795. By Josh Arenson on 2015-05-21

Weird fu

Albert Astals Cid (aacid) wrote :

How am i supposed to test this?

Running
  autopilot3 run unity8.settings_wizard.tests.test_settings_wizard.SkipThroughSettingsWizardTestCase.test_skipping_through_wizard
I never get the location page, do i have to reset something? Shouldn't that reset be part of the autopilot test?

review: Needs Information
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
I could not, one is supposed to use the devel-proposed-customized-here channel to test this, but the image is too old and the packages created by the CI system are uninstallable there. Since this is only AP related I'm approving it anyway and we will see how to fix it later in case it fails.

 * Did CI run pass?
As much as it usually passes

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity8/settings_wizard/__init__.py'
2--- tests/autopilot/unity8/settings_wizard/__init__.py 2015-05-21 16:52:37 +0000
3+++ tests/autopilot/unity8/settings_wizard/__init__.py 2015-05-21 16:52:38 +0000
4@@ -74,6 +74,10 @@
5 return self.wait_select_single(
6 objectName='wifiPage', visible='True')
7
8+ def get_location_page(self):
9+ return self.wait_select_single(
10+ objectName='locationPage', visible='True')
11+
12 def get_reporting_page(self):
13 return self.wait_select_single(
14 objectName='reportingPage', visible='True')
15@@ -367,6 +371,17 @@
16 return self._get_network(ssid).select_single(
17 'CheckBox', visible='True')
18
19+ def _get_next_page(self):
20+ wizard = get_wizard(self)
21+ next_page = wizard.get_current_page()
22+ locationPageEnabled = True
23+ if next_page.objectName == 'locationPage':
24+ next_page = wizard.get_location_page()
25+ else:
26+ locationPageEnabled = False
27+ next_page = wizard.get_reporting_page()
28+ return locationPageEnabled, next_page
29+
30 def _get_notification(self, unity):
31 logger.info('Waiting longer for notification object')
32 with override_proxy_timeout(unity, 30):
33@@ -377,14 +392,14 @@
34 return self.wait_select_single(
35 'StackButton', text='Back', visible='True')
36
37+ def _get_continue_button(self):
38+ return self.wait_select_single(
39+ 'StackButton', text='Continue', visible='True')
40+
41 def _get_skip_button(self):
42 return self.wait_select_single(
43 'StackButton', text='Skip', visible='True')
44
45- def _get_continue_button(self):
46- return self.wait_select_single(
47- 'StackButton', text='Continue', visible='True')
48-
49 def is_any_network_checked(self):
50 networks = self._get_all_networks()
51 for network in networks:
52@@ -413,7 +428,35 @@
53 @autopilot.logging.log_action(logger.info)
54 def skip(self):
55 self.pointing_device.click_object(self._get_skip_button())
56- return get_wizard(self).get_reporting_page()
57+ return self._get_next_page()
58+
59+ @autopilot.logging.log_action(logger.info)
60+ def continue_(self):
61+ self.pointing_device.click_object(self._get_continue_button())
62+ return self._get_next_page()
63+
64+
65+class LocationPage(UbuntuUIToolkitCustomProxyObjectBase):
66+ """Helper class to interact with the LocationPage"""
67+
68+ @classmethod
69+ def validate_dbus_object(cls, path, state):
70+ name = introspection.get_classname_from_path(path)
71+ if name == b'Page':
72+ if state['objectName'][1] == 'locationPage':
73+ return True
74+ return False
75+
76+ def _get_back_button(self):
77+ return self.select_single('StackButton', text='Back')
78+
79+ def _get_continue_button(self):
80+ return self.select_single('StackButton', text='Continue')
81+
82+ @autopilot.logging.log_action(logger.info)
83+ def back(self):
84+ self.pointing_device.click_object(self._get_back_button())
85+ return get_wizard(self).get_wifi_connect_page()
86
87 @autopilot.logging.log_action(logger.info)
88 def continue_(self):
89
90=== modified file 'tests/autopilot/unity8/settings_wizard/tests/test_settings_wizard.py'
91--- tests/autopilot/unity8/settings_wizard/tests/test_settings_wizard.py 2015-05-21 16:52:37 +0000
92+++ tests/autopilot/unity8/settings_wizard/tests/test_settings_wizard.py 2015-05-21 16:52:38 +0000
93@@ -45,6 +45,9 @@
94 self.assertEqual(default_selection, DEFAULT_LANGUAGE)
95 return language_page.continue_()
96
97+ def _test_location_page(self, location_page):
98+ return location_page.continue_()
99+
100 def _test_password_page(self, password_page):
101 """ Check default selection for password type and change
102 password type to swipe to keep this test as uncomplicated
103@@ -57,6 +60,9 @@
104 def _test_reporting_page(self, reporting_page):
105 return reporting_page.continue_()
106
107+ def _test_sim_page(self, sim_page):
108+ return sim_page.skip()
109+
110 def _test_wifi_connect_page(self, wifi_connect_page):
111 if wifi_connect_page.is_any_network_checked() or not \
112 wifi_connect_page.is_any_network_found():
113@@ -67,13 +73,22 @@
114 def test_skipping_through_wizard(self):
115 """ Most basic test of the settings wizard. Skip all skipable pages """
116 sim_inserted, next_page = self._test_language_page()
117- if sim_inserted:
118+ if not sim_inserted:
119+ sim_page = next_page
120+ password_page = self._test_sim_page(sim_page)
121+ else:
122 password_page = next_page
123- else:
124- password_page = next_page.skip()
125 wifi_connect_page = self._test_password_page(password_page)
126- reporting_page = self._test_wifi_connect_page(wifi_connect_page)
127+
128+ locationPageEnabled, next_page = self._test_wifi_connect_page(
129+ wifi_connect_page)
130+ if locationPageEnabled:
131+ location_page = next_page
132+ reporting_page = self._test_location_page(location_page)
133+ else:
134+ reporting_page = next_page
135 finish_page = self._test_reporting_page(reporting_page)
136+
137 finish_page.finish()
138 self.assertFalse(
139 self.wizard_helper.is_settings_wizard_enabled())

Subscribers

People subscribed via source and target branches