Merge lp:~veebers/stock-ticker-mobile-app/porting-autopilot-1.4 into lp:stock-ticker-mobile-app

Proposed by Christopher Lee on 2013-11-03
Status: Merged
Merged at revision: 68
Proposed branch: lp:~veebers/stock-ticker-mobile-app/porting-autopilot-1.4
Merge into: lp:stock-ticker-mobile-app
Prerequisite: lp:~veebers/stock-ticker-mobile-app/update-tests
Diff against target: 210 lines (+59/-40)
4 files modified
Current_charts_page.qml (+1/-0)
tests/autopilot/stock_ticker/tests/__init__.py (+1/-1)
tests/autopilot/stock_ticker/tests/test_Management_page.py (+17/-12)
tests/autopilot/stock_ticker/tests/test_Subtabs.py (+40/-27)
To merge this branch: bzr merge lp:~veebers/stock-ticker-mobile-app/porting-autopilot-1.4
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing on 2013-11-03
Robert Steckroth 2013-11-03 Approve on 2013-11-03
Review via email: mp+193718@code.launchpad.net

This proposal supersedes a proposal from 2013-11-01.

Description of the change

Updating tests so that they pass using autopilot 1.4.

To post a comment you must log in.
Robert Steckroth (robertsteckroth) wrote :

It works good. Two tests failed but..

Robert Steckroth (robertsteckroth) wrote :

A god start to next verison

review: Approve
Robert Steckroth (robertsteckroth) wrote :

A good start to next verison

review: Approve

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~veebers/stock-ticker-mobile-app/porting-autopilot-1.4/+merge/193718/+edit-commit-message

review: Needs Fixing (continuous-integration)
Chris Gagnon (chris.gagnon) wrote :

I can't get the tests or the application to work at all, I see this in the logs when I try to open the app with qmlscene

[com.ubuntu.stock-ticker-mobile] Error loading http://www.surgemcgee.com:8080/?s=&a=7&b=27&c=2013&d=10&e=4&f=2013 : Socket operation timed out
[com.ubuntu.stock-ticker-mobile] Error loading http://www.surgemcgee.com:8080/?f=sabl1vpghojkc8dre7j1n&s=http://www.surgemcgee.com:8080/?f=sabl1vpghojkc8dre7j1n&s=+yhoo : Socket operation timed out

Chris Gagnon (chris.gagnon) wrote :

The network calls should be mocked so the test can be run without the internet if possible.

Chris Gagnon (chris.gagnon) wrote :

What happens if the target_row doesn't find an object? we should have an error message here so it's easy to diagnose the target_row is not found, and not the remove_button is not found.

