Merge lp:~sbaldassin/ubuntu-system-tests/indicators_tests into lp:ubuntu-system-tests

Proposed by Santiago Baldassin
Status: Merged
Approved by: Richard Huddie
Approved revision: 524
Merged at revision: 519
Proposed branch: lp:~sbaldassin/ubuntu-system-tests/indicators_tests
Merge into: lp:ubuntu-system-tests
Diff against target: 547 lines (+99/-228)
12 files modified
ubuntu_system_tests/helpers/indicators/cpo.py (+1/-1)
ubuntu_system_tests/helpers/indicators/datetime.py (+1/-0)
ubuntu_system_tests/helpers/indicators/indicators.py (+25/-12)
ubuntu_system_tests/helpers/indicators/network/cpo.py (+15/-9)
ubuntu_system_tests/helpers/music/__init__.py (+3/-9)
ubuntu_system_tests/helpers/music/app.py (+23/-37)
ubuntu_system_tests/helpers/ofono/utils.py (+8/-5)
ubuntu_system_tests/tests/base.py (+1/-2)
ubuntu_system_tests/tests/indicators/base.py (+2/-3)
ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py (+0/-4)
ubuntu_system_tests/tests/indicators/test_indicator_network.py (+9/-143)
ubuntu_system_tests/tests/indicators/test_indicator_sound.py (+11/-3)
To merge this branch: bzr merge lp:~sbaldassin/ubuntu-system-tests/indicators_tests
Reviewer Review Type Date Requested Status
Richard Huddie (community) Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+320445@code.launchpad.net

Commit message

Indicators test cases

Description of the change

This mp update the system tests helpers to run the indicator test cases

@run_tests: ubuntu_system_tests.tests.indicators.test_indicator_datetime ubuntu_system_tests.tests.indicators.test_indicator_bluetooth ubuntu_system_tests.tests.indicators.test_indicator_battery ubuntu_system_tests.tests.indicators.test_indicator_sound.SoundIndicatorTestCase

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
517. By Santiago Baldassin

Updating the rest of the indicators test cases

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Richard Huddie (rhuddie) wrote :

Although the tests are passing, I'm seeing this import error during the test log: http://pastebin.ubuntu.com/24223453/

I think other thing to consider is where tests have been changed to be ethernet specific. On real hardware where wifi is supported (e.g. dragonboard), the ethernet indicator would be replaced by the wifi indicator. So can we make the tests more generic? e.g. test_ethernet_settings_item_open_correct_page changes to test_network_settings_item_open_correct_page, and then open the relevant indicator based on whether wifi of ethernet is supported.

Some other comments below.

review: Needs Fixing
Revision history for this message
Santiago Baldassin (sbaldassin) wrote :

Thanks for the feedback Richard.
Completely agree with the comment about making the tests more generic.
Replies inline

518. By Santiago Baldassin

Addressing comments from the reviews

519. By Santiago Baldassin

Merge from trunk

520. By Santiago Baldassin

Fixing flake8 issues

521. By Santiago Baldassin

Removing import error

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
522. By Santiago Baldassin

Fixing flake8

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Richard Huddie (rhuddie) wrote :

see reply below

523. By Santiago Baldassin

Addressing comments from the reviews

Revision history for this message
Santiago Baldassin (sbaldassin) wrote :

Comment addressed

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
524. By Santiago Baldassin

