Merge lp:~om26er/ubuntu-system-settings/upgrade_testing_prerequisite into lp:ubuntu-system-settings

Proposed by Omer Akram
Status: Work in progress
Proposed branch: lp:~om26er/ubuntu-system-settings/upgrade_testing_prerequisite
Merge into: lp:ubuntu-system-settings
Diff against target: 136 lines (+102/-0)
2 files modified
plugins/system-update/PageComponent.qml (+4/-0)
tests/autopilot/ubuntu_system_settings/emulators.py (+98/-0)
To merge this branch: bzr merge lp:~om26er/ubuntu-system-settings/upgrade_testing_prerequisite
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Needs Fixing
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+214722@code.launchpad.net

Commit message

prerequisite for upgrade testing, to land in system-image source.

Description of the change

prerequisite for upgrade testing, to land in system-image source.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Somehow need to figure out how to fake the download manager to be able to write tests for these helpers so that we are sure they don't regress

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work, seems like similar work was started before on https://code.launchpad.net/~chris.gagnon/ubuntu-system-settings/barebones-autopilot-emulator-for-updates-page/+merge/210036 ... are you guys coordinating there? How are the changes differents?

> Somehow need to figure out how to fake the download manager to be able to write tests for these helpers so that we are sure they don't regress

Do you plan to do that? Do you consider your changes useful even if that doesn't happen, or should those works being synchronized?

review: Needs Information
Revision history for this message
Omer Akram (om26er) wrote :

> Thanks for the work, seems like similar work was started before on
> https://code.launchpad.net/~chris.gagnon/ubuntu-system-settings/barebones-
> autopilot-emulator-for-updates-page/+merge/210036 ... are you guys
> coordinating there? How are the changes differents?
>

Hi! thanks for your reply and sorry for the delay. Chris's branch is at halt now and my branch is doing a bit different things, so this doesn't need any co-ordination.
>
> > Somehow need to figure out how to fake the download manager to be able to
> write tests for these helpers so that we are sure they don't regress
>
> Do you plan to do that? Do you consider your changes useful even if that
> doesn't happen, or should those works being synchronized?

Yes, at this moment we cannot test these helpers due to missing features like a dummy mode for the upgrader, so you can merge this in now and we'll try to figure out a solution for that sometime in future.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Should that be marked "work in progress"? The CI seems still unhappy there...

Note that https://code.launchpad.net/~elopio/ubuntu-system-settings/refactor_about_tests/+merge/226468 is about the land and that your changes are going to need to be rebased, since there is a conflict when applying those on top of trunk

review: Needs Fixing

Unmerged revisions

679. By Omer Akram

add pointer parameter to the class

678. By Omer Akram

fix things a bit

677. By Omer Akram

explain

676. By Omer Akram

add helpers for upgrade testing.

675. By Omer Akram

add objectName for a few objects, also add new property updatesDownloaded for upgrade testing.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/system-update/PageComponent.qml'
--- plugins/system-update/PageComponent.qml 2014-03-17 02:08:47 +0000
+++ plugins/system-update/PageComponent.qml 2014-04-09 18:08:02 +0000
@@ -35,6 +35,7 @@
35 title: i18n.tr("Updates")35 title: i18n.tr("Updates")
3636
37 property bool installAll: false37 property bool installAll: false
38 property bool updatesDownloaded: false
38 property int updatesAvailable: 039 property int updatesAvailable: 0
3940
40 DeviceInfo {41 DeviceInfo {
@@ -45,11 +46,13 @@
45 id: dialogInstallComponent46 id: dialogInstallComponent
46 Dialog {47 Dialog {
47 id: dialogueInstall48 id: dialogueInstall
49 objectName: "dialogInstall"
48 title: i18n.tr("Update System")50 title: i18n.tr("Update System")
49 text: i18n.tr("The phone needs to restart to install the system update.")51 text: i18n.tr("The phone needs to restart to install the system update.")
5052
51 Button {53 Button {
52 text: i18n.tr("Install & Restart")54 text: i18n.tr("Install & Restart")
55 objectName: "btnInstallUpdate"
53 color: UbuntuColors.orange56 color: UbuntuColors.orange
54 onClicked: {57 onClicked: {
55 installingImageUpdate.visible = true;58 installingImageUpdate.visible = true;
@@ -157,6 +160,7 @@
157160
158 onSystemUpdateDownloaded: {161 onSystemUpdateDownloaded: {
159 root.updatesAvailable -= 1;162 root.updatesAvailable -= 1;
163 root.updatesDownloaded = true;
160 PopupUtils.open(dialogInstallComponent);164 PopupUtils.open(dialogInstallComponent);
161 }165 }
162166
163167
=== added file 'tests/autopilot/ubuntu_system_settings/emulators.py'
--- tests/autopilot/ubuntu_system_settings/emulators.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_system_settings/emulators.py 2014-04-09 18:08:02 +0000
@@ -0,0 +1,98 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
3# Copyright (C) 2014 Canonical Ltd.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; version 3.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17"""Emulators for updates page used by upgrade tests."""
18
19import time
20import logging
21
22logger = logging.getLogger(__name__)
23
24
25class UpdatesPage(object):
26
27 def __init__(self, app, pointer):
28 self.app = app
29 self.pointer = pointer
30
31 def _get_updates_view(self):
32 return self.app.select_single(
33 'PageComponent', objectName='systemUpdatesPage'
34 )
35
36 def _get_install_dialog(self):
37 return self.app.wait_select_single(
38 'Dialog', objectName='dialogInstall'
39 )
40
41 def _wait_for_dialog(self):
42 dialog = self._get_install_dialog()
43
44 dialog.opacity.wait_for(1.0)
45
46 def get_installing_update_screen(self):
47 return self.app.wait_select_single(
48 'QQuickRectangle', objectName='installingImageUpdate'
49 )
50
51 def wait_for_updates_to_download(self, timeout=40):
52 """Wait for system updates to download
53
54 :returns: None
55 :raises: ValueError
56 """
57 while timeout > 0:
58 download_state = self._get_updates_view().updatesDownloaded
59 if download_state:
60 return
61
62 timeout = timeout - 1
63 time.sleep(5)
64 else:
65 raise ValueError(
66 "Download didn't complete in given time, check your "
67 "internet and try again."
68 )
69
70 def wait_for_state(self, state, timeout=60):
71 """Wait for expected state
72
73 :returns: state
74 :raises: SystemSettingsEmulatorException
75 """
76 for wait in range(timeout):
77 status = self._get_updates_view().state
78 logger.info(
79 'State: {} waiting for {}'.format(status, state)
80 )
81 if state == status:
82 return state
83 time.sleep(1)
84
85 raise ValueError(
86 'Error state {} not found before timeout'.format(state)
87 )
88
89 def click_install_and_restart_button(self):
90 """Wait for the install dialog to appear before clicking
91 on its button.
92 """
93 self._wait_for_dialog()
94 button = self.app.select_single(
95 'Button', objectName='btnInstallUpdate'
96 )
97
98 self.pointer.click_object(button)

Subscribers

People subscribed via source and target branches