Merge lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules into lp:~tpeeters/ubuntu-ui-toolkit/closeActionsPopover

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules
Merge into: lp:~tpeeters/ubuntu-ui-toolkit/closeActionsPopover
Diff against target: 332 lines (+196/-89)
4 files modified
tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py (+24/-0)
tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml (+64/-0)
tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py (+48/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+60/-89)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules
Reviewer Review Type Date Requested Status
Tim Peeters Needs Resubmitting
Review via email: mp+222703@code.launchpad.net

This proposal has been superseded by a proposal from 2014-06-13.

Commit message

Moved the regression test to the components module.

To post a comment you must log in.
Revision history for this message
Tim Peeters (tpeeters) wrote :

the branch to merge this into already went into our staging. Please resubmit

review: Needs Resubmitting
1102. By Leo Arias

Merged with staging.

Unmerged revisions

1102. By Leo Arias

Merged with staging.

1101. By Leo Arias

Fixed flake.

1100. By Leo Arias

Moved the regression test to the components module.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'tests/autopilot/ubuntuuitoolkit/tests/components'
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py'
--- tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py 2014-06-10 17:58:34 +0000
@@ -0,0 +1,24 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
3# Copyright (C) 2014 Canonical Ltd.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; version 3.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17"""Tests for the Ubuntu UI Toolkit components."""
18
19
20# Note that the feedback loop that you get from testing QML components with
21# Autopilot is bigger than what you would get by doing it with QtTest.
22# So, the QML components need to be tested first in isolation at a lower level
23# with QtTest, leaving Autopilot to test complex user interactions or user
24# stories.
025
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml 2014-06-10 17:58:34 +0000
@@ -0,0 +1,64 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
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
17import QtQuick 2.0
18import Ubuntu.Components 1.1
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23
24 useDeprecatedToolbar: false
25
26 PageStack {
27 id: stack
28 Component.onCompleted: stack.push(page)
29
30 Page {
31 title: "Test title"
32 id: page
33
34 tools: ToolbarItems {
35
36 Repeater {
37 id: buttonRepeater
38 model: 5
39 ToolbarButton {
40 action: Action {
41 objectName: "action" + index
42 text: "text " + index
43 iconName: "add"
44 }
45 }
46 }
47
48 ToolbarButton {
49 action: Action {
50 objectName: "pushStackAction"
51 text: "Push page"
52 iconName: "add"
53 onTriggered: stack.push(pushMe)
54 }
55 }
56 }
57 }
58
59 Page {
60 title: "Pushed page"
61 id: pushMe
62 }
63 }
64}
065
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py'
--- tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 2014-06-10 17:58:34 +0000
@@ -0,0 +1,48 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
3# Copyright (C) 2014 Canonical Ltd.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; version 3.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17"""Tests for the Ubuntu UI Toolkit Header component."""
18
19import os
20
21from autopilot.matchers import Eventually
22from testtools.matchers import Equals
23
24from ubuntuuitoolkit import tests
25
26
27class HeaderTestCase(tests.QMLFileAppTestCase):
28
29 path = os.path.abspath(__file__)
30 dir_path = os.path.dirname(path)
31 test_qml_file_path = os.path.join(
32 dir_path, 'test_header.HeaderTestCase.qml')
33
34 def setUp(self):
35 super(HeaderTestCase, self).setUp()
36 self.header = self.main_view.get_header()
37
38 def test_click_header_overflow_action_must_close_popover(self):
39 """Test that clicking an action from the popover must close it.
40
41 Regression test for http://pad.lv/1326963
42
43 """
44 overflow_popover = self.main_view.select_single(
45 'Popover',
46 objectName='actions_overflow_popover')
47 self.header.click_action_button('pushStackAction')
48 self.assertThat(overflow_popover.visible, Eventually(Equals(False)))
049
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-05 21:21:44 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-10 17:58:34 +0000
@@ -18,8 +18,6 @@
1818
19import ubuntuuitoolkit19import ubuntuuitoolkit
20from ubuntuuitoolkit import tests20from ubuntuuitoolkit import tests
21from testtools.matchers import Equals
22from autopilot.matchers import Eventually
2321
2422
25class HeaderTestCase(tests.QMLStringAppTestCase):23class HeaderTestCase(tests.QMLStringAppTestCase):
@@ -34,93 +32,73 @@
3432
35 useDeprecatedToolbar: false33 useDeprecatedToolbar: false
3634
37 PageStack {35 Page {
38 id: stack36 title: "Test title"
39 Component.onCompleted: stack.push(page)37
4038 Flickable {
41 Page {39 anchors.fill: parent
42 title: "Test title"40 contentHeight: units.gu(120)
43 id: page41 objectName: "header_test_flickable"
4442
45 Flickable {43 Label {
46 anchors.fill: parent44 id: label
47 contentHeight: units.gu(120)45 objectName: "clicked_label"
48 objectName: "header_test_flickable"46 anchors {
4947 top: parent.top
50 Label {48 horizontalCenter: parent.horizontalCenter
51 id: label49 }
52 objectName: "clicked_label"50 text: "No button clicked."
53 anchors {51 }
54 top: parent.top52
55 horizontalCenter: parent.horizontalCenter53 Button {
56 }54 objectName: "hide_actions_button"
57 text: "No button clicked."55 anchors {
58 }56 top: label.bottom
5957 topMargin: units.gu(5)
60 Button {58 horizontalCenter: parent.horizontalCenter
61 objectName: "hide_actions_button"59 }
62 anchors {60 text: "Hide some actions"
63 top: label.bottom61 onClicked: {
64 topMargin: units.gu(5)62 cancelAction.visible = false;
65 horizontalCenter: parent.horizontalCenter63 for (var i=0; i < 3; i++) {
66 }64 buttonRepeater.itemAt(i).action.visible = false;
67 text: "Hide some actions"65 }
68 onClicked: {66 // only three of five visible actions left
69 cancelAction.visible = false;67 }
70 for (var i=0; i < 3; i++) {68 }
71 buttonRepeater.itemAt(i).action.visible = false;69 Label {
72 }70 id: endLabel
73 // only three of five visible actions left71 objectName: "end_label"
74 }72 anchors {
75 }73 bottom: parent.bottom
76 Label {74 horizontalCenter: parent.horizontalCenter
77 id: endLabel75 }
78 objectName: "end_label"76 text: "The end."
79 anchors {77 }
80 bottom: parent.bottom78 }
81 horizontalCenter: parent.horizontalCenter79
82 }80 tools: ToolbarItems {
83 text: "The end."81 back: ToolbarButton {
84 }82 action: Action {
85 }83 id: cancelAction
8684 iconName: "cancel"
87 tools: ToolbarItems {85 text: "cancel"
88 back: ToolbarButton {86 onTriggered: label.text = "Cancel button clicked."
89 action: Action {87 }
90 id: cancelAction88 }
91 iconName: "cancel"89 Repeater {
92 text: "cancel"90 id: buttonRepeater
93 onTriggered: label.text = "Cancel button clicked."91 model: 5
94 }
95 }
96 Repeater {
97 id: buttonRepeater
98 model: 5
99 ToolbarButton {
100 action: Action {
101 objectName: "action" + index
102 text: "text " + index
103 iconName: "add"
104 onTriggered: {
105 label.text = "Button "+index+" clicked.";
106 }
107 }
108 }
109 }
110 ToolbarButton {92 ToolbarButton {
111 action: Action {93 action: Action {
112 objectName: "pushStackAction"94 objectName: "action" + index
113 text: "Push page"95 text: "text " + index
114 iconName: "add"96 iconName: "add"
115 onTriggered: stack.push(pushMe)97 onTriggered: label.text = "Button "+index+" clicked."
116 }98 }
117 }99 }
118 }100 }
119 }101 }
120 Page {
121 title: "Pushed page"
122 id: pushMe
123 }
124 }102 }
125}103}
126""")104""")
@@ -147,13 +125,6 @@
147 self.header.click_action_button('action3')125 self.header.click_action_button('action3')
148 self.assertEqual(self.label.text, 'Button 3 clicked.')126 self.assertEqual(self.label.text, 'Button 3 clicked.')
149127
150 def test_click_header_overflow_action_closes_popover_bug1326963(self):
151 overflow_popover = self.main_view.select_single(
152 'Popover',
153 objectName='actions_overflow_popover')
154 self.header.click_action_button('pushStackAction')
155 self.assertThat(overflow_popover.visible, Eventually(Equals(False)))
156
157 def test_click_unexisting_header_action_button(self):128 def test_click_unexisting_header_action_button(self):
158 error = self.assertRaises(129 error = self.assertRaises(
159 ubuntuuitoolkit.ToolkitException, self.header.click_action_button,130 ubuntuuitoolkit.ToolkitException, self.header.click_action_button,

Subscribers

People subscribed via source and target branches

to all changes: