Merge lp:~canonical-platform-qa/ubuntu-system-tests/gnome-software-tests into lp:ubuntu-system-tests
- gnome-software-tests
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~canonical-platform-qa/ubuntu-system-tests/gnome-software-tests |
Merge into: | lp:ubuntu-system-tests |
Diff against target: |
272 lines (+241/-0) 5 files modified
ubuntu_system_tests/helpers/gnome_sofware/__init__.py (+19/-0) ubuntu_system_tests/helpers/gnome_sofware/app.py (+30/-0) ubuntu_system_tests/helpers/gnome_sofware/cpo.py (+125/-0) ubuntu_system_tests/helpers/session/release.py (+1/-0) ubuntu_system_tests/tests/test_gnome_software.py (+66/-0) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/gnome-software-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
platform-qa-bot | continuous-integration | Needs Fixing | |
Heber Parrucci (community) | continuous-integration | Needs Fixing | |
Review via email: mp+335381@code.launchpad.net |
Commit message
Adding two tests for gnome-software application
Description of the change
Adding two tests for gnome-software application:
1- Show / Hide search
2- Existing application packaged as deb (installed)
Reference: https:/
@run_tests: ubuntu_
- 566. By Heber Parrucci
-
merge from trunk
Heber Parrucci (heber013) wrote : | # |
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:566
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:566
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:566
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 567. By Heber Parrucci
-
Minor change to test ubuntu-
system- tests-ci in jenkins
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
PASSED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Heber Parrucci (heber013) wrote : | # |
FAILED: Continuous integration, rev:567
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 568. By Heber Parrucci
-
merge from trunk
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:568
https:/
Executed test runs:
UNSTABLE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:568
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:568
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:568
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:568
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Unmerged revisions
- 568. By Heber Parrucci
-
merge from trunk
- 567. By Heber Parrucci
-
Minor change to test ubuntu-
system- tests-ci in jenkins - 566. By Heber Parrucci
-
merge from trunk
- 565. By Heber Parrucci
-
Adding two tests for gnome-software application
Preview Diff
1 | === added directory 'ubuntu_system_tests/helpers/gnome_sofware' |
2 | === added file 'ubuntu_system_tests/helpers/gnome_sofware/__init__.py' |
3 | --- ubuntu_system_tests/helpers/gnome_sofware/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ ubuntu_system_tests/helpers/gnome_sofware/__init__.py 2017-12-22 19:46:32 +0000 |
5 | @@ -0,0 +1,19 @@ |
6 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
7 | + |
8 | +# |
9 | +# Ubuntu System Tests |
10 | +# Copyright (C) 2016 Canonical |
11 | +# |
12 | +# This program is free software: you can redistribute it and/or modify |
13 | +# it under the terms of the GNU General Public License as published by |
14 | +# the Free Software Foundation, either version 3 of the License, or |
15 | +# (at your option) any later version. |
16 | +# |
17 | +# This program is distributed in the hope that it will be useful, |
18 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | +# GNU General Public License for more details. |
21 | +# |
22 | +# You should have received a copy of the GNU General Public License |
23 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
24 | +# |
25 | |
26 | === added file 'ubuntu_system_tests/helpers/gnome_sofware/app.py' |
27 | --- ubuntu_system_tests/helpers/gnome_sofware/app.py 1970-01-01 00:00:00 +0000 |
28 | +++ ubuntu_system_tests/helpers/gnome_sofware/app.py 2017-12-22 19:46:32 +0000 |
29 | @@ -0,0 +1,30 @@ |
30 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
31 | + |
32 | +# |
33 | +# Ubuntu System Tests |
34 | +# Copyright (C) 2017 Canonical |
35 | +# |
36 | +# This program is free software: you can redistribute it and/or modify |
37 | +# it under the terms of the GNU General Public License as published by |
38 | +# the Free Software Foundation, either version 3 of the License, or |
39 | +# (at your option) any later version. |
40 | +# |
41 | +# This program is distributed in the hope that it will be useful, |
42 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
43 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44 | +# GNU General Public License for more details. |
45 | +# |
46 | +# You should have received a copy of the GNU General Public License |
47 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
48 | +# |
49 | + |
50 | +from ubuntu_system_tests.helpers.application import Deb |
51 | + |
52 | +APP_NAME = 'gnome-software' |
53 | +APP_ID = 'org.gnome.Software' |
54 | + |
55 | + |
56 | +class GnomeSoftware(Deb): |
57 | + |
58 | + def __init__(self): |
59 | + super().__init__(APP_NAME, APP_ID) |
60 | |
61 | === added file 'ubuntu_system_tests/helpers/gnome_sofware/cpo.py' |
62 | --- ubuntu_system_tests/helpers/gnome_sofware/cpo.py 1970-01-01 00:00:00 +0000 |
63 | +++ ubuntu_system_tests/helpers/gnome_sofware/cpo.py 2017-12-22 19:46:32 +0000 |
64 | @@ -0,0 +1,125 @@ |
65 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
66 | + |
67 | +# |
68 | +# Ubuntu System Tests |
69 | +# Copyright (C) 2017 Canonical |
70 | +# |
71 | +# This program is free software: you can redistribute it and/or modify |
72 | +# it under the terms of the GNU General Public License as published by |
73 | +# the Free Software Foundation, either version 3 of the License, or |
74 | +# (at your option) any later version. |
75 | +# |
76 | +# This program is distributed in the hope that it will be useful, |
77 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
78 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
79 | +# GNU General Public License for more details. |
80 | +# |
81 | +# You should have received a copy of the GNU General Public License |
82 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
83 | +# |
84 | +import time |
85 | +from autopilot.exceptions import StateNotFoundError |
86 | +from dbus import DBusException |
87 | + |
88 | +from ubuntu_system_tests.helpers.input_manager import input_manager |
89 | + |
90 | + |
91 | +class GnomeSoftwareCPO: |
92 | + |
93 | + def __init__(self, proxy): |
94 | + self.proxy = proxy |
95 | + |
96 | + def click_search_button(self): |
97 | + """Click on the magnifying glass that represents the search button""" |
98 | + search_button = self.proxy.wait_select_single(BuilderName='search_button', |
99 | + ap_query_timeout=20, |
100 | + can_focus=True, |
101 | + visible=True) |
102 | + input_manager.pointer.click_object(search_button) |
103 | + |
104 | + def get_entry_search(self, *args, **kwargs): |
105 | + """Get the text box in which write the search""" |
106 | + try: |
107 | + return self.proxy.wait_select_single(BuilderName='entry_search', |
108 | + *args, **kwargs) |
109 | + except (DBusException, StateNotFoundError): |
110 | + return None |
111 | + |
112 | + def write_search(self, text): |
113 | + """Write the given text in the search box |
114 | + :param text: the string to write in search box |
115 | + :return: ResultsPage object |
116 | + """ |
117 | + self.get_entry_search(is_focus=True) |
118 | + input_manager.keyboard.type(text) |
119 | + return ResultsPage(self.proxy) |
120 | + |
121 | + |
122 | +class ResultsPage(GnomeSoftwareCPO): |
123 | + def __init__(self, proxy): |
124 | + super().__init__(proxy) |
125 | + |
126 | + def get_results(self, *args, **kwargs): |
127 | + """Get the current results |
128 | + :return the list with the current results or empty |
129 | + """ |
130 | + search = self.proxy.wait_select_single(BuilderName='list_box_search', |
131 | + *args, |
132 | + **kwargs) |
133 | + attempts = 1 |
134 | + retries = kwargs.pop('retries', 10) |
135 | + wait = kwargs.pop('wait', 5) |
136 | + # Wait until search finishes and return results |
137 | + while attempts < retries: |
138 | + try: |
139 | + self.proxy.select_single(BuilderName='spinner_search', |
140 | + active=True) |
141 | + time.sleep(wait) |
142 | + except (DBusException, StateNotFoundError): |
143 | + time.sleep(wait) |
144 | + if search.get_children(): |
145 | + return search.get_children() |
146 | + attempts += 1 |
147 | + continue |
148 | + return [] |
149 | + |
150 | + @staticmethod |
151 | + def check_item(item, *args): |
152 | + """Check if the given item attributes are displayed |
153 | + :param item: the item object to check the attributes for |
154 | + :param args: the list of attributes to check visibility |
155 | + :return True if all attributes are displayed, False otherwise |
156 | + """ |
157 | + try: |
158 | + [item.select_single(BuilderName=attr, visible=True) for attr in args] |
159 | + return True |
160 | + except (DBusException, StateNotFoundError): |
161 | + return False |
162 | + |
163 | + def open_item(self, item): |
164 | + """Click on the given item |
165 | + :param item: the item click on |
166 | + :return ItemDetailsPage instance |
167 | + """ |
168 | + input_manager.pointer.click_object(item) |
169 | + self.proxy.wait_select_single( |
170 | + BuilderName='box_details', |
171 | + visible=True) |
172 | + return ItemDetailsPage(self.proxy.select_single(BuilderName='details_page')) |
173 | + |
174 | + |
175 | +class ItemDetailsPage(GnomeSoftwareCPO): |
176 | + """Represent an item details""" |
177 | + def __init__(self, item_details_proxy): |
178 | + super().__init__(item_details_proxy) |
179 | + |
180 | + def check_description(self): |
181 | + """Check if the item details description is displayed""" |
182 | + description_box = self.proxy.wait_select_single( |
183 | + BuilderName='box_details_description', |
184 | + ap_query_timeout=20, |
185 | + visible=True) |
186 | + try: |
187 | + return description_box.wait_select_many('GtkLabel') |
188 | + except (DBusException, StateNotFoundError): |
189 | + return [] |
190 | |
191 | === modified file 'ubuntu_system_tests/helpers/session/release.py' |
192 | --- ubuntu_system_tests/helpers/session/release.py 2017-07-21 18:21:16 +0000 |
193 | +++ ubuntu_system_tests/helpers/session/release.py 2017-12-22 19:46:32 +0000 |
194 | @@ -26,6 +26,7 @@ |
195 | logger.setLevel(logging.INFO) |
196 | |
197 | ARTFUL = '17.10' |
198 | +XENIAL = '16.04' |
199 | |
200 | |
201 | def get_release(): |
202 | |
203 | === added file 'ubuntu_system_tests/tests/test_gnome_software.py' |
204 | --- ubuntu_system_tests/tests/test_gnome_software.py 1970-01-01 00:00:00 +0000 |
205 | +++ ubuntu_system_tests/tests/test_gnome_software.py 2017-12-22 19:46:32 +0000 |
206 | @@ -0,0 +1,66 @@ |
207 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
208 | + |
209 | +# Ubuntu System Tests |
210 | +# Copyright (C) 2017 Canonical |
211 | +# |
212 | +# This program is free software: you can redistribute it and/or modify |
213 | +# it under the terms of the GNU General Public License as published by |
214 | +# the Free Software Foundation, either version 3 of the License, or |
215 | +# (at your option) any later version. |
216 | +# |
217 | +# This program is distributed in the hope that it will be useful, |
218 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
219 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
220 | +# GNU General Public License for more details. |
221 | +# |
222 | +# You should have received a copy of the GNU General Public License |
223 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
224 | +from testtools import skipIf |
225 | + |
226 | +from ubuntu_system_tests.helpers.session.release import get_release, XENIAL |
227 | + |
228 | +from ubuntu_system_tests.helpers.gnome_sofware.cpo import GnomeSoftwareCPO |
229 | +from ubuntu_system_tests.helpers.testbed import run_command |
230 | +from ubuntu_system_tests.helpers.gnome_sofware.app import GnomeSoftware |
231 | +from ubuntu_system_tests.tests.base import BaseUbuntuSystemTestCase |
232 | + |
233 | + |
234 | +class TestGnomeSoftware(BaseUbuntuSystemTestCase): |
235 | + """Tests for gnome-software application""" |
236 | + |
237 | + def setUp(self): |
238 | + super(TestGnomeSoftware, self).setUp() |
239 | + run_command('killall gnome-software') |
240 | + self.root = GnomeSoftware().launch(app_type='gtk') |
241 | + self.app = GnomeSoftwareCPO(self.root) |
242 | + |
243 | + @skipIf(get_release() == XENIAL, |
244 | + 'skip for Xenial - This search entry is always shown in gnome-software 3.20') |
245 | + def test_show_hide_search(self): |
246 | + """Show / Hide search when clicking magnifying glass""" |
247 | + self.app.click_search_button() |
248 | + self.assertIsNotNone(self.app.get_entry_search(is_focus=True), |
249 | + 'Search entry is not shown') |
250 | + self.app.click_search_button() |
251 | + self.assertIsNotNone(self.app.get_entry_search(is_focus=False), |
252 | + 'Search entry is not hidden') |
253 | + |
254 | + def test_check_installed_deb(self): |
255 | + """ Check already installed deb """ |
256 | + # Perform the search |
257 | + self.app.click_search_button() |
258 | + results_page = self.app.write_search('gnome-software') |
259 | + # Verify that the result contains only 1 line with gnome-software. |
260 | + results = results_page.get_results() |
261 | + self.assertEquals(1, len(results), |
262 | + 'Expected 1 item. But found: %s' % len(results)) |
263 | + item = results[0] |
264 | + # Check item attributes in results |
265 | + self.assertTrue(results_page.check_item(item, |
266 | + 'image', |
267 | + 'star', |
268 | + 'description_label', |
269 | + 'label_installed')) |
270 | + # Open item and check details |
271 | + item_details = results_page.open_item(item) |
272 | + self.assertTrue(item_details.check_description()) |
PASSED: Continuous integration, rev:566 /platform- qa-jenkins. ubuntu. com/job/ ubuntu- system- tests-ci/ 1305/ /platform- qa-jenkins. ubuntu. com/job/ generic- update- mp/2418/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /platform- qa-jenkins. ubuntu. com/job/ ubuntu- system- tests-ci/ 1305/rebuild
https:/