43 + try:
44 + o.select_single(
45 + 'QQuickText',
46 + objectName='companyNameText',
47 + text="Google Inc."
48 + )
49 + target_row = o
50 + break
51 + except StateNotFoundError:
52 + pass
53 +
54 + remove_button = target_row.select_single(

Robert Steckroth (robertsteckroth) wrote :

Well, google should be in the top ten of the auto-complete list when a g is
typed into the search box. Occasionally this will not happen correctly.
Adding a o to the string will help --> press "go" to find google.
Maybe a 15 second timeout would help thisl, or perhaps a sleep statement
can knock this out. I thought that the sleep command was a little sloppy,
but...

On Mon, Nov 4, 2013 at 10:22 AM, Chris Gagnon <email address hidden>wrote:

> What happens if the target_row doesn't find an object? we should have an
> error message here so it's easy to diagnose the target_row is not found,
> and not the remove_button is not found.
>
>
> 43 + try:
> 44 + o.select_single(
> 45 + 'QQuickText',
> 46 + objectName='companyNameText',
> 47 + text="Google Inc."
> 48 + )
> 49 + target_row = o
> 50 + break
> 51 + except StateNotFoundError:
> 52 + pass
> 53 +
> 54 + remove_button = target_row.select_single(
> --
>
> https://code.launchpad.net/~veebers/stock-ticker-mobile-app/porting-autopilot-1.4/+merge/193718
> You are reviewing the proposed merge of
> lp:~veebers/stock-ticker-mobile-app/porting-autopilot-1.4 into
> lp:stock-ticker-mobile-app.
>

--
<surgemcgee> Systems/Software Engineer

Robert Steckroth (robertsteckroth) wrote :

Also, I plan on jumping back into this project sooner than later, but I
have a proprietary project which is in it's prime right now.

On Mon, Nov 4, 2013 at 12:55 PM, Robert Steckroth <<email address hidden>
> wrote:

> Well, google should be in the top ten of the auto-complete list when a g
> is typed into the search box. Occasionally this will not happen correctly.
> Adding a o to the string will help --> press "go" to find google.
> Maybe a 15 second timeout would help thisl, or perhaps a sleep statement
> can knock this out. I thought that the sleep command was a little sloppy,
> but...
>
>
> On Mon, Nov 4, 2013 at 10:22 AM, Chris Gagnon <email address hidden>wrote:
>
>> What happens if the target_row doesn't find an object? we should have an
>> error message here so it's easy to diagnose the target_row is not found,
>> and not the remove_button is not found.
>>
>>
>> 43 + try:
>> 44 + o.select_single(
>> 45 + 'QQuickText',
>> 46 + objectName='companyNameText',
>> 47 + text="Google Inc."
>> 48 + )
>> 49 + target_row = o
>> 50 + break
>> 51 + except StateNotFoundError:
>> 52 + pass
>> 53 +
>> 54 + remove_button = target_row.select_single(
>> --
>>
>> https://code.launchpad.net/~veebers/stock-ticker-mobile-app/porting-autopilot-1.4/+merge/193718
>> You are reviewing the proposed merge of
>> lp:~veebers/stock-ticker-mobile-app/porting-autopilot-1.4 into
>> lp:stock-ticker-mobile-app.
>>
>
>
>
> --
> <surgemcgee> Systems/Software Engineer
>
>
>
>

--
<surgemcgee> Systems/Software Engineer

73. By Christopher Lee on 2013-11-08

Fix typo

Christopher Lee (veebers) wrote :

Hi Robert, I getting a test failure (stock_ticker.tests.test_Subtabs.TestSubtabs.test_chart_subtab) that I'm not sure how to solve. I'm wondering if you could lend me your knowledge and help me out?

The error message:
tests/autopilot/stock_ticker/tests/test_Subtabs.py", line 90, in test_chart_subtab
    self.assertThat(chart_dot.x, NotEquals(dot_x))
  File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 417, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
MismatchError: 300.0 == 300.0

I'm not certain what it (or the chart) is supposed to do in this situation so I can't offer a fix in the test or in the application itself either.

Also note that I've started a WIP MR for mocking-out the server: https://code.launchpad.net/~veebers/stock-ticker-mobile-app/mock-server-for-testing/+merge/194971

Robert Steckroth (robertsteckroth) wrote :

Ya sure, I am looking into it now.

On Tue, Nov 12, 2013 at 9:27 PM, Christopher Lee <email address hidden>wrote:

> Hi Robert, I getting a test failure
> (stock_ticker.tests.test_Subtabs.TestSubtabs.test_chart_subtab) that I'm
> not sure how to solve. I'm wondering if you could lend me your knowledge
> and help me out?
>
> The error message:
> tests/autopilot/stock_ticker/tests/test_Subtabs.py", line 90, in
> test_chart_subtab
> self.assertThat(chart_dot.x, NotEquals(dot_x))
> File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 417,
> in assertThat
> raise MismatchError(matchee, matcher, mismatch, verbose)
> MismatchError: 300.0 == 300.0
>
> I'm not certain what it (or the chart) is supposed to do in this situation
> so I can't offer a fix in the test or in the application itself either.
>
>
> Also note that I've started a WIP MR for mocking-out the server:
> https://code.launchpad.net/~veebers/stock-ticker-mobile-app/mock-server-for-testing/+merge/194971
> --
>
> https://code.launchpad.net/~veebers/stock-ticker-mobile-app/porting-autopilot-1.4/+merge/193718
> You are reviewing the proposed merge of
> lp:~veebers/stock-ticker-mobile-app/porting-autopilot-1.4 into
> lp:stock-ticker-mobile-app.
>

--
<surgemcgee> Systems/Software Engineer

Robert Steckroth (robertsteckroth) wrote :

Ok, I have looked into it but so not have the time to make the changes. Here is what you need to do.
* Remove all of the domain re-naming code from the application. This can be altered in the autopilot tests instead.
* Create a yahoo data stream for the front page. The application defaults to yahoo which is needed to run the tests.
* The chart.dot need to have an active stock to work. This will be fixed when yahoo is added as above^
* line: 52 in the Current_charts_page needs to be altered to this --> "onValueChanged: chart_day_range = value". I recommend puling from the stable branch until I find the time to fully integrate Indurate into the app.

Good python work by the way :)

Christopher Lee (veebers) wrote :

Hi Robert, thanks :-) Thanks for taking the time to look at that issue.

I'm not the most intimate with this applications codebase so will need to look into what your comments entail.
In the meantime could you take a look at the mock server MR and make any suggestions you have on that? I get the feeling that some of your above comments can be introduced into that MR or perhaps after that code has landed?

Robert Steckroth (robertsteckroth) wrote :

Ya, I did, the code looks good. I like the use of @property as a getter looping mechanism for the port (very clever).
I should be able to get a few extra days off work here shortly and polish up some things.

Christopher Lee (veebers) wrote :

Hi Robert,

I've let these MR's get stale (this one and
https://code.launchpad.net/~veebers/stock-ticker-mobile-app/mock-server-for-testing/+merge/194971).

At this stage I feel that _this_ branch is suitable to merge as it fixes all but
one test failure. I'll need your assistance, or ask you to take it on, to fix
the remaining as I don't have the familiarity of the application and
requirements to do so in any timely fashion.

WRT the second MR, the mock server, as mentioned previously I have this working
for me but a colleague is seeing failures. Again, I'm not familiar enough with
this application and it's data consumption use to efficiently solve this problem
so I'll ask that you can take this on and I can assist you in getting it
completed.

I'm hoping that we can get some movement on this in the near future.

Chris.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Current_charts_page.qml'
2--- Current_charts_page.qml 2013-09-04 01:51:45 +0000
3+++ Current_charts_page.qml 2013-11-08 03:33:30 +0000
4@@ -20,6 +20,7 @@
5 import "javascript/graph.js" as Graph
6
7 Rectangle {
8+ objectName: "chartDetails"
9 property var canvas_object
10 onVisibleChanged: visible && displayDayInfo()
11 // color: "#FCFCFC"
12
13=== modified file 'tests/autopilot/stock_ticker/tests/__init__.py'
14--- tests/autopilot/stock_ticker/tests/__init__.py 2013-11-08 03:33:30 +0000
15+++ tests/autopilot/stock_ticker/tests/__init__.py 2013-11-08 03:33:30 +0000
16@@ -41,7 +41,7 @@
17 scenarios = [('with touch', dict(input_device_class=Touch))]
18
19 local_location = "../../Stock_Ticker.qml"
20- installed_location = "/usr/share/stock-ticker-mobile-app/Stock_Tickers.qml"
21+ installed_location = "/usr/share/stock-ticker-mobile-app/Stock_Ticker.qml"
22 sqlite_dir = os.path.expanduser(
23 "~/.local/share/com.ubuntu.stock-ticker-mobile/Databases")
24 backup_dir = sqlite_dir + ".backup"
25
26=== modified file 'tests/autopilot/stock_ticker/tests/test_Management_page.py'
27--- tests/autopilot/stock_ticker/tests/test_Management_page.py 2013-10-10 18:51:45 +0000
28+++ tests/autopilot/stock_ticker/tests/test_Management_page.py 2013-11-08 03:33:30 +0000
29@@ -23,6 +23,7 @@
30 from __future__ import absolute_import
31
32 from testtools.matchers import Equals
33+from autopilot.introspection.dbus import StateNotFoundError
34 from autopilot.matchers import Eventually
35 from stock_ticker.tests import StockTickerTestCase
36
37@@ -95,19 +96,23 @@
38 management_delegate = \
39 management_listview.get_children()[0].get_children()
40
41- cmpy_index = -1
42+ # Find the newly added row and list item.
43+ target_row = None
44 for o in management_delegate:
45- add_list_item = o.select_single(
46- 'QQuickText', objectName='companyNameText')
47- cmpy_index += 1
48- if add_list_item and hasattr(add_list_item, 'text'):
49- if add_list_item.text == 'Google Inc.':
50- break
51-
52- self.assertThat(add_list_item.text, Eventually(Equals('Google Inc.')))
53-
54- remove_button = management_delegate[cmpy_index].select_single(
55- 'QQuickItem', objectName='removeButton')
56+ try:
57+ o.select_single(
58+ 'QQuickText',
59+ objectName='companyNameText',
60+ text="Google Inc."
61+ )
62+ target_row = o
63+ break
64+ except StateNotFoundError:
65+ pass
66+
67+ remove_button = target_row.select_single(
68+ 'QQuickItem',
69+ objectName='removeButton')
70 self.pointing_device.click_object(remove_button)
71
72 self.assertThat(management_listview.count,
73
74=== modified file 'tests/autopilot/stock_ticker/tests/test_Subtabs.py'
75--- tests/autopilot/stock_ticker/tests/test_Subtabs.py 2013-11-08 03:33:30 +0000
76+++ tests/autopilot/stock_ticker/tests/test_Subtabs.py 2013-11-08 03:33:30 +0000
77@@ -54,32 +54,38 @@
78 details_button = sub_bar.select_single(
79 'UbuntuShape', objectName='detailsTab')
80
81- subtab_pages = self.app.select_single(
82- 'QQuickItem', objectName='currentRectSizer').get_children()
83+ tabs_container = self.app.select_single(
84+ 'QQuickItem', objectName='currentRectSizer')
85+ chart_details = tabs_container.select_single(
86+ "Current",
87+ objectName="chartDetails")
88+ details_listview = tabs_container.select_single(
89+ "QQuickListView",
90+ objectName="detailsListView")
91
92 # Ensure toolbar is hidden so we can interact with buttons
93 self.main_view.close_toolbar()
94
95 self.pointing_device.click_object(details_button)
96- self.assertThat(subtab_pages[2].visible, Eventually(Equals(True)))
97+ self.assertThat(details_listview.visible, Eventually(Equals(True)))
98
99 self.pointing_device.click_object(charts_button)
100
101- self.assertThat(subtab_pages[2].visible, Eventually(Equals(False)))
102- self.assertThat(subtab_pages[1].visible, Eventually(Equals(True)))
103+ self.assertThat(details_listview.visible, Eventually(Equals(False)))
104+ self.assertThat(chart_details.visible, Eventually(Equals(True)))
105
106 chart_dot = self.app.select_single(
107 'QQuickImage', objectName='chartDot')
108 chart_info = self.app.select_single(
109 'QQuickText', objectName='dayInfoText')
110
111- self.pointing_device.click_object(subtab_pages[1])
112+ self.pointing_device.click_object(chart_details)
113
114 dot_x = chart_dot.x
115 info_text = chart_info.text
116
117 self.main_view.move_subtabs_bar_up()
118- self.main_view.flick_page_right(subtab_pages[1])
119+ self.main_view.flick_page_right(chart_details)
120
121 self.assertThat(chart_dot.x, NotEquals(dot_x))
122 self.assertThat(chart_info.text, NotEquals(info_text))
123@@ -106,22 +112,25 @@
124 details_button = sub_bar.select_single(
125 'UbuntuShape', objectName='detailsTab')
126
127- subtab_pages = self.app.select_single(
128- 'QQuickItem', objectName='currentRectSizer').get_children()
129+ tabs_container = self.app.select_single(
130+ 'QQuickItem', objectName='currentRectSizer')
131+ news_listview = tabs_container.select_single(
132+ "QQuickListView",
133+ objectName="newsListView")
134+ details_listview = tabs_container.select_single(
135+ "QQuickListView",
136+ objectName="detailsListView")
137
138 # Ensure toolbar is hidden so we can interact with buttons
139 self.main_view.close_toolbar()
140
141 self.pointing_device.click_object(news_button)
142- self.assertThat(subtab_pages[3].visible, Eventually(Equals(True)))
143+ self.assertThat(news_listview.visible, Eventually(Equals(True)))
144
145 self.pointing_device.click_object(details_button)
146
147- self.assertThat(subtab_pages[3].visible, Eventually(Equals(False)))
148- self.assertThat(subtab_pages[2].visible, Eventually(Equals(True)))
149-
150- details_listview = self.app.select_single(
151- 'QQuickListView', objectName='detailsListView')
152+ self.assertThat(news_listview.visible, Eventually(Equals(False)))
153+ self.assertThat(details_button.visible, Eventually(Equals(True)))
154
155 contentY = details_listview.contentY
156
157@@ -129,7 +138,7 @@
158 Eventually(Equals(details_listview.contentY)))
159
160 self.main_view.move_subtabs_bar_up()
161- self.main_view.hold_page_down(subtab_pages[2])
162+ self.main_view.hold_page_down(details_listview)
163
164 self.assertThat(details_listview.contentY,
165 Eventually(NotEquals(contentY)))
166@@ -157,29 +166,33 @@
167 details_button = sub_bar.select_single(
168 'UbuntuShape', objectName='detailsTab')
169
170- subtab_pages = self.app.select_single(
171- 'QQuickItem', objectName='currentRectSizer').get_children()
172-
173- # Ensure toolbar is hidden so we can interact with buttons
174+ tabs_container = self.app.select_single(
175+ 'QQuickItem',
176+ objectName='currentRectSizer')
177+
178+ news_listview = tabs_container.select_single(
179+ "QQuickListView",
180+ objectName="newsListView")
181+ details_listview = tabs_container.select_single(
182+ "QQuickListView",
183+ objectName="detailsListView")
184+
185 self.main_view.close_toolbar()
186
187 self.pointing_device.click_object(details_button)
188- self.assertThat(subtab_pages[2].visible, Eventually(Equals(True)))
189+ self.assertThat(details_listview.visible, Eventually(Equals(True)))
190
191 self.pointing_device.click_object(news_button)
192
193- self.assertThat(subtab_pages[2].visible, Eventually(Equals(False)))
194- self.assertThat(subtab_pages[3].visible, Eventually(Equals(True)))
195-
196- news_listview = self.app.select_single(
197- 'QQuickListView', objectName='newsListView')
198+ self.assertThat(details_listview.visible, Eventually(Equals(False)))
199+ self.assertThat(news_listview.visible, Eventually(Equals(True)))
200
201 contentY = news_listview.contentY
202
203 self.assertThat(news_listview.contentY, Eventually(Equals(contentY)))
204
205 self.main_view.move_subtabs_bar_up()
206- self.main_view.hold_page_down(subtab_pages[3])
207+ self.main_view.hold_page_down(news_listview)
208
209 self.assertThat(news_listview.contentY,
210 Eventually(NotEquals(contentY)))

Subscribers

People subscribed via source and target branches