Merge lp:~sylvain-pineau/checkbox/qml-battery-test into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Approved by: Maciej Kisielewski
Approved revision: 3856
Merged at revision: 3857
Proposed branch: lp:~sylvain-pineau/checkbox/qml-battery-test
Merge into: lp:checkbox
Diff against target: 224 lines (+207/-0)
3 files modified
providers/2015.com.canonical.certification:qml-tests/data/battery-01.qml (+161/-0)
providers/2015.com.canonical.certification:qml-tests/data/upower.py (+32/-0)
providers/2015.com.canonical.certification:qml-tests/units/qml-tests.pxu (+14/-0)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/qml-battery-test
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Needs Resubmitting
Zygmunt Krynicki (community) Needs Fixing
Review via email: mp+259355@code.launchpad.net

Description of the change

Update of the qml battery test. Added an alarm to wake up the application since all internal timers are frozen when the device is locked (usually after 1m).

To post a comment you must log in.
3781. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/fix-1450620/ by tarmac [r=zyga][bug=1450620][author=sylvain-pineau]"

3782. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/display-rename/ by tarmac [r=zyga][bug=1456022][author=cypressyew]"

3783. By Daniel Manrique

"automatic merge of lp:~roadmr/checkbox/dkms_info_subparser/ by tarmac [r=zyga][bug=][author=roadmr]"

3784. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/better-check-config/ by tarmac [r=sylvain-pineau][bug=][author=zyga]"

3785. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/fix-1456142/ by tarmac [r=sylvain-pineau,kissiel][bug=1456142][author=zyga]"

3786. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/fix-1456176/ by tarmac [r=zyga][bug=][author=sylvain-pineau]"

3787. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/xml-jinja/ by tarmac [r=zyga,sylvain-pineau][bug=][author=zyga]"

3788. By Launchpad Translations on behalf of checkbox-dev

Launchpad automatic translations update.

3789. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/add-before-s3-graphic-tests/ by tarmac [r=sylvain-pineau][bug=1456010][author=cypressyew]"

3790. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/14.04.3-testplan/ by tarmac [r=sylvain-pineau][bug=1454977][author=cypressyew]"

3791. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/fix-1456560/ by tarmac [r=sylvain-pineau][bug=1456560][author=zyga]"

3792. By Daniel Manrique

"checkbox-support:parsers:submission: Adds modinfo_attachment parsing.

This includes the changes to the SubmissionParser and result class themselves, testing data file and "integration" tests, changes to the existing ModinfoParser and addition of new MultipleModinfoParser (with tests), and some PEP257 fixes to legacy code.
 [r=roadmr,zyga][bug=][author=roadmr]"

3793. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/add-tb-monitor-generator/ by tarmac [r=sylvain-pineau][bug=1456462][author=cypressyew]"

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Please add stock headers everywhere

review: Needs Fixing
3794. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/fix-1455033-sensors-on-desktop/ by tarmac [r=zyga][bug=1455033][author=kissiel]"

3795. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/html-template-refresh/ by tarmac [r=sylvain-pineau][bug=][author=zyga]"

3796. By Sylvain Pineau

providers:certification-client: Fix a typo in the 14.04.3 testplan

audio/genereator_.* -> audio/generator_.*

3797. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/fix-1454563-selection-naming/ by tarmac [r=zyga][bug=1454563][author=kissiel]"

3798. By Shawn Wang

"automatic merge of lp:~shawn111/checkbox/image_info/ by tarmac [r=zyga][bug=1454577][author=shawn111]"

3799. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/fix-tb-generator/ by tarmac [r=zyga][bug=1456907][author=cypressyew]"

3800. By Taihsiang Ho

"automatic merge of lp:~taihsiangho/checkbox/checkbox-translation-zh_TW-150519_pot/ by tarmac [r=zyga][bug=][author=taihsiangho]"

3801. By Taihsiang Ho

"automatic merge of lp:~taihsiangho/checkbox/checkbox-translation-zh_TW-150519/ by tarmac [r=zyga][bug=][author=taihsiangho]"

3802. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/bt-a2dp-fix/ by tarmac [r=zyga][bug=1326746][author=cypressyew]"

