Merge lp:~canonical-platform-qa/ubuntu-system-tests/fix_sd_card into lp:ubuntu-system-tests

Proposed by Santiago Baldassin
Status: Work in progress
Proposed branch: lp:~canonical-platform-qa/ubuntu-system-tests/fix_sd_card
Merge into: lp:ubuntu-system-tests
Diff against target: 85 lines (+17/-21)
2 files modified
ubuntu_system_tests/helpers/scopes/photos/_cpo.py (+5/-0)
ubuntu_system_tests/tests/test_sdcard.py (+12/-21)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/fix_sd_card
Reviewer Review Type Date Requested Status
platform-qa-bot continuous-integration Needs Fixing
Richard Huddie (community) Needs Fixing
prod-platform-qa continuous-integration Pending
Review via email: mp+305711@code.launchpad.net

Commit message

Including a refresh method for the photos scope

Description of the change

This merge proposal includes a refresh method to reload the photos scope after copying the pictures to the sd card and it also removes the show all and show less steps since they are not present anymore in the My Photos section

@run_tests: ubuntu_system_tests.tests.test_sdcard.SDCardSystemTest.test_view_photos_from_sdcard

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
Richard Huddie (rhuddie) wrote :

I think we should be able to remove any need for the scope refresh in this test. There is a mediascanner helper which can be used to wait for the mediascanner to complete, before navigating to the photos scope. Also, the first navigation to the scope in the test can be removed, as this was for when the scope setup was manually dismissed, which is not the case any longer. I've given it a quick try using this diff and it seems to work OK: http://pastebin.ubuntu.com/23203473/

A couple of other comments below.

review: Needs Fixing
459. By Santiago Baldassin

Addressing comments from the reviews

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

Thanks Richard. I made the changes that you suggested and replied inline to one of your questions.

460. By Santiago Baldassin

Merge from trunk

461. By Santiago Baldassin

Fixing flake 8 issue

Revision history for this message
Richard Huddie (rhuddie) wrote :

Just minor comments

review: Needs Fixing
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: Needs Fixing (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: Needs Fixing (continuous-integration)

Unmerged revisions

461. By Santiago Baldassin

Fixing flake 8 issue

460. By Santiago Baldassin

Merge from trunk

459. By Santiago Baldassin

Addressing comments from the reviews

458. By Santiago Baldassin

Refreshing the photos scope

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu_system_tests/helpers/scopes/photos/_cpo.py'
--- ubuntu_system_tests/helpers/scopes/photos/_cpo.py 2016-09-15 08:28:48 +0000
+++ ubuntu_system_tests/helpers/scopes/photos/_cpo.py 2016-09-20 14:57:33 +0000
@@ -130,6 +130,11 @@
130 visible=True)130 visible=True)
131 return label.get_parent('ListViewWithPageHeader')131 return label.get_parent('ListViewWithPageHeader')
132132
133 def refresh(self):
134 _, _, width, height = self.get_properties()['globalRect']
135 self.pointing_device.drag(width/2, height/2, width/2, height)
136 self.wait_for_processing_to_complete()
137
133 def get_header_title(self):138 def get_header_title(self):
134 return self.select_single("DashPageHeader", visible=True).title139 return self.select_single("DashPageHeader", visible=True).title
135140
136141
=== modified file 'ubuntu_system_tests/tests/test_sdcard.py'
--- ubuntu_system_tests/tests/test_sdcard.py 2016-09-13 13:39:56 +0000
+++ ubuntu_system_tests/tests/test_sdcard.py 2016-09-20 14:57:33 +0000
@@ -19,9 +19,11 @@
1919
20import os20import os
21import tempfile21import tempfile
22from threading import Event
22from urllib import request23from urllib import request
2324
24from testtools import skipUnless25from testtools import skipUnless
26from ubuntu_system_tests.helpers import mediascanner
2527
26from ubuntu_system_tests.helpers.indicators.indicators import IndicatorsFactory28from ubuntu_system_tests.helpers.indicators.indicators import IndicatorsFactory
27from ubuntu_system_tests.helpers.indicators.message import (29from ubuntu_system_tests.helpers.indicators.message import (
@@ -118,12 +120,18 @@
118 """ Create several pictures to the sd card that will appear in the120 """ Create several pictures to the sd card that will appear in the
119 today category121 today category
120 """122 """
123 scan_completed = Event()
124 observer = mediascanner.start_mediascanner_observer(
125 scan_completed, number)
126 self.addCleanup(observer.stop)
127
121 extension = os.path.splitext(SRC_PICTURE_FILE_1)[1]128 extension = os.path.splitext(SRC_PICTURE_FILE_1)[1]
122 new_file = tempfile.mkstemp(suffix=extension)[1]129 new_file = tempfile.mkstemp(suffix=extension)[1]
123130
124 images.create_new_image(SRC_PICTURE_FILE_1, new_file)131 images.create_new_image(SRC_PICTURE_FILE_1, new_file)
125 self.addCleanup(os.remove, new_file)132 self.addCleanup(os.remove, new_file)
126 self._copy_pictures(new_file, number)133 self._copy_pictures(new_file, number)
134 scan_completed.wait()
127135
128 def _copy_unknown_pictures(self, number):136 def _copy_unknown_pictures(self, number):
129 """ Copy several pictures to the sd card that will appear in the137 """ Copy several pictures to the sd card that will appear in the
@@ -257,30 +265,13 @@
257 @skipUnless(scopes.is_scope_included(scopes.SCOPE_ID_PHOTOS), SKIP_REASON)265 @skipUnless(scopes.is_scope_included(scopes.SCOPE_ID_PHOTOS), SKIP_REASON)
258 def test_view_photos_from_sdcard(self):266 def test_view_photos_from_sdcard(self):
259 """ Validate pictures stored in the sd card are displayed in the photos267 """ Validate pictures stored in the sd card are displayed in the photos
260 scope and the buttons "See all" and "See less" work properly268 scope and the buttons "Show all" and "Show less" work properly
261 """269 """
262270 self._copy_new_pictures(3)
263 # This step is added at the beginning to disable the skip button if
264 # needed, this is done before copying the pictures to the sd card to
265 # see those correctly in the 'my photos' section
266 scopes.go_to_photos_scope()
267
268 # Prerequisite: Copy several pictures to the sd card
269 self._copy_new_pictures(20)
270 self._copy_unknown_pictures(2)
271
272 # Reload scope and go to my photos section271 # Reload scope and go to my photos section
273 scope = scopes.go_to_photos_scope()272 scope = scopes.go_to_photos_scope()
273
274 my_photos = scope.go_to_my_photos()274 my_photos = scope.go_to_my_photos()
275
276 today = my_photos.get_today_category()275 today = my_photos.get_today_category()
277 # Check all the pictures are displayed clicking on "See all"
278 self.assertTrue(today.is_see_all_displayed())
279 my_photos.see_all(today)
280 self.assertLessEqual(20, len(today.get_pictures_list()))
281 self.assertTrue(today.expanded)
282276
283 # Check the pictures section is not expanded clicking on "See less"277 self.assertLessEqual(3, len(today.get_pictures_list()))
284 self.assertTrue(today.is_see_less_displayed())
285 my_photos.see_less(today)
286 self.assertTrue(wait_until(today.is_not_see_less_displayed))

Subscribers

People subscribed via source and target branches

to all changes: