Merge lp:~elopio/ubuntu-ui-toolkit/clean_gallery_tests1 into lp:ubuntu-ui-toolkit/staging

Proposed by Leo Arias
Status: Merged
Approved by: Cris Dywan
Approved revision: 1063
Merged at revision: 1074
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/clean_gallery_tests1
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~elopio/ubuntu-ui-toolkit/swipe_into_view
Diff against target: 143 lines (+47/-80)
1 file modified
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py (+47/-80)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/clean_gallery_tests1
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Chris Gagnon (community) Approve
Review via email: mp+219792@code.launchpad.net

Commit message

Rewrite OptionSelector tests using new helpers.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1060
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/238/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/272
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/247
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/70
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/70
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/70/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/70
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/759
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/552
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/552/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7256
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/223
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/311
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/311/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/238/rebuild

review: Needs Fixing (continuous-integration)
1061. By Leo Arias

Merged with staging.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1061
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/264/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/392
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/338
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/96
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/96
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/96/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/96
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/863
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/767
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/767/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7479
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/301
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/438
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/438/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/264/rebuild

review: Needs Fixing (continuous-integration)
1062. By Leo Arias

Merged with staging.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1062
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/270/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/422
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/373
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/102
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/102
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/102/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/102
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/882
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/832
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/832/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7544
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/326
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/493
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/493/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/270/rebuild

