Merge lp:~phablet-team/camera-app/refactor-and-fix-editor-tests into lp:camera-app
- refactor-and-fix-editor-tests
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Florian Boucault |
Approved revision: | 537 |
Merged at revision: | 534 |
Proposed branch: | lp:~phablet-team/camera-app/refactor-and-fix-editor-tests |
Merge into: | lp:camera-app |
Diff against target: |
479 lines (+171/-117) 7 files modified
tests/autopilot/camera_app/data/__init__.py (+6/-0) tests/autopilot/camera_app/emulators/main_window.py (+4/-2) tests/autopilot/camera_app/emulators/panel.py (+4/-3) tests/autopilot/camera_app/tests/__init__.py (+30/-0) tests/autopilot/camera_app/tests/test_capture.py (+5/-2) tests/autopilot/camera_app/tests/test_gallery_view.py (+63/-73) tests/autopilot/camera_app/tests/test_photo_editor.py (+59/-37) |
To merge this branch: | bzr merge lp:~phablet-team/camera-app/refactor-and-fix-editor-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Florian Boucault (community) | Approve | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email: mp+250931@code.launchpad.net |
Commit message
Refactor camera editor tests, make them work even if UI extras are not installed, and add a test for the edit button being disabled when on a video
Description of the change
Refactor camera editor tests, make them work even if UI extras are not installed, and add a test for the edit button being disabled when on a video
PS Jenkins bot (ps-jenkins) wrote : | # |
- 527. By Ugo Riboni
-
Fix very random bug on dragging the panel by maximizing the speed of drag
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:527
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:527
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 528. By Ugo Riboni
-
Prevent failure when removing config file if it does not exist
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:528
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:527
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:527
http://
Executed test runs:
None: http://
None: http://
None: http://
None: http://
FAILURE: http://
None: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:527
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 529. By Ugo Riboni
-
Merge lp:~canonical-platform-qa/camera-app/close-panel-helper-fix to group more fixes in one review
- 530. By Ugo Riboni
-
Explicit rate parameter in calls to drag
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:530
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:527
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 531. By Ugo Riboni
-
When possible prefer adding sample media in advance of launching the app than taking actual pictures or videos
- 532. By Ugo Riboni
-
Make sure we don't fail if for any reason there are subdirectories while we try to clean the media directory
- 533. By Ugo Riboni
-
Merge changes from trunk
- 534. By Ugo Riboni
-
Fix missing parameter on call
- 535. By Ugo Riboni
-
Minimize swipe speed when switching to gallery view and back as it seems to be necessary to fix the problem in combination with previous changes
- 536. By Ugo Riboni
-
Ensure environment is clean of other media when running tests
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:533
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:536
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:533
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 537. By Ugo Riboni
-
Ensure editor tests have photo or video present before starting the test, or they will not be picked up
Florian Boucault (fboucault) wrote : | # |
All tests green on krillin RTM
Preview Diff
1 | === added directory 'tests/autopilot/camera_app/data' | |||
2 | === added file 'tests/autopilot/camera_app/data/__init__.py' | |||
3 | --- tests/autopilot/camera_app/data/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ tests/autopilot/camera_app/data/__init__.py 2015-03-11 09:25:45 +0000 | |||
5 | @@ -0,0 +1,6 @@ | |||
6 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
7 | 2 | # Copyright 2015 Canonical | ||
8 | 3 | # | ||
9 | 4 | # This program is free software: you can redistribute it and/or modify it | ||
10 | 5 | # under the terms of the GNU General Public License version 3, as published | ||
11 | 6 | # by the Free Software Foundation. | ||
12 | 0 | 7 | ||
13 | === added file 'tests/autopilot/camera_app/data/sample.jpg' | |||
14 | 1 | Binary files tests/autopilot/camera_app/data/sample.jpg 1970-01-01 00:00:00 +0000 and tests/autopilot/camera_app/data/sample.jpg 2015-03-11 09:25:45 +0000 differ | 8 | Binary files tests/autopilot/camera_app/data/sample.jpg 1970-01-01 00:00:00 +0000 and tests/autopilot/camera_app/data/sample.jpg 2015-03-11 09:25:45 +0000 differ |
15 | === added file 'tests/autopilot/camera_app/data/sample.mp4' | |||
16 | 2 | Binary files tests/autopilot/camera_app/data/sample.mp4 1970-01-01 00:00:00 +0000 and tests/autopilot/camera_app/data/sample.mp4 2015-03-11 09:25:45 +0000 differ | 9 | Binary files tests/autopilot/camera_app/data/sample.mp4 1970-01-01 00:00:00 +0000 and tests/autopilot/camera_app/data/sample.mp4 2015-03-11 09:25:45 +0000 differ |
17 | === modified file 'tests/autopilot/camera_app/emulators/main_window.py' | |||
18 | --- tests/autopilot/camera_app/emulators/main_window.py 2015-01-27 17:36:59 +0000 | |||
19 | +++ tests/autopilot/camera_app/emulators/main_window.py 2015-03-11 09:25:45 +0000 | |||
20 | @@ -5,6 +5,8 @@ | |||
21 | 5 | # under the terms of the GNU General Public License version 3, as published | 5 | # under the terms of the GNU General Public License version 3, as published |
22 | 6 | # by the Free Software Foundation. | 6 | # by the Free Software Foundation. |
23 | 7 | 7 | ||
24 | 8 | import sys | ||
25 | 9 | |||
26 | 8 | from camera_app.emulators.panel import Panel | 10 | from camera_app.emulators.panel import Panel |
27 | 9 | from autopilot.matchers import Eventually | 11 | from autopilot.matchers import Eventually |
28 | 10 | from testtools.matchers import Equals | 12 | from testtools.matchers import Equals |
29 | @@ -141,7 +143,7 @@ | |||
30 | 141 | tx = x + (w // 2) | 143 | tx = x + (w // 2) |
31 | 142 | ty = y + (h // 2) | 144 | ty = y + (h // 2) |
32 | 143 | 145 | ||
34 | 144 | testCase.pointing_device.drag(tx, ty, (tx - main_view.width // 2), ty) | 146 | testCase.pointing_device.drag(tx, ty, x, ty, rate=1) |
35 | 145 | viewfinder = self.get_viewfinder() | 147 | viewfinder = self.get_viewfinder() |
36 | 146 | testCase.assertThat(viewfinder.inView, Eventually(Equals(False))) | 148 | testCase.assertThat(viewfinder.inView, Eventually(Equals(False))) |
37 | 147 | 149 | ||
38 | @@ -152,6 +154,6 @@ | |||
39 | 152 | tx = x + (w // 2) | 154 | tx = x + (w // 2) |
40 | 153 | ty = y + (h // 2) | 155 | ty = y + (h // 2) |
41 | 154 | 156 | ||
43 | 155 | testCase.pointing_device.drag(tx, ty, (tx + main_view.width // 2), ty) | 157 | testCase.pointing_device.drag(tx, ty, (tx + main_view.width // 2), ty, rate=1) |
44 | 156 | viewfinder = self.get_viewfinder() | 158 | viewfinder = self.get_viewfinder() |
45 | 157 | testCase.assertThat(viewfinder.inView, Eventually(Equals(True))) | 159 | testCase.assertThat(viewfinder.inView, Eventually(Equals(True))) |
46 | 158 | 160 | ||
47 | === modified file 'tests/autopilot/camera_app/emulators/panel.py' | |||
48 | --- tests/autopilot/camera_app/emulators/panel.py 2014-12-10 17:47:57 +0000 | |||
49 | +++ tests/autopilot/camera_app/emulators/panel.py 2015-03-11 09:25:45 +0000 | |||
50 | @@ -6,6 +6,7 @@ | |||
51 | 6 | # by the Free Software Foundation. | 6 | # by the Free Software Foundation. |
52 | 7 | 7 | ||
53 | 8 | import logging | 8 | import logging |
54 | 9 | import sys | ||
55 | 9 | 10 | ||
56 | 10 | from autopilot import logging as autopilot_logging | 11 | from autopilot import logging as autopilot_logging |
57 | 11 | from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase | 12 | from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase |
58 | @@ -38,7 +39,7 @@ | |||
59 | 38 | start_y = y + self.height - 1 | 39 | start_y = y + self.height - 1 |
60 | 39 | stop_y = y | 40 | stop_y = y |
61 | 40 | 41 | ||
63 | 41 | self.pointing_device.drag(line_x, start_y, line_x, stop_y) | 42 | self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize) |
64 | 42 | 43 | ||
65 | 43 | @autopilot_logging.log_action(logger.info) | 44 | @autopilot_logging.log_action(logger.info) |
66 | 44 | def close(self): | 45 | def close(self): |
67 | @@ -51,8 +52,8 @@ | |||
68 | 51 | 52 | ||
69 | 52 | def _drag_to_close(self): | 53 | def _drag_to_close(self): |
70 | 53 | x, y, _, _ = self.globalRect | 54 | x, y, _, _ = self.globalRect |
72 | 54 | line_x = x | 55 | line_x = x + self.width - 1 |
73 | 55 | start_y = y | 56 | start_y = y |
74 | 56 | stop_y = y + self.height - 1 | 57 | stop_y = y + self.height - 1 |
75 | 57 | 58 | ||
77 | 58 | self.pointing_device.drag(line_x, start_y, line_x, stop_y) | 59 | self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize) |
78 | 59 | 60 | ||
79 | === modified file 'tests/autopilot/camera_app/tests/__init__.py' | |||
80 | --- tests/autopilot/camera_app/tests/__init__.py 2014-11-17 14:27:25 +0000 | |||
81 | +++ tests/autopilot/camera_app/tests/__init__.py 2015-03-11 09:25:45 +0000 | |||
82 | @@ -9,10 +9,15 @@ | |||
83 | 9 | 9 | ||
84 | 10 | import os | 10 | import os |
85 | 11 | import time | 11 | import time |
86 | 12 | import shutil | ||
87 | 13 | from time import sleep | ||
88 | 14 | from pkg_resources import resource_filename | ||
89 | 12 | 15 | ||
90 | 13 | from autopilot.input import Mouse, Touch, Pointer | 16 | from autopilot.input import Mouse, Touch, Pointer |
91 | 14 | from autopilot.platform import model | 17 | from autopilot.platform import model |
92 | 15 | from autopilot.testcase import AutopilotTestCase | 18 | from autopilot.testcase import AutopilotTestCase |
93 | 19 | from autopilot.matchers import Eventually | ||
94 | 20 | from testtools.matchers import Equals | ||
95 | 16 | 21 | ||
96 | 17 | from camera_app.emulators.main_window import MainWindow | 22 | from camera_app.emulators.main_window import MainWindow |
97 | 18 | from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase | 23 | from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase |
98 | @@ -32,6 +37,10 @@ | |||
99 | 32 | local_location = "../../camera-app" | 37 | local_location = "../../camera-app" |
100 | 33 | deb_location = '/usr/bin/camera-app' | 38 | deb_location = '/usr/bin/camera-app' |
101 | 34 | 39 | ||
102 | 40 | pictures_dir = os.path.expanduser("~/Pictures/com.ubuntu.camera") | ||
103 | 41 | videos_dir = os.path.expanduser("~/Videos/com.ubuntu.camera") | ||
104 | 42 | sample_dir = resource_filename('camera_app', 'data') | ||
105 | 43 | |||
106 | 35 | def setUp(self): | 44 | def setUp(self): |
107 | 36 | self.pointing_device = Pointer(self.input_device_class.create()) | 45 | self.pointing_device = Pointer(self.input_device_class.create()) |
108 | 37 | super(CameraAppTestCase, self).setUp() | 46 | super(CameraAppTestCase, self).setUp() |
109 | @@ -79,3 +88,24 @@ | |||
110 | 79 | @property | 88 | @property |
111 | 80 | def main_window(self): | 89 | def main_window(self): |
112 | 81 | return MainWindow(self.app) | 90 | return MainWindow(self.app) |
113 | 91 | |||
114 | 92 | def delete_all_media(self): | ||
115 | 93 | picture_files = os.listdir(self.pictures_dir) | ||
116 | 94 | for f in picture_files: | ||
117 | 95 | f = os.path.join(self.pictures_dir, f) | ||
118 | 96 | if os.path.isfile(f): | ||
119 | 97 | os.remove(f) | ||
120 | 98 | |||
121 | 99 | video_files = os.listdir(self.videos_dir) | ||
122 | 100 | for f in video_files: | ||
123 | 101 | f = os.path.join(self.videos_dir, f) | ||
124 | 102 | if os.path.isfile(f): | ||
125 | 103 | os.remove(f) | ||
126 | 104 | |||
127 | 105 | def add_sample_photo(self): | ||
128 | 106 | shutil.copyfile(os.path.join(self.sample_dir, "sample.jpg"), | ||
129 | 107 | os.path.join(self.pictures_dir, "sample.jpg")) | ||
130 | 108 | |||
131 | 109 | def add_sample_video(self): | ||
132 | 110 | shutil.copyfile(os.path.join(self.sample_dir, "sample.mp4"), | ||
133 | 111 | os.path.join(self.videos_dir, "sample.mp4")) | ||
134 | 82 | 112 | ||
135 | === modified file 'tests/autopilot/camera_app/tests/test_capture.py' | |||
136 | --- tests/autopilot/camera_app/tests/test_capture.py 2015-01-20 12:33:39 +0000 | |||
137 | +++ tests/autopilot/camera_app/tests/test_capture.py 2015-03-11 09:25:45 +0000 | |||
138 | @@ -28,7 +28,8 @@ | |||
139 | 28 | def setUp(self): | 28 | def setUp(self): |
140 | 29 | # Remove configuration file where knowledge of the photo roll hint's necessity is stored | 29 | # Remove configuration file where knowledge of the photo roll hint's necessity is stored |
141 | 30 | config_file = os.path.expanduser("~/.config/com.ubuntu.camera/com.ubuntu.camera.conf") | 30 | config_file = os.path.expanduser("~/.config/com.ubuntu.camera/com.ubuntu.camera.conf") |
143 | 31 | os.remove(config_file) | 31 | if os.path.exists(config_file): |
144 | 32 | os.remove(config_file) | ||
145 | 32 | 33 | ||
146 | 33 | super(TestCapture, self).setUp() | 34 | super(TestCapture, self).setUp() |
147 | 34 | 35 | ||
148 | @@ -199,7 +200,9 @@ | |||
149 | 199 | def delete_all_photos(self): | 200 | def delete_all_photos(self): |
150 | 200 | picture_files = os.listdir(self.pictures_dir) | 201 | picture_files = os.listdir(self.pictures_dir) |
151 | 201 | for f in picture_files: | 202 | for f in picture_files: |
153 | 202 | os.remove(os.path.join(self.pictures_dir, f)) | 203 | f = os.path.join(self.pictures_dir, f) |
154 | 204 | if os.path.isfile(f): | ||
155 | 205 | os.remove(os.path.join(self.pictures_dir, f)) | ||
156 | 203 | 206 | ||
157 | 204 | def get_first_picture(self, timeout=10): | 207 | def get_first_picture(self, timeout=10): |
158 | 205 | pictures = [] | 208 | pictures = [] |
159 | 206 | 209 | ||
160 | === modified file 'tests/autopilot/camera_app/tests/test_gallery_view.py' | |||
161 | --- tests/autopilot/camera_app/tests/test_gallery_view.py 2015-02-18 14:23:02 +0000 | |||
162 | +++ tests/autopilot/camera_app/tests/test_gallery_view.py 2015-03-11 09:25:45 +0000 | |||
163 | @@ -16,24 +16,8 @@ | |||
164 | 16 | import os | 16 | import os |
165 | 17 | from time import sleep | 17 | from time import sleep |
166 | 18 | 18 | ||
183 | 19 | 19 | class TestCameraGalleryViewMixin(object): | |
168 | 20 | class TestCameraGalleryView(CameraAppTestCase): | ||
169 | 21 | """Tests the main camera features""" | ||
170 | 22 | |||
171 | 23 | """ This is needed to wait for the application to start. | ||
172 | 24 | In the testfarm, the application may take some time to show up.""" | ||
173 | 25 | def setUp(self): | ||
174 | 26 | super(TestCameraGalleryView, self).setUp() | ||
175 | 27 | self.assertThat( | ||
176 | 28 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
177 | 29 | self.pictures_dir = os.path.expanduser("~/Pictures/com.ubuntu.camera") | ||
178 | 30 | self.videos_dir = os.path.expanduser("~/Videos/com.ubuntu.camera") | ||
179 | 31 | |||
180 | 32 | def tearDown(self): | ||
181 | 33 | super(TestCameraGalleryView, self).tearDown() | ||
182 | 34 | |||
184 | 35 | def move_from_slideshow_to_photogrid(self): | 20 | def move_from_slideshow_to_photogrid(self): |
185 | 36 | # make sure we move from slideshow to photogrid view | ||
186 | 37 | gallery = self.main_window.get_gallery() | 21 | gallery = self.main_window.get_gallery() |
187 | 38 | 22 | ||
188 | 39 | slideshow_view = gallery.wait_select_single("SlideshowView") | 23 | slideshow_view = gallery.wait_select_single("SlideshowView") |
189 | @@ -52,39 +36,6 @@ | |||
190 | 52 | self.assertThat(slideshow_view.visible, Eventually(Equals(False))) | 36 | self.assertThat(slideshow_view.visible, Eventually(Equals(False))) |
191 | 53 | self.assertThat(photogrid_view.visible, Eventually(Equals(True))) | 37 | self.assertThat(photogrid_view.visible, Eventually(Equals(True))) |
192 | 54 | 38 | ||
193 | 55 | def delete_all_media(self): | ||
194 | 56 | picture_files = os.listdir(self.pictures_dir) | ||
195 | 57 | for f in picture_files: | ||
196 | 58 | f = os.path.join(self.pictures_dir, f) | ||
197 | 59 | if os.path.isfile(f): | ||
198 | 60 | os.remove(f) | ||
199 | 61 | |||
200 | 62 | video_files = os.listdir(self.videos_dir) | ||
201 | 63 | for f in video_files: | ||
202 | 64 | f = os.path.join(self.videos_dir, f) | ||
203 | 65 | if os.path.isfile(f): | ||
204 | 66 | os.remove(f) | ||
205 | 67 | |||
206 | 68 | def add_sample_photo(self): | ||
207 | 69 | self.main_window.swipe_to_viewfinder(self) | ||
208 | 70 | exposure_button = self.main_window.get_exposure_button() | ||
209 | 71 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) | ||
210 | 72 | self.pointing_device.move_to_object(exposure_button) | ||
211 | 73 | self.pointing_device.click() | ||
212 | 74 | |||
213 | 75 | def add_sample_video(self): | ||
214 | 76 | self.main_window.swipe_to_viewfinder(self) | ||
215 | 77 | video_button = self.main_window.get_record_control() | ||
216 | 78 | self.pointing_device.move_to_object(video_button) | ||
217 | 79 | self.pointing_device.click() | ||
218 | 80 | |||
219 | 81 | exposure_button = self.main_window.get_exposure_button() | ||
220 | 82 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) | ||
221 | 83 | self.pointing_device.move_to_object(exposure_button) | ||
222 | 84 | self.pointing_device.click() | ||
223 | 85 | sleep(3) | ||
224 | 86 | self.pointing_device.click() | ||
225 | 87 | |||
226 | 88 | def select_first_photo(self): | 39 | def select_first_photo(self): |
227 | 89 | # select the first photo | 40 | # select the first photo |
228 | 90 | gallery = self.main_window.get_gallery() | 41 | gallery = self.main_window.get_gallery() |
229 | @@ -96,6 +47,18 @@ | |||
230 | 96 | sleep(1) | 47 | sleep(1) |
231 | 97 | self.pointing_device.release() | 48 | self.pointing_device.release() |
232 | 98 | 49 | ||
233 | 50 | class TestCameraGalleryView(CameraAppTestCase, TestCameraGalleryViewMixin): | ||
234 | 51 | """Tests the camera gallery view without media already present""" | ||
235 | 52 | |||
236 | 53 | def setUp(self): | ||
237 | 54 | self.delete_all_media() | ||
238 | 55 | super(TestCameraGalleryView, self).setUp() | ||
239 | 56 | self.assertThat( | ||
240 | 57 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
241 | 58 | |||
242 | 59 | def tearDown(self): | ||
243 | 60 | super(TestCameraGalleryView, self).tearDown() | ||
244 | 61 | |||
245 | 99 | """Tests swiping to the gallery and pressing the back button""" | 62 | """Tests swiping to the gallery and pressing the back button""" |
246 | 100 | def test_swipe_to_gallery(self): | 63 | def test_swipe_to_gallery(self): |
247 | 101 | viewfinder = self.main_window.get_viewfinder() | 64 | viewfinder = self.main_window.get_viewfinder() |
248 | @@ -120,7 +83,6 @@ | |||
249 | 120 | 83 | ||
250 | 121 | """Tests swiping to the gallery/photo roll with no media in it""" | 84 | """Tests swiping to the gallery/photo roll with no media in it""" |
251 | 122 | def test_swipe_to_empty_gallery(self): | 85 | def test_swipe_to_empty_gallery(self): |
252 | 123 | self.delete_all_media() | ||
253 | 124 | viewfinder = self.main_window.get_viewfinder() | 86 | viewfinder = self.main_window.get_viewfinder() |
254 | 125 | gallery = self.main_window.get_gallery() | 87 | gallery = self.main_window.get_gallery() |
255 | 126 | 88 | ||
256 | @@ -133,14 +95,31 @@ | |||
257 | 133 | 95 | ||
258 | 134 | self.assertThat(hint.visible, Eventually(Equals(True))) | 96 | self.assertThat(hint.visible, Eventually(Equals(True))) |
259 | 135 | 97 | ||
261 | 136 | self.add_sample_photo() | 98 | # Take a picture and verify that the no media hint disappears |
262 | 99 | self.main_window.swipe_to_viewfinder(self) | ||
263 | 100 | exposure_button = self.main_window.get_exposure_button() | ||
264 | 101 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) | ||
265 | 102 | self.pointing_device.move_to_object(exposure_button) | ||
266 | 103 | self.pointing_device.click() | ||
267 | 137 | 104 | ||
268 | 138 | self.assertThat(hint.visible, Eventually(Equals(False))) | 105 | self.assertThat(hint.visible, Eventually(Equals(False))) |
269 | 139 | 106 | ||
270 | 107 | class TestCameraGalleryViewWithVideo(TestCameraGalleryViewMixin, CameraAppTestCase): | ||
271 | 108 | """Tests the camera gallery view with video already present""" | ||
272 | 109 | |||
273 | 110 | def setUp(self): | ||
274 | 111 | self.delete_all_media() | ||
275 | 112 | self.add_sample_video() | ||
276 | 113 | |||
277 | 114 | super(TestCameraGalleryViewWithVideo, self).setUp() | ||
278 | 115 | self.assertThat( | ||
279 | 116 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
280 | 117 | |||
281 | 118 | def tearDown(self): | ||
282 | 119 | super(TestCameraGalleryViewWithVideo, self).tearDown() | ||
283 | 120 | |||
284 | 140 | """Tests the thumnails for video load correctly in slideshow view""" | 121 | """Tests the thumnails for video load correctly in slideshow view""" |
285 | 141 | def test_video_thumbnails(self): | 122 | def test_video_thumbnails(self): |
286 | 142 | self.add_sample_video() | ||
287 | 143 | self.delete_all_media() | ||
288 | 144 | viewfinder = self.main_window.get_viewfinder() | 123 | viewfinder = self.main_window.get_viewfinder() |
289 | 145 | gallery = self.main_window.get_gallery() | 124 | gallery = self.main_window.get_gallery() |
290 | 146 | 125 | ||
291 | @@ -152,29 +131,22 @@ | |||
292 | 152 | spinner = gallery.wait_select_single("ActivityIndicator") | 131 | spinner = gallery.wait_select_single("ActivityIndicator") |
293 | 153 | self.assertThat(spinner.running, Eventually(Equals(False))) | 132 | self.assertThat(spinner.running, Eventually(Equals(False))) |
294 | 154 | 133 | ||
297 | 155 | """Tests entering/leaving multiselection mode in the photogrid view""" | 134 | class TestCameraGalleryViewWithPhoto(TestCameraGalleryViewMixin, CameraAppTestCase): |
298 | 156 | def test_multiselection_mode(self): | 135 | """Tests the camera gallery view with photo already present""" |
299 | 136 | |||
300 | 137 | def setUp(self): | ||
301 | 138 | self.delete_all_media() | ||
302 | 157 | self.add_sample_photo() | 139 | self.add_sample_photo() |
318 | 158 | self.main_window.swipe_to_gallery(self) | 140 | |
319 | 159 | self.move_from_slideshow_to_photogrid() | 141 | super(TestCameraGalleryViewWithPhoto, self).setUp() |
320 | 160 | self.select_first_photo() | 142 | self.assertThat( |
321 | 161 | 143 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | |
322 | 162 | # exit the multiselection mode | 144 | |
323 | 163 | gallery = self.main_window.get_gallery() | 145 | def tearDown(self): |
324 | 164 | back_button = gallery.wait_select_single(objectName="backButton") | 146 | super(TestCameraGalleryViewWithPhoto, self).tearDown() |
310 | 165 | self.pointing_device.move_to_object(back_button) | ||
311 | 166 | self.pointing_device.click() | ||
312 | 167 | |||
313 | 168 | slideshow_view = gallery.wait_select_single("SlideshowView") | ||
314 | 169 | photogrid_view = gallery.wait_select_single("PhotogridView") | ||
315 | 170 | |||
316 | 171 | self.assertThat(slideshow_view.visible, Eventually(Equals(False))) | ||
317 | 172 | self.assertThat(photogrid_view.visible, Eventually(Equals(True))) | ||
325 | 173 | 147 | ||
326 | 174 | """Test deleting photo from multiselection""" | 148 | """Test deleting photo from multiselection""" |
327 | 175 | def test_delete_photo_from_multiselection(self): | 149 | def test_delete_photo_from_multiselection(self): |
328 | 176 | self.delete_all_media() | ||
329 | 177 | self.add_sample_photo() | ||
330 | 178 | self.main_window.swipe_to_gallery(self) | 150 | self.main_window.swipe_to_gallery(self) |
331 | 179 | self.move_from_slideshow_to_photogrid() | 151 | self.move_from_slideshow_to_photogrid() |
332 | 180 | self.select_first_photo() | 152 | self.select_first_photo() |
333 | @@ -197,3 +169,21 @@ | |||
334 | 197 | 169 | ||
335 | 198 | hint = self.main_window.get_no_media_hint() | 170 | hint = self.main_window.get_no_media_hint() |
336 | 199 | self.assertThat(hint.visible, Eventually(Equals(True))) | 171 | self.assertThat(hint.visible, Eventually(Equals(True))) |
337 | 172 | |||
338 | 173 | """Tests entering/leaving multiselection mode in the photogrid view""" | ||
339 | 174 | def test_multiselection_mode(self): | ||
340 | 175 | self.main_window.swipe_to_gallery(self) | ||
341 | 176 | self.move_from_slideshow_to_photogrid() | ||
342 | 177 | self.select_first_photo() | ||
343 | 178 | |||
344 | 179 | # exit the multiselection mode | ||
345 | 180 | gallery = self.main_window.get_gallery() | ||
346 | 181 | back_button = gallery.wait_select_single(objectName="backButton") | ||
347 | 182 | self.pointing_device.move_to_object(back_button) | ||
348 | 183 | self.pointing_device.click() | ||
349 | 184 | |||
350 | 185 | slideshow_view = gallery.wait_select_single("SlideshowView") | ||
351 | 186 | photogrid_view = gallery.wait_select_single("PhotogridView") | ||
352 | 187 | |||
353 | 188 | self.assertThat(slideshow_view.visible, Eventually(Equals(False))) | ||
354 | 189 | self.assertThat(photogrid_view.visible, Eventually(Equals(True))) | ||
355 | 200 | 190 | ||
356 | === modified file 'tests/autopilot/camera_app/tests/test_photo_editor.py' | |||
357 | --- tests/autopilot/camera_app/tests/test_photo_editor.py 2014-12-16 13:26:28 +0000 | |||
358 | +++ tests/autopilot/camera_app/tests/test_photo_editor.py 2015-03-11 09:25:45 +0000 | |||
359 | @@ -18,49 +18,23 @@ | |||
360 | 18 | from time import sleep | 18 | from time import sleep |
361 | 19 | 19 | ||
362 | 20 | 20 | ||
365 | 21 | class TestCameraPhotoEditor(CameraAppTestCase): | 21 | class TestCameraPhotoEditorWithPhoto(CameraAppTestCase): |
366 | 22 | """Tests the main camera features""" | 22 | """Tests photo editor when a photo is present""" |
367 | 23 | 23 | ||
368 | 24 | """ This is needed to wait for the application to start. | ||
369 | 25 | In the testfarm, the application may take some time to show up.""" | ||
370 | 26 | def setUp(self): | 24 | def setUp(self): |
372 | 27 | super(TestCameraPhotoEditor, self).setUp() | 25 | self.delete_all_media() |
373 | 26 | self.add_sample_photo() | ||
374 | 27 | |||
375 | 28 | super(TestCameraPhotoEditorWithPhoto, self).setUp() | ||
376 | 28 | self.assertThat( | 29 | self.assertThat( |
377 | 29 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | 30 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
378 | 30 | self.pictures_dir = os.path.expanduser("~/Pictures/com.ubuntu.camera") | ||
379 | 31 | self.videos_dir = os.path.expanduser("~/Videos/com.ubuntu.camera") | ||
380 | 32 | 31 | ||
381 | 33 | def tearDown(self): | 32 | def tearDown(self): |
411 | 34 | super(TestCameraPhotoEditor, self).tearDown() | 33 | super(TestCameraPhotoEditorWithPhoto, self).tearDown() |
412 | 35 | 34 | ||
413 | 36 | def delete_all_media(self): | 35 | """Tests editor opening and closing correctly for pictures""" |
385 | 37 | picture_files = os.listdir(self.pictures_dir) | ||
386 | 38 | for f in picture_files: | ||
387 | 39 | os.remove(os.path.join(self.pictures_dir, f)) | ||
388 | 40 | |||
389 | 41 | video_files = os.listdir(self.videos_dir) | ||
390 | 42 | for f in video_files: | ||
391 | 43 | os.remove(os.path.join(self.videos_dir, f)) | ||
392 | 44 | |||
393 | 45 | def add_sample_photo(self): | ||
394 | 46 | # add a fake photo to pictures_dir | ||
395 | 47 | photo_path = os.path.join(self.pictures_dir, "fake_photo.jpg") | ||
396 | 48 | with open(photo_path, 'a'): | ||
397 | 49 | os.utime(photo_path, None) | ||
398 | 50 | |||
399 | 51 | def select_first_photo(self): | ||
400 | 52 | # select the first photo | ||
401 | 53 | gallery = self.main_window.get_gallery() | ||
402 | 54 | photo = gallery.wait_select_single(objectName="mediaItem0") | ||
403 | 55 | self.pointing_device.move_to_object(photo) | ||
404 | 56 | |||
405 | 57 | # do a long press to enter Multiselection mode | ||
406 | 58 | self.pointing_device.press() | ||
407 | 59 | sleep(1) | ||
408 | 60 | self.pointing_device.release() | ||
409 | 61 | |||
410 | 62 | """Tests swiping to the gallery and pressing the back button""" | ||
414 | 63 | def test_editor_appears(self): | 36 | def test_editor_appears(self): |
415 | 37 | |||
416 | 64 | viewfinder = self.main_window.get_viewfinder() | 38 | viewfinder = self.main_window.get_viewfinder() |
417 | 65 | gallery = self.main_window.get_gallery() | 39 | gallery = self.main_window.get_gallery() |
418 | 66 | 40 | ||
419 | @@ -73,7 +47,15 @@ | |||
420 | 73 | self.pointing_device.move_to_object(opt) | 47 | self.pointing_device.move_to_object(opt) |
421 | 74 | self.pointing_device.click() | 48 | self.pointing_device.click() |
422 | 75 | 49 | ||
424 | 76 | edit = gallery.wait_select_single(objectName="actionButtonEdit") | 50 | # If the editor button is not there when in the gallery view, then |
425 | 51 | # we are not on a system that has the UI extras package installed or has | ||
426 | 52 | # an older version than the one we need. Skip the test in this case. | ||
427 | 53 | try: | ||
428 | 54 | edit = gallery.wait_select_single(objectName="actionButtonEdit") | ||
429 | 55 | except: | ||
430 | 56 | return | ||
431 | 57 | |||
432 | 58 | self.assertThat(edit.enabled, Eventually(Equals(True))) | ||
433 | 77 | self.pointing_device.move_to_object(edit) | 59 | self.pointing_device.move_to_object(edit) |
434 | 78 | self.pointing_device.click() | 60 | self.pointing_device.click() |
435 | 79 | 61 | ||
436 | @@ -98,3 +80,43 @@ | |||
437 | 98 | except StateNotFoundError: | 80 | except StateNotFoundError: |
438 | 99 | disappeared = True | 81 | disappeared = True |
439 | 100 | self.assertThat(disappeared, Equals(True)) | 82 | self.assertThat(disappeared, Equals(True)) |
440 | 83 | |||
441 | 84 | class TestCameraPhotoEditorWithVideo(CameraAppTestCase): | ||
442 | 85 | """Tests photo editor when a video is present""" | ||
443 | 86 | |||
444 | 87 | def setUp(self): | ||
445 | 88 | self.delete_all_media() | ||
446 | 89 | self.add_sample_video() | ||
447 | 90 | |||
448 | 91 | super(TestCameraPhotoEditorWithVideo, self).setUp() | ||
449 | 92 | self.assertThat( | ||
450 | 93 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
451 | 94 | |||
452 | 95 | def tearDown(self): | ||
453 | 96 | super(TestCameraPhotoEditorWithVideo, self).tearDown() | ||
454 | 97 | |||
455 | 98 | """Tests editor not being available for videos""" | ||
456 | 99 | def test_editor_not_on_videos(self): | ||
457 | 100 | self.add_sample_video() | ||
458 | 101 | |||
459 | 102 | viewfinder = self.main_window.get_viewfinder() | ||
460 | 103 | gallery = self.main_window.get_gallery() | ||
461 | 104 | |||
462 | 105 | self.main_window.swipe_to_gallery(self) | ||
463 | 106 | |||
464 | 107 | self.assertThat(gallery.inView, Eventually(Equals(True))) | ||
465 | 108 | |||
466 | 109 | # open actions drawer | ||
467 | 110 | opt = gallery.wait_select_single(objectName="additionalActionsButton") | ||
468 | 111 | self.pointing_device.move_to_object(opt) | ||
469 | 112 | self.pointing_device.click() | ||
470 | 113 | |||
471 | 114 | # If the editor button is not there when in the gallery view, then | ||
472 | 115 | # we are not on a system that has the UI extras package installed or has | ||
473 | 116 | # an older version than the one we need. Skip the test in this case. | ||
474 | 117 | try: | ||
475 | 118 | edit = gallery.wait_select_single(objectName="actionButtonEdit") | ||
476 | 119 | except: | ||
477 | 120 | return | ||
478 | 121 | |||
479 | 122 | self.assertThat(edit.enabled, Equals(False)) |
FAILED: Continuous integration, rev:526 /code.launchpad .net/~phablet- team/camera- app/refactor- and-fix- editor- tests/+ merge/250931/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ camera- app-ci/ 395/ jenkins. qa.ubuntu. com/job/ camera- app-vivid- amd64-ci/ 91/console jenkins. qa.ubuntu. com/job/ camera- app-vivid- armhf-ci/ 91/console jenkins. qa.ubuntu. com/job/ camera- app-vivid- i386-ci/ 91/console jenkins. qa.ubuntu. com/job/ generic- click-autopilot -vivid- touch/162 jenkins. qa.ubuntu. com/job/ generic- mediumtests- vivid/647/ console jenkins. qa.ubuntu. com/job/ generic- click-autopilot -runner- mako/796 jenkins. qa.ubuntu. com/job/ generic- click-builder- vivid-armhf/ 372 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 18337 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-amd64/ 761/console
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/camera- app-ci/ 395/rebuild
http://