Merge lp:~elopio/ubuntuone-testing/open-photo into lp:ubuntuone-testing

Proposed by Leo Arias
Status: Merged
Approved by: Leo Arias
Approved revision: 120
Merged at revision: 109
Proposed branch: lp:~elopio/ubuntuone-testing/open-photo
Merge into: lp:ubuntuone-testing
Prerequisite: lp:~elopio/ubuntuone-testing/add-photo
Diff against target: 165 lines (+107/-12)
4 files modified
config-manager.txt (+1/-1)
ubuntuone/web/tests/sst/photos/u1webp107_openphoto.py (+39/-0)
ubuntuone/web/tests/sst/photos/u1webp83_addphoto.py (+2/-7)
ubuntuone/web/tests/sst/shared/actions/photos.py (+65/-4)
To merge this branch: bzr merge lp:~elopio/ubuntuone-testing/open-photo
Reviewer Review Type Date Requested Status
Philip Fibiger (community) Approve
Review via email: mp+115068@code.launchpad.net

Commit message

Added the open photo test.
Updated selenium simple test to use the refresh action.

Description of the change

Added the open photo test.
Updated selenium simple test to use the refresh action.

To post a comment you must log in.
Revision history for this message
Philip Fibiger (pfibiger) :
review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config-manager.txt'
--- config-manager.txt 2012-02-01 22:57:55 +0000
+++ config-manager.txt 2012-07-16 05:58:24 +0000
@@ -4,4 +4,4 @@
4# make clean-sourcedeps update-sourcedeps4# make clean-sourcedeps update-sourcedeps
5#5#
66
7./sourcecode/selenium-simple-test bzr+ssh://bazaar.launchpad.net/~canonical-isd-qa/selenium-simple-test/trunk;revno=2567./sourcecode/selenium-simple-test bzr+ssh://bazaar.launchpad.net/~canonical-isd-qa/selenium-simple-test/trunk;revno=274
88
=== added file 'ubuntuone/web/tests/sst/photos/u1webp107_openphoto.py'
--- ubuntuone/web/tests/sst/photos/u1webp107_openphoto.py 1970-01-01 00:00:00 +0000
+++ ubuntuone/web/tests/sst/photos/u1webp107_openphoto.py 2012-07-16 05:58:24 +0000
@@ -0,0 +1,39 @@
1# -*- coding: utf-8 -*-
2
3# Copyright 2012 Canonical Ltd.
4#
5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published
7# by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from sst.actions import *
18from os import path, remove
19import actions.setup as setup_actions
20import actions.files as files_actions
21import actions.photos as photos_actions
22from utils.randomphotos import make_random_photo_and_return_path
23
24setup_actions.setup(new_user=False)
25random_photo_path = make_random_photo_and_return_path()
26files_actions.open()
27files_actions.upload_file(random_photo_path)
28remove(random_photo_path)
29random_photo_name = path.basename(random_photo_path)
30# XXX refresh because there is a bug in edge server.
31# See https://bugs.launchpad.net/ubuntuone-servers/+bug/1007147
32refresh()
33files_actions.assert_file_exists(random_photo_name)
34photos_actions.open()
35photo_id = photos_actions.get_photo_id(random_photo_name)
36photos_actions.open_photo(random_photo_name)
37photos_actions.assert_photo_name_in_gallery(random_photo_name)
38photos_actions.assert_photo_is_present_in_gallery(photo_id)
39photos_actions.assert_photo_is_present_in_gallery_sidebar(photo_id)
040
=== modified file 'ubuntuone/web/tests/sst/photos/u1webp83_addphoto.py'
--- ubuntuone/web/tests/sst/photos/u1webp83_addphoto.py 2012-07-16 05:58:24 +0000
+++ ubuntuone/web/tests/sst/photos/u1webp83_addphoto.py 2012-07-16 05:58:24 +0000
@@ -20,13 +20,8 @@
20import actions.files as files_actions20import actions.files as files_actions
21import actions.photos as photos_actions21import actions.photos as photos_actions
22from utils.randomphotos import make_random_photo_and_return_path 22from utils.randomphotos import make_random_photo_and_return_path
23import uuid
24import tempfile
25import numpy
26import Image
2723
28setup_actions.setup(new_user=False)24setup_actions.setup(new_user=False)
29
30random_photo_path = make_random_photo_and_return_path()25random_photo_path = make_random_photo_and_return_path()
31files_actions.open()26files_actions.open()
32files_actions.upload_file(random_photo_path)27files_actions.upload_file(random_photo_path)
@@ -34,7 +29,7 @@
34random_photo_name = path.basename(random_photo_path)29random_photo_name = path.basename(random_photo_path)
35# XXX refresh because there is a bug in edge server.30# XXX refresh because there is a bug in edge server.
36# See https://bugs.launchpad.net/ubuntuone-servers/+bug/100714731# See https://bugs.launchpad.net/ubuntuone-servers/+bug/1007147
37files_actions.open()32refresh()
38files_actions.assert_file_exists(random_photo_name)33files_actions.assert_file_exists(random_photo_name)
39photos_actions.open()34photos_actions.open()
40photos_actions.assert_photo_present_in_list(random_photo_name)35photos_actions.assert_photo_is_present_in_list(random_photo_name)
4136
=== modified file 'ubuntuone/web/tests/sst/shared/actions/photos.py'
--- ubuntuone/web/tests/sst/shared/actions/photos.py 2012-07-16 05:58:24 +0000
+++ ubuntuone/web/tests/sst/shared/actions/photos.py 2012-07-16 05:58:24 +0000
@@ -47,14 +47,75 @@
47 assert_text(heading1_element, folder_name)47 assert_text(heading1_element, folder_name)
4848
4949
50def assert_photo_present_in_list(photo_name):50# List view actions.
51# TODO make sure we are viewing the photo list.
52
53def assert_photo_is_present_in_list(photo_name):
54 photo_link = _get_photo_link_in_list(photo_name)
55 assert_displayed(photo_element)
56
57
58def _get_photo_link_in_list(photo_name):
59 return get_element('.photo-list a[data-u1name="%(name)s"]'
60 % {'name': photo_name})
61
62
63def get_photo_id(photo_name):
64 photo_link = _get_photo_link_in_list(photo_name)
65 return photo_link.get_attribute('data-u1nodekey')
66
67
68def open_photo(photo_name):
51 photo_element = _get_photo_element_in_list(photo_name)69 photo_element = _get_photo_element_in_list(photo_name)
52 assert_displayed(photo_element)70 click_element(photo_element)
71 # XXX find a better way to wait for the gallery to load.
72 sleep(10)
5373
5474
55def _get_photo_element_in_list(photo_name):75def _get_photo_element_in_list(photo_name):
56 return get_element('.photo-list img.scaled[data-qa-id="%(name)s"]' 76 photo_link = _get_photo_link_in_list(photo_name)
57 % {'name': photo_name})77 return photo_link.find_element_by_css_selector('img')
78
79
80# Gallery view actions.
81# TODO make sure we are viewing the photo gallery.
82
83def assert_photo_name_in_gallery(photo_name):
84 heading1_element = get_element_by_css('.title h1')
85 assert_text(heading1_element, photo_name)
86
87def assert_photo_is_present_in_gallery(photo_id):
88 photo_element = _get_photo_element_in_gallery(photo_id)
89 assert_displayed(photo_element)
90
91
92def _get_photo_element_in_gallery(photo_id):
93 photo_css_locator = _get_photo_element_css_locator_in_gallery(photo_id)
94 return get_element_by_css(photo_css_locator)
95
96
97def _get_photo_element_css_locator_in_gallery(photo_id):
98 # TODO take into account staging url.
99 photo_source_url_format = 'https://files.one.ubuntu.com/thumbnail/file_storage/{0}/1000x1000'
100 photo_source_url = photo_source_url_format.format(photo_id)
101 return '.photoset .photo > img[src="{0}"]'.format(photo_source_url)
102
103
104def assert_photo_is_present_in_gallery_sidebar(photo_id):
105 photo_element = _get_photo_element_in_gallery_sidebar(photo_id)
106 assert_displayed(photo_element)
107
108
109def _get_photo_element_in_gallery_sidebar(photo_id):
110 photo_css_locator = _get_photo_element_css_locator_in_gallery_sidebar(photo_id)
111 return get_element_by_css(photo_css_locator)
112
113
114def _get_photo_element_css_locator_in_gallery_sidebar(photo_id):
115 # TODO take into account staging url.
116 photo_source_url_format = 'https://files.one.ubuntu.com/thumbnail/file_storage/{0}/108x108/'
117 photo_source_url = photo_source_url_format.format(photo_id)
118 return '.photoset .sidebar img[src="{0}"]'.format(photo_source_url)
58119
59120
60def _get_md5(filename):121def _get_md5(filename):

Subscribers

People subscribed via source and target branches