review: Approve (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

LGTM

review: Approve
Revision history for this message
Cris Dywan (kalikiana) wrote :

+ def test_select_option_from_exptanded_optionselector(self):

Typo, should say "expanded"

Maybe more explicitly say something like "Rewrite OptionSelector tests using new helpers", clean up is going to be rather meaningless in the commit log.

Looks good otherwise.

review: Needs Fixing
1063. By Leo Arias

Fixed typo.

Revision history for this message
Leo Arias (elopio) wrote :

Fixed, thanks!

Revision history for this message
Cris Dywan (kalikiana) wrote :

Thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1063
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/274/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/433
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/388
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/106
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/106
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/106/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/106
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/894
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/858
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/858/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7577
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/340
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/516
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/516/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/274/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py'
2--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2013-11-08 09:19:02 +0000
3+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-05-23 09:50:56 +0000
4@@ -1,6 +1,6 @@
5 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6 #
7-# Copyright (C) 2012, 2013 Canonical Ltd.
8+# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU Lesser General Public License as published by
12@@ -14,85 +14,52 @@
13 # You should have received a copy of the GNU Lesser General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16-"""Tests for the Ubuntu UI Toolkit Gallery - OptionSelector component"""
17-import time
18-from autopilot.matchers import Eventually
19-from testtools.matchers import Equals
20-from ubuntuuitoolkit.tests import FlickDirection
21+"""Tests for the Ubuntu UI Toolkit Gallery - OptionSelector component."""
22+
23+import ubuntuuitoolkit
24 from ubuntuuitoolkit.tests.gallery import GalleryTestCase
25
26
27-class OptionSelectorTests(GalleryTestCase):
28- """Generic tests for the Gallery"""
29-
30- def test_optionselector_collapsed(self):
31- item = "Option Selector"
32- self.loadItem(item)
33- self.checkPageHeader(item)
34- collapsed = self.getObject("optionselector_collapsed")
35- styleditem = collapsed.select_single('StyledItem',
36- objectName='listContainer')
37-
38- self.assertThat(collapsed.selectedIndex, Equals(0))
39- self.pointing_device.click_object(collapsed)
40- self.assertThat(styleditem.currentlyExpanded, Eventually(Equals(True)))
41- #try to search the following list entry few times
42- #as it may not be available immediately.
43- for t in range(0, 9):
44- try:
45- selectedValue = collapsed.select_single('Label',
46- text='Value 4')
47- self.assertIsNotNone(selectedValue)
48- except:
49- time.sleep(1)
50-
51- self.pointing_device.click_object(selectedValue)
52- self.assertThat(collapsed.selectedIndex, Eventually(Equals(3)))
53- self.assertThat(styleditem.currentlyExpanded,
54- Eventually(Equals(False)))
55-
56- def test_optionselector_expanded(self):
57- item = "Option Selector"
58- self.loadItem(item)
59- self.checkPageHeader(item)
60- expanded = self.getObject("optionselector_expanded")
61-
62- self.assertThat(expanded.selectedIndex, Equals(0))
63- selectedValue = expanded.select_single('Label', text='Value 4')
64- self.assertIsNotNone(selectedValue)
65- self.pointing_device.click_object(selectedValue)
66- self.assertThat(expanded.selectedIndex, Eventually(Equals(3)))
67-
68- selectedValue = expanded.select_single('Label', text='Value 1')
69- self.assertIsNotNone(selectedValue)
70- self.pointing_device.click_object(selectedValue)
71- self.assertThat(expanded.selectedIndex, Eventually(Equals(0)))
72-
73- def test_optionselector_custommodel(self):
74- item = "Option Selector"
75- self.loadItem(item)
76- self.checkPageHeader(item)
77-
78- custommodel = self.getObject("optionselector_custommodel")
79- flickable = self.main_view.select_single('QQuickFlickable')
80- self.assertIsNotNone(flickable)
81-
82- #Flick upward to reveal the hidden ui element.
83- self.reveal_item_by_flick(custommodel, flickable, FlickDirection.UP)
84- self.assertThat(flickable.flicking, Eventually(Equals(False)))
85-
86- self.assertThat(custommodel.selectedIndex, Equals(0))
87- selectedValue = custommodel.select_single('Label', text='Name 4')
88- self.assertIsNotNone(selectedValue)
89- self.pointing_device.click_object(selectedValue)
90- self.assertThat(custommodel.selectedIndex, Eventually(Equals(3)))
91-
92- selectedValue = custommodel.select_single('Label', text='Name 1')
93- self.assertIsNotNone(selectedValue)
94- self.pointing_device.click_object(selectedValue)
95- self.assertThat(custommodel.selectedIndex, Eventually(Equals(0)))
96-
97- #scroll the page downward now.
98- collapsed = self.getObject("optionselector_collapsed")
99- self.reveal_item_by_flick(collapsed, flickable, FlickDirection.DOWN)
100- self.assertThat(flickable.flicking, Eventually(Equals(False)))
101+class OptionSelectorTestCase(GalleryTestCase):
102+
103+ def setUp(self):
104+ super(OptionSelectorTestCase, self).setUp()
105+ item = "Option Selector"
106+ self.loadItem(item)
107+ self.checkPageHeader(item)
108+
109+ def test_select_option_from_collapsed_optionselector(self):
110+ collapsed_option_selector = self.main_view.select_single(
111+ ubuntuuitoolkit.OptionSelector,
112+ objectName='optionselector_collapsed')
113+
114+ self.assertEqual(
115+ collapsed_option_selector.get_selected_text(), 'Value 1')
116+
117+ collapsed_option_selector.select_option('Label', text='Value 4')
118+ self.assertEqual(collapsed_option_selector.get_selected_index(), 3)
119+
120+ def test_select_option_from_expanded_optionselector(self):
121+ expanded_option_selector = self.main_view.select_single(
122+ ubuntuuitoolkit.OptionSelector,
123+ objectName='optionselector_expanded')
124+
125+ self.assertEqual(
126+ expanded_option_selector.get_selected_text(), 'Value 1')
127+
128+ expanded_option_selector.select_option('Label', text='Value 4')
129+ self.assertEqual(expanded_option_selector.get_selected_index(), 3)
130+
131+ def test_select_option_from_optionselector_with_custom_model(self):
132+ option_selector_with_custom_model = self.main_view.select_single(
133+ ubuntuuitoolkit.OptionSelector,
134+ objectName='optionselector_custommodel')
135+ option_selector_with_custom_model.swipe_into_view()
136+
137+ self.assertEqual(
138+ option_selector_with_custom_model.get_selected_index(), 0)
139+
140+ option_selector_with_custom_model.select_option(
141+ 'Label', text='Name 4')
142+ self.assertEqual(
143+ option_selector_with_custom_model.get_selected_index(), 3)

Subscribers

People subscribed via source and target branches