3803. By Launchpad Translations on behalf of checkbox-dev

Launchpad automatic translations update.

3804. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/image-info/ by tarmac [r=shawn111,zyga,roadmr][bug=][author=zyga]"

3805. By Daniel Manrique

"providers:checkbox: Fix wrong usage of recovery_info script in some info jobs [r=sylvain-pineau,zyga][bug=1457505][author=roadmr]"

3806. By Daniel Manrique

"providers:checkbox: Update dell_bto_attachment job with user: root
 [r=sylvain-pineau][bug=1457613][author=roadmr]"

3807. By Sylvain Pineau

"Release_2015_Week21 [r=sylvain-pineau][bug=1331302,1341769,1347120,1382321,1383447,1387782,1387843,1388055,1388747,1389253,1399481,1400646,1403933,1406719,1410501,1428615,1451343,1451541][author=checkbox-dev]"

3808. By Launchpad Translations on behalf of checkbox-dev

Launchpad automatic translations update.

3809. By Daniel Manrique

"checkbox-support:parsers:submission Fix parsing of xml containing non-ascii characters. [r=zyga][bug=1457970][author=roadmr]"

3810. By Daniel Manrique

"checkbox-support:parsers:submission: Add missing method to TestRun. [r=zyga][bug=][author=roadmr]"

3811. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/fix-1452217-gui/ by tarmac [r=zyga][bug=1452217][author=sylvain-pineau]"

3812. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/fix-1452217-cli/ by tarmac [r=zyga][bug=1452217][author=sylvain-pineau]"

3813. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/use-pyotherside1.4/ by tarmac [r=zyga][bug=][author=kissiel]"

3814. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/story-1248-screen-tests/ by tarmac [r=sylvain-pineau][bug=][author=kissiel]"

3815. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/result-builder/ by tarmac [r=sylvain-pineau,zyga][bug=][author=zyga]"

3816. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/result-history/ by tarmac [r=sylvain-pineau][bug=][author=zyga]"

3817. By Jeff Lane 

"automatic merge of lp:~bladernr/checkbox/remove-ftp-network-test/ by tarmac [r=zyga][bug=][author=bladernr]"

3818. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/command-output-in-cbt/ by tarmac [r=sylvain-pineau][bug=][author=kissiel]"

3819. By Launchpad Translations on behalf of checkbox-dev

Launchpad automatic translations update.

3820. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/fix-1459543/ by tarmac [r=zyga][bug=1459543][author=sylvain-pineau]"

3821. By Daniel Manrique

"checkbox-support:parsers: adds parsing of bto.xml, recovery_info and buildstamp attachments.

 [r=zyga][bug=][author=roadmr]"

3822. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/hexr_exporter_default/ by tarmac [r=zyga][bug=][author=sylvain-pineau]"

3823. By Daniel Manrique

"Extends the DMI parser to capture all the attributes from dmidecode records (not just the ones that map to checkbox's concept of a "device"). This includes DMI parser changes with unit tests, plainbox dev parse entry point and configuration, and integration with the submission parser, including integration tests. [r=zyga][bug=][author=roadmr]"

3824. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/hwe-sru-testplan/ by tarmac [r=sylvain-pineau][bug=][author=sylvain-pineau]"

3825. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/hwe-sru-testplan/ by tarmac [r=sylvain-pineau][bug=][author=sylvain-pineau]"

3826. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/create_connection_fix_vivid/ by tarmac [r=sylvain-pineau][bug=][author=sylvain-pineau]"

3827. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/fix-1460556/ by tarmac [r=roadmr][bug=1460556][author=sylvain-pineau]"

3828. By Paul Larson

"Fix the cert_status variable name in xlsx.py [r=sylvain-pineau][bug=][author=pwlars]"

3829. By Paul Larson

"automatic merge of lp:~pwlars/checkbox/test_resume.py/ by tarmac [r=zyga][bug=][author=pwlars]"

3830. By Paul Larson

"automatic merge of lp:~pwlars/checkbox/flake8-test_manager.py/ by tarmac [r=zyga][bug=][author=pwlars]"

3831. By Paul Larson

"automatic merge of lp:~pwlars/checkbox/flake8-setup/ by tarmac [r=zyga][bug=][author=pwlars]"

3832. By Paul Larson

"automatic merge of lp:~pwlars/checkbox/flake8-conf.py/ by tarmac [r=zyga][bug=][author=pwlars]"

3833. By Paul Larson

"automatic merge of lp:~pwlars/checkbox/flake8-resource.py/ by tarmac [r=zyga][bug=][author=pwlars]"

3834. By Launchpad Translations on behalf of checkbox-dev

Launchpad automatic translations update.

3835. By Jeff Lane 

"automatic merge of lp:~bladernr/checkbox/add-server-vm-whitelist/ by tarmac [r=zyga][bug=][author=bladernr]"

3836. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/fix-1463705/ by tarmac [r=sylvain-pineau][bug=1463705][author=zyga]"

3837. By Paul Larson

"automatic merge of lp:~pwlars/checkbox/more-flake8-fixes/ by tarmac [r=zyga][bug=][author=pwlars]"

3838. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/fix-1464144/ by tarmac [r=sylvain-pineau][bug=1464144][author=zyga]"

3839. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/fix-dbus/ by tarmac [r=sylvain-pineau][bug=][author=zyga]"

3840. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/fix-1465162-missing-qml-shell/ by tarmac [r=sylvain-pineau][bug=1465162][author=kissiel]"

3841. By Pierre Equoy

"automatic merge of lp:~pierre-equoy/checkbox/lp1464195-clicking-job-updated/ by tarmac [r=sylvain-pineau][bug=1464195][author=pierre-equoy]"

3842. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/fix-graphic-stress-attachment/ by tarmac [r=sylvain-pineau][bug=1465104][author=cypressyew]"

3843. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/build-me-improvements/ by tarmac [r=zyga][bug=][author=kissiel]"

3844. By Taihsiang Ho

"automatic merge of lp:~taihsiangho/checkbox/checkbox-150611-rm-auto-after-minici/ by tarmac [r=cypressyew][bug=][author=taihsiangho]"

3845. By Po-Hsu Lin

"automatic merge of lp:~cypressyew/checkbox/fix-autostart-vivid/ by tarmac [r=sylvain-pineau][bug=1465617][author=cypressyew]"

3846. By Zygmunt Krynicki

"automatic merge of lp:~zyga/checkbox/fix-1464653/ by tarmac [r=sylvain-pineau][bug=1464653][author=zyga]"

3847. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/build-me-improvements/ by tarmac [r=zyga][bug=][author=kissiel]"

3848. By Launchpad Translations on behalf of checkbox-dev

Launchpad automatic translations update.

3849. By Jonathan Cave

"automatic merge of lp:~jocave/checkbox/screen11-test/ by tarmac [r=kissiel][bug=][author=jocave]"

3850. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/checkbox-touch-fixes/ by tarmac [r=sylvain-pineau][bug=][author=kissiel]"

3851. By Daniel Manrique

"checkbox-support: Add cputable to MANIFEST.in so it's included by setup.py sdist (LP: #1467619) [r=sylvain-pineau][bug=1467619][author=roadmr]"

3852. By Sylvain Pineau

"automatic merge of lp:~sylvain-pineau/checkbox/hwe-sru-testplan-cleanup/ by tarmac [r=sylvain-pineau][bug=][author=sylvain-pineau]"

3853. By Taihsiang Ho

"automatic merge of lp:~taihsiangho/checkbox/checkbox-150622-rollback-autostart/ by tarmac [r=roadmr,taihsiangho][bug=][author=taihsiangho]"

3854. By Maciej Kisielewski

"automatic merge of lp:~kissiel/checkbox/checkbox-touch-logging-fixes/ by tarmac [r=zyga][bug=][author=kissiel]"

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Added headers.

review: Needs Resubmitting
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

Two minor comments

3855. By Po-Hsu Lin

checkbox-ng:contrib: add autostart file removal command for systemd service files

Add the checkbox-autostart removal command for systemd service file

3856. By Sylvain Pineau

providers:qml: add a simple automated battery test

