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
1=== modified file 'ubuntu_system_tests/helpers/scopes/photos/_cpo.py'
2--- ubuntu_system_tests/helpers/scopes/photos/_cpo.py 2016-09-15 08:28:48 +0000
3+++ ubuntu_system_tests/helpers/scopes/photos/_cpo.py 2016-09-20 14:57:33 +0000
4@@ -130,6 +130,11 @@
5 visible=True)
6 return label.get_parent('ListViewWithPageHeader')
7
8+ def refresh(self):
9+ _, _, width, height = self.get_properties()['globalRect']
10+ self.pointing_device.drag(width/2, height/2, width/2, height)
11+ self.wait_for_processing_to_complete()
12+
13 def get_header_title(self):
14 return self.select_single("DashPageHeader", visible=True).title
15
16
17=== modified file 'ubuntu_system_tests/tests/test_sdcard.py'
18--- ubuntu_system_tests/tests/test_sdcard.py 2016-09-13 13:39:56 +0000
19+++ ubuntu_system_tests/tests/test_sdcard.py 2016-09-20 14:57:33 +0000
20@@ -19,9 +19,11 @@
21
22 import os
23 import tempfile
24+from threading import Event
25 from urllib import request
26
27 from testtools import skipUnless
28+from ubuntu_system_tests.helpers import mediascanner
29
30 from ubuntu_system_tests.helpers.indicators.indicators import IndicatorsFactory
31 from ubuntu_system_tests.helpers.indicators.message import (
32@@ -118,12 +120,18 @@
33 """ Create several pictures to the sd card that will appear in the
34 today category
35 """
36+ scan_completed = Event()
37+ observer = mediascanner.start_mediascanner_observer(
38+ scan_completed, number)
39+ self.addCleanup(observer.stop)
40+
41 extension = os.path.splitext(SRC_PICTURE_FILE_1)[1]
42 new_file = tempfile.mkstemp(suffix=extension)[1]
43
44 images.create_new_image(SRC_PICTURE_FILE_1, new_file)
45 self.addCleanup(os.remove, new_file)
46 self._copy_pictures(new_file, number)
47+ scan_completed.wait()
48
49 def _copy_unknown_pictures(self, number):
50 """ Copy several pictures to the sd card that will appear in the
51@@ -257,30 +265,13 @@
52 @skipUnless(scopes.is_scope_included(scopes.SCOPE_ID_PHOTOS), SKIP_REASON)
53 def test_view_photos_from_sdcard(self):
54 """ Validate pictures stored in the sd card are displayed in the photos
55- scope and the buttons "See all" and "See less" work properly
56+ scope and the buttons "Show all" and "Show less" work properly
57 """
58-
59- # This step is added at the beginning to disable the skip button if
60- # needed, this is done before copying the pictures to the sd card to
61- # see those correctly in the 'my photos' section
62- scopes.go_to_photos_scope()
63-
64- # Prerequisite: Copy several pictures to the sd card
65- self._copy_new_pictures(20)
66- self._copy_unknown_pictures(2)
67-
68+ self._copy_new_pictures(3)
69 # Reload scope and go to my photos section
70 scope = scopes.go_to_photos_scope()
71+
72 my_photos = scope.go_to_my_photos()
73-
74 today = my_photos.get_today_category()
75- # Check all the pictures are displayed clicking on "See all"
76- self.assertTrue(today.is_see_all_displayed())
77- my_photos.see_all(today)
78- self.assertLessEqual(20, len(today.get_pictures_list()))
79- self.assertTrue(today.expanded)
80
81- # Check the pictures section is not expanded clicking on "See less"
82- self.assertTrue(today.is_see_less_displayed())
83- my_photos.see_less(today)
84- self.assertTrue(wait_until(today.is_not_see_less_displayed))
85+ self.assertLessEqual(3, len(today.get_pictures_list()))

Subscribers

People subscribed via source and target branches

to all changes: