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

Proposed by Christopher Lee
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
Robert Steckroth Approve
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.
Revision history for this message
Robert Steckroth (robertsteckroth) wrote :

It works good. Two tests failed but..

Revision history for this message
Robert Steckroth (robertsteckroth) wrote :

A god start to next verison

review: Approve
Revision history for this message
Robert Steckroth (robertsteckroth) wrote :

A good start to next verison

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

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)
Revision history for this message
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

Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

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

Revision history for this message
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(

Revision history for this message
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

Revision history for this message
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

Fix typo

Revision history for this message
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

Revision history for this message
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

Revision history for this message
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 :)

Revision history for this message
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?

Revision history for this message
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.

Revision history for this message
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
=== modified file 'Current_charts_page.qml'
--- Current_charts_page.qml 2013-09-04 01:51:45 +0000
+++ Current_charts_page.qml 2013-11-08 03:33:30 +0000
@@ -20,6 +20,7 @@
20import "javascript/graph.js" as Graph20import "javascript/graph.js" as Graph
2121
22Rectangle {22Rectangle {
23 objectName: "chartDetails"
23 property var canvas_object24 property var canvas_object
24 onVisibleChanged: visible && displayDayInfo()25 onVisibleChanged: visible && displayDayInfo()
25 // color: "#FCFCFC"26 // color: "#FCFCFC"
2627
=== modified file 'tests/autopilot/stock_ticker/tests/__init__.py'
--- tests/autopilot/stock_ticker/tests/__init__.py 2013-11-08 03:33:30 +0000
+++ tests/autopilot/stock_ticker/tests/__init__.py 2013-11-08 03:33:30 +0000
@@ -41,7 +41,7 @@
41 scenarios = [('with touch', dict(input_device_class=Touch))]41 scenarios = [('with touch', dict(input_device_class=Touch))]
4242
43 local_location = "../../Stock_Ticker.qml"43 local_location = "../../Stock_Ticker.qml"
44 installed_location = "/usr/share/stock-ticker-mobile-app/Stock_Tickers.qml"44 installed_location = "/usr/share/stock-ticker-mobile-app/Stock_Ticker.qml"
45 sqlite_dir = os.path.expanduser(45 sqlite_dir = os.path.expanduser(
46 "~/.local/share/com.ubuntu.stock-ticker-mobile/Databases")46 "~/.local/share/com.ubuntu.stock-ticker-mobile/Databases")
47 backup_dir = sqlite_dir + ".backup"47 backup_dir = sqlite_dir + ".backup"
4848
=== modified file 'tests/autopilot/stock_ticker/tests/test_Management_page.py'
--- tests/autopilot/stock_ticker/tests/test_Management_page.py 2013-10-10 18:51:45 +0000
+++ tests/autopilot/stock_ticker/tests/test_Management_page.py 2013-11-08 03:33:30 +0000
@@ -23,6 +23,7 @@
23from __future__ import absolute_import23from __future__ import absolute_import
2424
25from testtools.matchers import Equals25from testtools.matchers import Equals
26from autopilot.introspection.dbus import StateNotFoundError
26from autopilot.matchers import Eventually27from autopilot.matchers import Eventually
27from stock_ticker.tests import StockTickerTestCase28from stock_ticker.tests import StockTickerTestCase
2829
@@ -95,19 +96,23 @@
95 management_delegate = \96 management_delegate = \
96 management_listview.get_children()[0].get_children()97 management_listview.get_children()[0].get_children()
9798
98 cmpy_index = -199 # Find the newly added row and list item.
100 target_row = None
99 for o in management_delegate:101 for o in management_delegate:
100 add_list_item = o.select_single(102 try:
101 'QQuickText', objectName='companyNameText')103 o.select_single(
102 cmpy_index += 1104 'QQuickText',
103 if add_list_item and hasattr(add_list_item, 'text'):105 objectName='companyNameText',
104 if add_list_item.text == 'Google Inc.':106 text="Google Inc."
105 break107 )
106108 target_row = o
107 self.assertThat(add_list_item.text, Eventually(Equals('Google Inc.')))109 break
108110 except StateNotFoundError:
109 remove_button = management_delegate[cmpy_index].select_single(111 pass
110 'QQuickItem', objectName='removeButton')112
113 remove_button = target_row.select_single(
114 'QQuickItem',
115 objectName='removeButton')
111 self.pointing_device.click_object(remove_button)116 self.pointing_device.click_object(remove_button)
112117
113 self.assertThat(management_listview.count,118 self.assertThat(management_listview.count,
114119
=== modified file 'tests/autopilot/stock_ticker/tests/test_Subtabs.py'
--- tests/autopilot/stock_ticker/tests/test_Subtabs.py 2013-11-08 03:33:30 +0000
+++ tests/autopilot/stock_ticker/tests/test_Subtabs.py 2013-11-08 03:33:30 +0000
@@ -54,32 +54,38 @@
54 details_button = sub_bar.select_single(54 details_button = sub_bar.select_single(
55 'UbuntuShape', objectName='detailsTab')55 'UbuntuShape', objectName='detailsTab')
5656
57 subtab_pages = self.app.select_single(57 tabs_container = self.app.select_single(
58 'QQuickItem', objectName='currentRectSizer').get_children()58 'QQuickItem', objectName='currentRectSizer')
59 chart_details = tabs_container.select_single(
60 "Current",
61 objectName="chartDetails")
62 details_listview = tabs_container.select_single(
63 "QQuickListView",
64 objectName="detailsListView")
5965
60 # Ensure toolbar is hidden so we can interact with buttons66 # Ensure toolbar is hidden so we can interact with buttons
61 self.main_view.close_toolbar()67 self.main_view.close_toolbar()
6268
63 self.pointing_device.click_object(details_button)69 self.pointing_device.click_object(details_button)
64 self.assertThat(subtab_pages[2].visible, Eventually(Equals(True)))70 self.assertThat(details_listview.visible, Eventually(Equals(True)))
6571
66 self.pointing_device.click_object(charts_button)72 self.pointing_device.click_object(charts_button)
6773
68 self.assertThat(subtab_pages[2].visible, Eventually(Equals(False)))74 self.assertThat(details_listview.visible, Eventually(Equals(False)))
69 self.assertThat(subtab_pages[1].visible, Eventually(Equals(True)))75 self.assertThat(chart_details.visible, Eventually(Equals(True)))
7076
71 chart_dot = self.app.select_single(77 chart_dot = self.app.select_single(
72 'QQuickImage', objectName='chartDot')78 'QQuickImage', objectName='chartDot')
73 chart_info = self.app.select_single(79 chart_info = self.app.select_single(
74 'QQuickText', objectName='dayInfoText')80 'QQuickText', objectName='dayInfoText')
7581
76 self.pointing_device.click_object(subtab_pages[1])82 self.pointing_device.click_object(chart_details)
7783
78 dot_x = chart_dot.x84 dot_x = chart_dot.x
79 info_text = chart_info.text85 info_text = chart_info.text
8086
81 self.main_view.move_subtabs_bar_up()87 self.main_view.move_subtabs_bar_up()
82 self.main_view.flick_page_right(subtab_pages[1])88 self.main_view.flick_page_right(chart_details)
8389
84 self.assertThat(chart_dot.x, NotEquals(dot_x))90 self.assertThat(chart_dot.x, NotEquals(dot_x))
85 self.assertThat(chart_info.text, NotEquals(info_text))91 self.assertThat(chart_info.text, NotEquals(info_text))
@@ -106,22 +112,25 @@
106 details_button = sub_bar.select_single(112 details_button = sub_bar.select_single(
107 'UbuntuShape', objectName='detailsTab')113 'UbuntuShape', objectName='detailsTab')
108114
109 subtab_pages = self.app.select_single(115 tabs_container = self.app.select_single(
110 'QQuickItem', objectName='currentRectSizer').get_children()116 'QQuickItem', objectName='currentRectSizer')
117 news_listview = tabs_container.select_single(
118 "QQuickListView",
119 objectName="newsListView")
120 details_listview = tabs_container.select_single(
121 "QQuickListView",
122 objectName="detailsListView")
111123
112 # Ensure toolbar is hidden so we can interact with buttons124 # Ensure toolbar is hidden so we can interact with buttons
113 self.main_view.close_toolbar()125 self.main_view.close_toolbar()
114126
115 self.pointing_device.click_object(news_button)127 self.pointing_device.click_object(news_button)
116 self.assertThat(subtab_pages[3].visible, Eventually(Equals(True)))128 self.assertThat(news_listview.visible, Eventually(Equals(True)))
117129
118 self.pointing_device.click_object(details_button)130 self.pointing_device.click_object(details_button)
119131
120 self.assertThat(subtab_pages[3].visible, Eventually(Equals(False)))132 self.assertThat(news_listview.visible, Eventually(Equals(False)))
121 self.assertThat(subtab_pages[2].visible, Eventually(Equals(True)))133 self.assertThat(details_button.visible, Eventually(Equals(True)))
122
123 details_listview = self.app.select_single(
124 'QQuickListView', objectName='detailsListView')
125134
126 contentY = details_listview.contentY135 contentY = details_listview.contentY
127136
@@ -129,7 +138,7 @@
129 Eventually(Equals(details_listview.contentY)))138 Eventually(Equals(details_listview.contentY)))
130139
131 self.main_view.move_subtabs_bar_up()140 self.main_view.move_subtabs_bar_up()
132 self.main_view.hold_page_down(subtab_pages[2])141 self.main_view.hold_page_down(details_listview)
133142
134 self.assertThat(details_listview.contentY,143 self.assertThat(details_listview.contentY,
135 Eventually(NotEquals(contentY)))144 Eventually(NotEquals(contentY)))
@@ -157,29 +166,33 @@
157 details_button = sub_bar.select_single(166 details_button = sub_bar.select_single(
158 'UbuntuShape', objectName='detailsTab')167 'UbuntuShape', objectName='detailsTab')
159168
160 subtab_pages = self.app.select_single(169 tabs_container = self.app.select_single(
161 'QQuickItem', objectName='currentRectSizer').get_children()170 'QQuickItem',
162171 objectName='currentRectSizer')
163 # Ensure toolbar is hidden so we can interact with buttons172
173 news_listview = tabs_container.select_single(
174 "QQuickListView",
175 objectName="newsListView")
176 details_listview = tabs_container.select_single(
177 "QQuickListView",
178 objectName="detailsListView")
179
164 self.main_view.close_toolbar()180 self.main_view.close_toolbar()
165181
166 self.pointing_device.click_object(details_button)182 self.pointing_device.click_object(details_button)
167 self.assertThat(subtab_pages[2].visible, Eventually(Equals(True)))183 self.assertThat(details_listview.visible, Eventually(Equals(True)))
168184
169 self.pointing_device.click_object(news_button)185 self.pointing_device.click_object(news_button)
170186
171 self.assertThat(subtab_pages[2].visible, Eventually(Equals(False)))187 self.assertThat(details_listview.visible, Eventually(Equals(False)))
172 self.assertThat(subtab_pages[3].visible, Eventually(Equals(True)))188 self.assertThat(news_listview.visible, Eventually(Equals(True)))
173
174 news_listview = self.app.select_single(
175 'QQuickListView', objectName='newsListView')
176189
177 contentY = news_listview.contentY190 contentY = news_listview.contentY
178191
179 self.assertThat(news_listview.contentY, Eventually(Equals(contentY)))192 self.assertThat(news_listview.contentY, Eventually(Equals(contentY)))
180193
181 self.main_view.move_subtabs_bar_up()194 self.main_view.move_subtabs_bar_up()
182 self.main_view.hold_page_down(subtab_pages[3])195 self.main_view.hold_page_down(news_listview)
183196
184 self.assertThat(news_listview.contentY,197 self.assertThat(news_listview.contentY,
185 Eventually(NotEquals(contentY)))198 Eventually(NotEquals(contentY)))

Subscribers

People subscribed via source and target branches