This patch adds a simple test for battery.
If more than 5% of total battry capacity is lost in 30m then it would be
considered a fail.

When the screen is locked, all the Timers that are defined in the qml tests
are frozen, making such test useless if nothing can wake up the application.

Registering an Alarm (the duration of the battery test) ensures that the battery
percentage will be refreshed if the screen is unlocked.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Fixed, better timer names and split the function into multiple lines.

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'providers/2015.com.canonical.certification:qml-tests/data/battery-01.qml'
2--- providers/2015.com.canonical.certification:qml-tests/data/battery-01.qml 1970-01-01 00:00:00 +0000
3+++ providers/2015.com.canonical.certification:qml-tests/data/battery-01.qml 2015-06-24 09:13:59 +0000
4@@ -0,0 +1,161 @@
5+/*
6+ * This file is part of Checkbox.
7+ *
8+ * Copyright 2015 Canonical Ltd.
9+ * Written by:
10+ * Sylvain Pineau <sylvain.pineau@canonical.com>
11+ *
12+ * Checkbox is free software: you can redistribute it and/or modify
13+ * it under the terms of the GNU General Public License version 3,
14+ * as published by the Free Software Foundation.
15+ *
16+ * Checkbox is distributed in the hope that it will be useful,
17+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+ * GNU General Public License for more details.
20+ *
21+ * You should have received a copy of the GNU General Public License
22+ * along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
23+ */
24+
25+import QtQuick 2.0
26+import io.thp.pyotherside 1.2
27+import Ubuntu.Components 0.1
28+import QtQuick.Layouts 1.1
29+
30+Item {
31+ id: root
32+ signal testDone(var test)
33+
34+ width: units.gu(100)
35+ height: units.gu(75)
36+ anchors.fill: parent
37+
38+ property var duration: 1801
39+ property var threshold: 5
40+ property date startDate: new Date()
41+ property date endDate: new Date(startDate.getTime() + duration*1000)
42+ property date countdown: new Date(endDate - new Date());
43+ property var startPercentage;
44+ property var currentPercentage;
45+
46+ Page {
47+ id: mainPage
48+
49+ Alarm {
50+ id: alarm
51+ }
52+
53+ Component.onDestruction: alarm.cancel()
54+
55+ ColumnLayout {
56+ spacing: units.gu(1)
57+ anchors {
58+ margins: units.gu(2)
59+ fill: parent
60+ }
61+
62+ Column {
63+ anchors.horizontalCenter: parent.horizontalCenter
64+
65+ Label {
66+ fontSize: "x-large"
67+ text: "Time remaining:"
68+ anchors.horizontalCenter: parent.horizontalCenter
69+ }
70+ Label {
71+ id: time
72+ fontSize: "x-large"
73+ text: " "
74+ anchors.horizontalCenter: parent.horizontalCenter
75+ }
76+ }
77+
78+ Column {
79+ anchors.horizontalCenter: parent.horizontalCenter
80+
81+ Label {
82+ fontSize: "x-large"
83+ text: i18n.tr("Battery level")
84+ }
85+
86+ Label {
87+ fontSize: "large"
88+ text: i18n.tr("Initial: ") + startPercentage + "%"
89+ anchors.horizontalCenter: parent.horizontalCenter
90+ }
91+
92+ Label {
93+ fontSize: "large"
94+ text: i18n.tr("Current: ") + currentPercentage + "%"
95+ anchors.horizontalCenter: parent.horizontalCenter
96+ }
97+
98+ Label {
99+ fontSize: "large"
100+ text: i18n.tr("Limit: ") + (startPercentage - threshold) + "%"
101+ anchors.horizontalCenter: parent.horizontalCenter
102+ }
103+ }
104+
105+ Button {
106+ text: i18n.tr("Skip")
107+ color: "#FF9900"
108+ Layout.fillWidth: true
109+ onClicked: {
110+ alarm.cancel();
111+ testDone({'outcome': 'skip'});
112+ }
113+ }
114+ }
115+
116+ Timer {
117+ id: clockTimer
118+ interval: 1000; running: true; repeat: true
119+ onTriggered: {
120+ countdown = new Date(endDate - new Date());
121+ time.text = ("0" + countdown.getMinutes()).slice(-2) + ":" + ("0" + countdown.getSeconds()).slice(-2);
122+ if (countdown.valueOf() <= 0) {
123+ currentPercentage = python.call_sync('upower.get_battery_percentage');
124+ running = false
125+ alarm.cancel();
126+ batteryLevelTimer.running = false
127+ if ((startPercentage - threshold) > currentPercentage) {
128+ testDone({'outcome': 'fail'});
129+ }
130+ else {
131+ testDone({'outcome': 'pass'});
132+ }
133+ }
134+ }
135+ }
136+
137+ Timer {
138+ id: batteryLevelTimer
139+ interval: 10000; running: true; repeat: true
140+ onTriggered: {
141+ python.call('upower.get_battery_percentage', [], function(result) {
142+ currentPercentage=result
143+ });
144+ if ((startPercentage - threshold) > currentPercentage) {
145+ alarm.cancel();
146+ testDone({'outcome': 'fail'});
147+ }
148+ }
149+ }
150+
151+ Python {
152+ id: python
153+ Component.onCompleted: {
154+ addImportPath(Qt.resolvedUrl('.'));
155+ importModule('upower', function() {});
156+ call('upower.get_battery_percentage', [], function(result) {startPercentage=result; currentPercentage=result});
157+ alarm.date = endDate;
158+ alarm.message = i18n.tr("Battery test completed");
159+ alarm.save();
160+ if (alarm.error != Alarm.NoError)
161+ print("Error saving alarm, code: " + alarm.error);
162+ }
163+ }
164+ }
165+}
166
167=== added file 'providers/2015.com.canonical.certification:qml-tests/data/upower.py'
168--- providers/2015.com.canonical.certification:qml-tests/data/upower.py 1970-01-01 00:00:00 +0000
169+++ providers/2015.com.canonical.certification:qml-tests/data/upower.py 2015-06-24 09:13:59 +0000
170@@ -0,0 +1,32 @@
171+#!/usr/bin/env python3
172+# Copyright 2015 Canonical Ltd.
173+# Written by:
174+# Sylvain Pineau <sylvain.pineau@canonical.com>
175+#
176+# This program is free software: you can redistribute it and/or modify
177+# it under the terms of the GNU General Public License version 3,
178+# as published by the Free Software Foundation.
179+#
180+# This program is distributed in the hope that it will be useful,
181+# but WITHOUT ANY WARRANTY; without even the implied warranty of
182+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+# GNU General Public License for more details.
184+#
185+# You should have received a copy of the GNU General Public License
186+# along with this program. If not, see <http://www.gnu.org/licenses/>.
187+
188+import subprocess
189+import re
190+
191+def _get_battery_path():
192+ paths = subprocess.check_output(["upower", "-e"])
193+ match = re.search(b'/org/freedesktop/UPower/devices/battery.*', paths)
194+ if match:
195+ return match.group(0)
196+
197+def get_battery_percentage():
198+ path = _get_battery_path()
199+ info = subprocess.check_output(["upower", "-i", path])
200+ match = re.search(b'percentage:\s+(\d+)', info, re.M)
201+ if match:
202+ return match.group(1)
203
204=== modified file 'providers/2015.com.canonical.certification:qml-tests/units/qml-tests.pxu'
205--- providers/2015.com.canonical.certification:qml-tests/units/qml-tests.pxu 2015-06-18 09:57:25 +0000
206+++ providers/2015.com.canonical.certification:qml-tests/units/qml-tests.pxu 2015-06-24 09:13:59 +0000
207@@ -70,3 +70,17 @@
208 triggered by the platform
209 qml_file: screen-11.qml
210 estimated_duration: 10
211+
212+unit: category
213+id: Battery
214+_name: Battery Testing
215+
216+id: battery-01
217+category_id: Battery
218+plugin: qml
219+_summary: Ensure battery discharge is normal
220+_description:
221+ This test will monitor battery percentage.
222+ It will fail if more than 5% of total capacity is lost in 30m.
223+qml_file: battery-01.qml
224+estimated_duration: 1800

Subscribers

People subscribed via source and target branches