Fixing flake8 issues

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Richard Huddie (rhuddie) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu_system_tests/helpers/indicators/cpo.py'
--- ubuntu_system_tests/helpers/indicators/cpo.py 2016-12-02 12:16:41 +0000
+++ ubuntu_system_tests/helpers/indicators/cpo.py 2017-03-30 19:25:29 +0000
@@ -20,7 +20,7 @@
20from ubuntu_system_tests.helpers.ubuntuuitools.cpo.qquicklistview import QQuickListView # NOQA20from ubuntu_system_tests.helpers.ubuntuuitools.cpo.qquicklistview import QQuickListView # NOQA
21from ubuntu_system_tests.helpers.ubuntuuitools.cpo.common import CustomProxyObjectBase # NOQA21from ubuntu_system_tests.helpers.ubuntuuitools.cpo.common import CustomProxyObjectBase # NOQA
2222
23INDICATOR_PAGE_PATH = b'IndicatorPage'23INDICATOR_PAGE_PATH = b'PanelMenuPage'
2424
2525
26class IndicatorPage(CustomProxyObjectBase):26class IndicatorPage(CustomProxyObjectBase):
2727
=== modified file 'ubuntu_system_tests/helpers/indicators/datetime.py'
--- ubuntu_system_tests/helpers/indicators/datetime.py 2016-12-19 18:50:17 +0000
+++ ubuntu_system_tests/helpers/indicators/datetime.py 2017-03-30 19:25:29 +0000
@@ -27,6 +27,7 @@
27 """Autopilot helper for the date time indicator page."""27 """Autopilot helper for the date time indicator page."""
2828
29 name = 'indicator-datetime'29 name = 'indicator-datetime'
30 title = 'Time & Date'
3031
31 @classmethod32 @classmethod
32 def validate_dbus_object(cls, path, state):33 def validate_dbus_object(cls, path, state):
3334
=== modified file 'ubuntu_system_tests/helpers/indicators/indicators.py'
--- ubuntu_system_tests/helpers/indicators/indicators.py 2016-12-19 18:50:17 +0000
+++ ubuntu_system_tests/helpers/indicators/indicators.py 2017-03-30 19:25:29 +0000
@@ -16,9 +16,8 @@
16# You should have received a copy of the GNU General Public License16# 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/>.17# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19from autopilot.exceptions import StateNotFoundError
19from ubuntu_system_tests.helpers import context20from ubuntu_system_tests.helpers import context
20from autopilot import input
21
22from ubuntu_system_tests.helpers.input_manager import input_manager21from ubuntu_system_tests.helpers.input_manager import input_manager
2322
24TRANSFER_INDICATOR = 'indicator-transfer'23TRANSFER_INDICATOR = 'indicator-transfer'
@@ -27,16 +26,30 @@
27class IndicatorsFactory:26class IndicatorsFactory:
2827
29 @staticmethod28 @staticmethod
30 def get_indicators_page(indicator_name):29 def get_indicators_page(name):
31 widget = context.shared.unity.main_window._get_indicator_panel_item(30 date_time_indicator = context.shared.unity.main_window.select_single(
32 indicator_name)31 objectName='indicator-datetime-panelItem')
33 start_x, start_y = input.get_center_point(widget)32 x, y, w, h = date_time_indicator.get_properties()['globalRect']
34 end_x = start_x33
35 end_y = context.shared.unity.main_window.height
36 input_manager.pointer.drag(34 input_manager.pointer.drag(
37 start_x, start_y, end_x, end_y)35 x + w / 2, y + h / 2, x + w / 2,
38 context.shared.unity.main_window.wait_select_single(36 context.shared.unity.main_window.get_properties()['height'] / 2)
39 'IndicatorsMenu', fullyOpened=True)37
38 indicators_list = context.shared.unity.main_window.wait_select_single(
39 objectName='indicatorsContentListView', visible=True, enabled=True)
40
41 while not indicators_list.get_properties()['atXBeginning']:
42 input_manager.keyboard.press_and_release('LEFT')
43
44 while not indicators_list.get_properties()['atXEnd']:
45 try:
46 indicators_list.select_single(
47 objectName='{}-page'.format(name),
48 visible=True,
49 enabled=True)
50 break
51 except StateNotFoundError:
52 input_manager.keyboard.press_and_release('RIGHT')
4053
41 return context.shared.unity.main_window.select_single(54 return context.shared.unity.main_window.select_single(
42 'IndicatorPage', visible=True)55 'PanelMenuPage', visible=True)
4356
=== modified file 'ubuntu_system_tests/helpers/indicators/network/cpo.py'
--- ubuntu_system_tests/helpers/indicators/network/cpo.py 2017-01-16 12:41:26 +0000
+++ ubuntu_system_tests/helpers/indicators/network/cpo.py 2017-03-30 19:25:29 +0000
@@ -16,7 +16,7 @@
16# You should have received a copy of the GNU General Public License16# 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/>.17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#18#
1919from ubuntu_system_tests.helpers import platform
20from ubuntu_system_tests.helpers.indicators.cpo import (20from ubuntu_system_tests.helpers.indicators.cpo import (
21 IndicatorPage, INDICATOR_PAGE_PATH)21 IndicatorPage, INDICATOR_PAGE_PATH)
22from ubuntu_system_tests.helpers.autopilot import validate_dbus_object22from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
@@ -86,18 +86,24 @@
86 if self.is_wifi_enabled():86 if self.is_wifi_enabled():
87 self._get_wifi_switch().toggle()87 self._get_wifi_switch().toggle()
8888
89 def _get_cellular_settings_menu_item(self):89 def _get_ethernet_settings_menu_item(self):
90 """Return the menu item which opens cellular settings."""90 """Return the menu item which opens cellular settings."""
91 return self.select_single(91 return self.select_single(
92 objectName='indicator.cellular.settings', visible=True)92 objectName='indicator.ethernet.settings', visible=True)
9393
94 def is_cellular_settings_visible(self):94 def is_ethernet_settings_visible(self):
95 return self._get_cellular_settings_menu_item().visible95 return self._get_ethernet_settings_menu_item().visible
9696
97 def open_cellular_settings(self):97 def open_network_settings(self):
98 if platform.get_device_name() is 'desktop':
99 self.open_ethernet_settings()
100 else:
101 self.open_wifi_settings()
102
103 def open_ethernet_settings(self):
98 """Tap the cellular settings list item to open settings."""104 """Tap the cellular settings list item to open settings."""
99 input_manager.pointer.click_object(105 input_manager.pointer.click_object(
100 self._get_cellular_settings_menu_item())106 self._get_ethernet_settings_menu_item())
101107
102 def _get_wifi_settings_menu_item(self):108 def _get_wifi_settings_menu_item(self):
103 """Return the menu item which opens WiFi settings."""109 """Return the menu item which opens WiFi settings."""
104110
=== modified file 'ubuntu_system_tests/helpers/music/__init__.py'
--- ubuntu_system_tests/helpers/music/__init__.py 2016-08-24 13:41:23 +0000
+++ ubuntu_system_tests/helpers/music/__init__.py 2017-03-30 19:25:29 +0000
@@ -22,16 +22,13 @@
22 APP_ID,22 APP_ID,
23 APP_WIN_ID,23 APP_WIN_ID,
24 CONFIG_FILE,24 CONFIG_FILE,
25 get_music_app_proxy,25 MusicPlayer,
26 is_music_app_running,
27 launch_music_app,
28 QML,26 QML,
29 stop_music_app,
30)27)
31from ubuntu_system_tests.helpers.music.utils import (28from ubuntu_system_tests.helpers.music.utils import (
32 get_current_album,29 get_current_album,
33 get_current_song,30 get_current_song,
34 set_welcome_wizard,31 set_welcome_wizard
35)32)
3633
3734
@@ -43,10 +40,7 @@
43 'CONFIG_FILE',40 'CONFIG_FILE',
44 'get_current_album',41 'get_current_album',
45 'get_current_song',42 'get_current_song',
46 'get_music_app_proxy',
47 'is_music_app_running',
48 'launch_music_app',
49 'QML',43 'QML',
50 'set_welcome_wizard',44 'set_welcome_wizard',
51 'stop_music_app',45 'MusicPlayer'
52]46]
5347
=== modified file 'ubuntu_system_tests/helpers/music/app.py'
--- ubuntu_system_tests/helpers/music/app.py 2016-12-01 20:46:16 +0000
+++ ubuntu_system_tests/helpers/music/app.py 2017-03-30 19:25:29 +0000
@@ -18,12 +18,8 @@
1818
19import os19import os
2020
21from ubuntu_system_tests.helpers import autopilot
22from ubuntu_system_tests.helpers import processes21from ubuntu_system_tests.helpers import processes
23from ubuntu_system_tests.helpers.scopes.apps import (22from ubuntu_system_tests.helpers.application import Application
24 launch_application_from_apps_scope
25)
26from ubuntu_system_tests.helpers import wait_until
27from ubuntu_system_tests.helpers import file_system as fs23from ubuntu_system_tests.helpers import file_system as fs
2824
29APP = 'music-app'25APP = 'music-app'
@@ -35,35 +31,25 @@
35CONFIG_FILE = os.path.join(fs.DIR_HOME_MUSIC_CONFIG, '{}.conf'.format(APP_ID))31CONFIG_FILE = os.path.join(fs.DIR_HOME_MUSIC_CONFIG, '{}.conf'.format(APP_ID))
3632
3733
38def launch_music_app():34class MusicPlayer(Application):
39 """35
40 Launch the music app from apps scope and return proxy object.36 def __init__(self):
4137 super().__init__(APP_NAME, APP_ID)
42 :return: Proxy object for music application.38
4339 def is_running(self):
44 """40 """ Indicate if the music app is currently running """
45 launch_application_from_apps_scope(APP_NAME)41 return processes.is_qmlscene_running_with_qmlfile(APP)
46 wait_until(is_music_app_running, period=0.5)42
47 return get_music_app_proxy()43 def get_main_view(self):
4844 """
4945 Return music app proxy object from existing process.
50def is_music_app_running():46 :return: Proxy object for music application.
51 """ Indicate if the music app is currently running """47 """
52 return processes.is_qmlscene_running_with_qmlfile(APP)48 from ubuntu_system_tests.helpers.music import cpo # NOQA
5349 proxy = self.get_proxy_object()
5450 return proxy.main_view
55def get_music_app_proxy():51
56 """52 @staticmethod
57 Return music app proxy object from existing process.53 def stop():
5854 """ Stop the music app qml process """
59 :return: Proxy object for music application.55 processes.stop_qmlscene_process(QML)
60
61 """
62 from ubuntu_system_tests.helpers.music import cpo # NOQA
63 proxy = autopilot.get_proxy_object(processes.get_qmlscene_process_id(APP))
64 return proxy.main_view
65
66
67def stop_music_app():
68 """ Stop the music app qml process """
69 processes.stop_qmlscene_process(QML)
7056
=== modified file 'ubuntu_system_tests/helpers/ofono/utils.py'
--- ubuntu_system_tests/helpers/ofono/utils.py 2016-12-07 14:15:04 +0000
+++ ubuntu_system_tests/helpers/ofono/utils.py 2017-03-30 19:25:29 +0000
@@ -228,11 +228,14 @@
228 if no slot is specified then if a SIM is inserted in228 if no slot is specified then if a SIM is inserted in
229 any slot, otherwise False229 any slot, otherwise False
230 """230 """
231 bus = dbus.SystemBus()231 # Since phone is not really target so far, we defaul he return value to
232 for ril_modem, properties in _get_all_modems(bus):232 # False
233 if _sim_present(bus, ril_modem, properties,233 #
234 sim_number, ignore_phonesim):234 # bus = dbus.SystemBus()
235 return True235 # for ril_modem, properties in _get_all_modems(bus):
236 # if _sim_present(bus, ril_modem, properties,
237 # sim_number, ignore_phonesim):
238 # return True
236 return False239 return False
237240
238241
239242
=== modified file 'ubuntu_system_tests/tests/base.py'
--- ubuntu_system_tests/tests/base.py 2017-03-23 08:50:42 +0000
+++ ubuntu_system_tests/tests/base.py 2017-03-30 19:25:29 +0000
@@ -56,7 +56,6 @@
56from ubuntu_system_tests.helpers.unity8.utils import (56from ubuntu_system_tests.helpers.unity8.utils import (
57 disable_settings_wizard,57 disable_settings_wizard,
58 disable_edges_intro,58 disable_edges_intro,
59 setup_unity
60)59)
6160
62from ubuntu_system_tests.tests.data.definitions import DESKTOP_PLATFORM_NAME61from ubuntu_system_tests.tests.data.definitions import DESKTOP_PLATFORM_NAME
@@ -87,7 +86,7 @@
87 def setUp(self, custom_fixtures=[]):86 def setUp(self, custom_fixtures=[]):
88 super().setUp()87 super().setUp()
89 self.addCleanup(ensure_all_apps_closed)88 self.addCleanup(ensure_all_apps_closed)
90 self.addCleanup(setup_unity)89 # self.addCleanup(setup_unity)
91 self._reset_autopilot_registry()90 self._reset_autopilot_registry()
92 self._init_shared_context()91 self._init_shared_context()
93 if len(custom_fixtures) == 0:92 if len(custom_fixtures) == 0:
9493
=== modified file 'ubuntu_system_tests/tests/indicators/base.py'
--- ubuntu_system_tests/tests/indicators/base.py 2016-11-16 12:37:32 +0000
+++ ubuntu_system_tests/tests/indicators/base.py 2017-03-30 19:25:29 +0000
@@ -22,7 +22,6 @@
2222
2323
24class IndicatorTestCaseBase(base.BaseUbuntuSystemTestCase):24class IndicatorTestCaseBase(base.BaseUbuntuSystemTestCase):
25 def setUp(self, indicator):25 def setUp(self, name):
26 super().setUp()26 super().setUp()
27 self.indicator_page = IndicatorsFactory.get_indicators_page(indicator)27 self.indicator_page = IndicatorsFactory.get_indicators_page(name)
28 self.addCleanup(self.shell.close_indicator_page)
2928
=== modified file 'ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py'
--- ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py 2016-11-16 12:34:58 +0000
+++ ubuntu_system_tests/tests/indicators/test_indicator_bluetooth.py 2017-03-30 19:25:29 +0000
@@ -17,9 +17,6 @@
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20from testtools import skipUnless
21from ubuntu_system_tests.helpers.bluetooth import is_bluetooth_supported
22
23from ubuntu_system_tests.helpers import system_settings20from ubuntu_system_tests.helpers import system_settings
24from ubuntu_system_tests.helpers.indicators.bluetooth import (21from ubuntu_system_tests.helpers.indicators.bluetooth import (
25 BluetoothIndicatorPage)22 BluetoothIndicatorPage)
@@ -31,7 +28,6 @@
3128
32class BluetoothIndicatorTestCase(base.IndicatorTestCaseBase):29class BluetoothIndicatorTestCase(base.IndicatorTestCaseBase):
3330
34 @skipUnless(is_bluetooth_supported(), 'Bluetooth support required.')
35 def setUp(self):31 def setUp(self):
36 super().setUp(BluetoothIndicatorPage.name)32 super().setUp(BluetoothIndicatorPage.name)
3733
3834
=== modified file 'ubuntu_system_tests/tests/indicators/test_indicator_network.py'
--- ubuntu_system_tests/tests/indicators/test_indicator_network.py 2016-12-02 15:06:23 +0000
+++ ubuntu_system_tests/tests/indicators/test_indicator_network.py 2017-03-30 19:25:29 +0000
@@ -16,166 +16,32 @@
16#16#
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919from ubuntu_system_tests.helpers import platform
20from autopilot.matchers import Eventually
21from testtools.matchers import Equals, NotEquals
22from testtools import skipUnless
23from ubuntu_system_tests.helpers.indicators.network.cpo import (20from ubuntu_system_tests.helpers.indicators.network.cpo import (
24 NetworkIndicatorPage)21 NetworkIndicatorPage)
2522
26from ubuntu_system_tests.helpers import (
27 radio_killswitch,
28 network,
29)
30from ubuntu_system_tests.helpers.ofono.fixture_setup import UnlockSims
31from ubuntu_system_tests.helpers.ofono.utils import (
32 wait_for_all_sims_registered, is_sim_inserted, get_sim_name)
33from ubuntu_system_tests.helpers.platform import is_wifi_supported
34
35from ubuntu_system_tests.helpers import system_settings23from ubuntu_system_tests.helpers import system_settings
36from ubuntu_system_tests.tests.indicators import base24from ubuntu_system_tests.tests.indicators import base
3725
38
39CELLULAR_SETTINGS_PAGE = 'cellularPage'26CELLULAR_SETTINGS_PAGE = 'cellularPage'
40WIFI_SETTINGS_PAGE = 'wifiPage'27WIFI_SETTINGS_PAGE = 'wifiPage'
4128
4229
43class FlightModeTestCase(base.IndicatorTestCaseBase):
44
45 @skipUnless(is_sim_inserted() and is_wifi_supported(),
46 'SIM and Wi-Fi support required.')
47 def setUp(self):
48 self.assertTrue(wait_for_all_sims_registered())
49 self.radio_killswitch = self.useFixture(
50 radio_killswitch.RadioKillswitch(False))
51 super().setUp(NetworkIndicatorPage.name)
52
53 def assert_network_indicator_shows_flightmode_off(self,
54 network_indicator_page):
55 """Network indicator UI elements reflect 'off' state of flight mode."""
56 self.assertTrue(network_indicator_page.is_flight_mode_switch_visible())
57 self.assertThat(network_indicator_page.is_sim_list_offline,
58 Eventually(Equals(False)))
59 self.assertTrue(network_indicator_page.is_wifi_switch_visible())
60 self.assertThat(network_indicator_page.is_wifi_enabled,
61 Eventually(Equals(True)))
62 self.assertThat(network_indicator_page.get_list_of_wifi_access_points,
63 Eventually(NotEquals([])))
64 self.assertTrue(network_indicator_page.is_cellular_settings_visible())
65 self.assertTrue(network_indicator_page.is_wifi_settings_visible())
66
67 def assert_network_indicator_shows_flightmode_on(self,
68 network_indicator_page):
69 """Network indicator UI elements reflect 'on' state of flight mode."""
70 self.assertThat(network_indicator_page.is_sim_list_offline,
71 Eventually(Equals(True)))
72 self.assertThat(network_indicator_page.is_wifi_enabled,
73 Eventually(Equals(False)))
74 self.assertThat(
75 network_indicator_page.get_list_of_wifi_access_points,
76 Eventually(Equals([])))
77
78 def test_switching_on_flight_mode_must_engage_flight_mode(self):
79 """Switching on 'flight mode' in the indicator must engage flight mode.
80
81 Note that we assume we're starting in *off* mode; also we skip
82 the test if no SIM is inserted.
83
84 """
85 self.assertFalse(self.radio_killswitch.is_flight_mode_on(),
86 'Test must be run with flight mode off.')
87 self.assert_network_indicator_shows_flightmode_off(
88 self.indicator_page)
89 self.indicator_page.turn_on_flight_mode()
90 self.assertThat(self.radio_killswitch.is_flight_mode_on,
91 Eventually(Equals(True)))
92 self.assert_network_indicator_shows_flightmode_on(
93 self.indicator_page)
94 self.indicator_page.turn_off_flight_mode()
95 self.assertThat(self.radio_killswitch.is_flight_mode_on,
96 Eventually(Equals(False)))
97 self.assert_network_indicator_shows_flightmode_off(
98 self.indicator_page)
99
100 def assert_network_indicator_shows_wifi_enabled_flight_mode_on(
101 self, network_indicator_page):
102 self.assertThat(network_indicator_page.is_sim_list_offline,
103 Eventually(Equals(True)))
104 self.assertThat(network_indicator_page.is_wifi_enabled,
105 Eventually(Equals(True)))
106 self.assertThat(
107 network_indicator_page.get_list_of_wifi_access_points,
108 Eventually(NotEquals([])))
109
110 def test_enable_wifi_in_flight_mode(self):
111 """
112 Enable flight mode and turn on wifi and check internet is working
113
114 1. Switch to flight mode
115 2. Turn on Wifi
116 3. Ensure internet is working
117 """
118 self.assertFalse(self.radio_killswitch.is_flight_mode_on(),
119 'Test must be run with flight mode off.')
120 self.assert_network_indicator_shows_flightmode_off(
121 self.indicator_page)
122 self.indicator_page.turn_on_flight_mode()
123 self.addCleanup(self.indicator_page.turn_off_flight_mode)
124 self.assertThat(self.radio_killswitch.is_flight_mode_on,
125 Eventually(Equals(True)))
126 self.assert_network_indicator_shows_flightmode_on(
127 self.indicator_page)
128 self.indicator_page.turn_on_wifi()
129 self.assert_network_indicator_shows_wifi_enabled_flight_mode_on(
130 self.indicator_page)
131 network.ensure_internet_connectivity(timeout=15)
132
133
134class CellularProvidersTestCase(base.IndicatorTestCaseBase):
135
136 @skipUnless(is_sim_inserted(), 'At least one SIM card required')
137 def setUp(self):
138 self.assertTrue(wait_for_all_sims_registered())
139 self.useFixture(UnlockSims())
140 super().setUp(NetworkIndicatorPage.name)
141
142 def test_cellular_providers_register(self):
143 """
144 Prerequisite: At least one SIM is inserted into the phone.
145 1. Drag down the network indicator
146 - The network menu opens and shows the currently
147 active SIMs names.
148 """
149 sims = self.indicator_page.get_list_of_sims()
150 for index, sim in enumerate(sims):
151 self.assertEqual(sim.get_sim_name(), get_sim_name(index))
152
153
154class NetworkIndicatorTestCase(base.IndicatorTestCaseBase):30class NetworkIndicatorTestCase(base.IndicatorTestCaseBase):
15531
156 def setUp(self):32 def setUp(self):
157 super().setUp(NetworkIndicatorPage.name)33 super().setUp(NetworkIndicatorPage.name)
15834
159 def test_cellular_settings_item_open_correct_page(self):35 def test_ethernet_settings_item_open_correct_page(self):
160 """36 """
161 1. Drag down the network indicator37 1. Drag down the network indicator
162 2. Tap 'Cellular settings...'38 2. Tap 'Cellular settings...'
163 3. Ensure cellular settings open39 3. Ensure cellular settings open
164 """40 """
165 self.indicator_page.open_cellular_settings()41 self.indicator_page.open_network_settings()
166 settings_app = system_settings.get_system_settings_proxy()42 settings_app = system_settings.get_system_settings_proxy()
167 system_settings.ensure_settings_page_visible(settings_app,43 expected_page = WIFI_SETTINGS_PAGE if \
168 CELLULAR_SETTINGS_PAGE)44 platform.get_device_name() is not 'desktop' \
16945 else CELLULAR_SETTINGS_PAGE
170 @skipUnless(is_wifi_supported(),46 system_settings.ensure_settings_page_visible(settings_app,
171 'Wi-Fi support required.')47 expected_page)
172 def test_wifi_settings_item_open_correct_page(self):
173 """
174 1. Drag down the network indicator
175 2. Tap 'Wifi settings...'
176 3. Ensure Wifi settings open
177 """
178 self.indicator_page.open_wifi_settings()
179 settings_app = system_settings.get_system_settings_proxy()
180 system_settings.ensure_settings_page_visible(settings_app,
181 WIFI_SETTINGS_PAGE)
18248
=== modified file 'ubuntu_system_tests/tests/indicators/test_indicator_sound.py'
--- ubuntu_system_tests/tests/indicators/test_indicator_sound.py 2016-12-02 18:49:50 +0000
+++ ubuntu_system_tests/tests/indicators/test_indicator_sound.py 2017-03-30 19:25:29 +0000
@@ -17,16 +17,16 @@
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
2020import os
21import shutil21import shutil
2222
23from autopilot.matchers import Eventually23from autopilot.matchers import Eventually
24from testtools.matchers import Equals, NotEquals24from testtools.matchers import Equals, NotEquals
2525
26from ubuntu_system_tests.helpers.music.app import MusicPlayer
26from ubuntu_system_tests.helpers.unity8.utils import close_all_apps27from ubuntu_system_tests.helpers.unity8.utils import close_all_apps
27from ubuntu_system_tests.helpers.indicators.sound import SoundIndicatorPage28from ubuntu_system_tests.helpers.indicators.sound import SoundIndicatorPage
28from ubuntu_system_tests.helpers import media29from ubuntu_system_tests.helpers import media
29from ubuntu_system_tests.helpers import music
30from ubuntu_system_tests.helpers import system_settings30from ubuntu_system_tests.helpers import system_settings
31from ubuntu_system_tests.helpers.indicators.indicators import IndicatorsFactory31from ubuntu_system_tests.helpers.indicators.indicators import IndicatorsFactory
32from ubuntu_system_tests.helpers.music import fixture_setup as music_fixture32from ubuntu_system_tests.helpers.music import fixture_setup as music_fixture
@@ -34,6 +34,7 @@
34from ubuntu_system_tests.tests.indicators import base34from ubuntu_system_tests.tests.indicators import base
35from ubuntu_system_tests.tests import data as test_data35from ubuntu_system_tests.tests import data as test_data
3636
37from ubuntu_system_tests.helpers import file_system as fs
3738
38SOUND_SETTINGS_PAGE = 'soundPage'39SOUND_SETTINGS_PAGE = 'soundPage'
3940
@@ -61,9 +62,16 @@
61 super().setUp()62 super().setUp()
62 self.useFixture(media.BackupRestoreLocalMediaFixture())63 self.useFixture(media.BackupRestoreLocalMediaFixture())
63 self.useFixture(music_fixture.MusicAppWelcomeWizard(show_wizard=True))64 self.useFixture(music_fixture.MusicAppWelcomeWizard(show_wizard=True))
65
66 if not os.path.exists(fs.DIR_HOME_MUSIC):
67 os.makedirs(fs.DIR_HOME_MUSIC)
64 shutil.copy2(test_data.SRC_AUDIO_FILE_2, test_data.LOCAL_AUDIO_FILE_2)68 shutil.copy2(test_data.SRC_AUDIO_FILE_2, test_data.LOCAL_AUDIO_FILE_2)
65 shutil.copy2(test_data.SRC_AUDIO_FILE_4, test_data.LOCAL_AUDIO_FILE_4)69 shutil.copy2(test_data.SRC_AUDIO_FILE_4, test_data.LOCAL_AUDIO_FILE_4)
66 self.music_app = music.launch_music_app()70
71 music_player = MusicPlayer()
72 music_player.launch_from_app_drawer()
73
74 self.music_app = music_player.get_main_view()
67 self.music_app.ensure_walkthrough_page_not_visible()75 self.music_app.ensure_walkthrough_page_not_visible()
6876
69 def test_play_pause_track_from_indicator(self):77 def test_play_pause_track_from_indicator(self):

Subscribers

People subscribed via source and target branches