Merge lp:~brian-murray/mago/yelp-test into lp:~mago-contributors/mago/mago-testsuite

Proposed by Brian Murray
Status: Merged
Merge reported by: Jean-Baptiste Lallement
Merged at revision: not available
Proposed branch: lp:~brian-murray/mago/yelp-test
Merge into: lp:~mago-contributors/mago/mago-testsuite
Diff against target: 97 lines (+92/-0)
1 file modified
yelp/test_yelp.py (+92/-0)
To merge this branch: bzr merge lp:~brian-murray/mago/yelp-test
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Approve
Review via email: mp+48042@code.launchpad.net

This proposal supersedes a proposal from 2011-01-31.

Description of the change

Adding in some tests for yelp. The search test fails since searching isn't implemented in the new version of yelp. Being aware of this failure and regression via an automated test seems useful to me. An example of the terminal output when trying to search with yelp:

7:57:48 - flash:[...ents/canonical/launchpadlib] yelp
FIXME: search_activated

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote : Posted in a previous version of this proposal

Another one of the tests is disabled as searching doesn't work.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I've reenabled the second test but added a @skip decorator, this way the test doesnt run but we don't forget that it exists.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'yelp'
2=== added file 'yelp/test_yelp.py'
3--- yelp/test_yelp.py 1970-01-01 00:00:00 +0000
4+++ yelp/test_yelp.py 2011-01-31 19:59:52 +0000
5@@ -0,0 +1,92 @@
6+# Copyright (C) 2011 Canonical Ltd
7+#
8+# This program is free software; you can redistribute it and/or modify
9+# it under the terms of the GNU General Public License as published by
10+# the Free Software Foundation; either version 2 of the License, or
11+# (at your option) any later version.
12+#
13+# This program is distributed in the hope that it will be useful,
14+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+# GNU General Public License for more details.
17+#
18+# You should have received a copy of the GNU General Public License
19+# along with this program; if not, write to the Free Software
20+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+
22+"""Yelp Test
23+
24+This is a basic test to verify that yelp is working correctly.
25+
26+It checks the following:
27+ - that searching for Shuttleworth returns a reference to Mark.
28+ - that following all links on the home page doesn't crash.
29+
30+Disabled test:
31+ - that following a link while loading a search result causes a crash
32+
33+To run it with:
34+$ mago-ng <path_to_this_file>
35+"""
36+
37+from mago import TestCase
38+import ldtp
39+import ooldtp
40+import unittest
41+
42+
43+class YelpTests(TestCase):
44+ """Launcher for the application yelp.
45+ """
46+ launcher = 'yelp'
47+ window_name = 'frmDesktopUserGuide'
48+
49+ def test_search(self):
50+ """Test search
51+
52+ Test that searching for Shuttleworth returns a reference to Mark.
53+ """
54+ # searching isn't implemented yet
55+ # FIXME: search_activated
56+ context = ooldtp.context(self.window_name)
57+ context.settextvalue('txt0', 'Shuttleworth')
58+ context.enterstring('txt0', '<enter>')
59+ ldtp.wait(2)
60+ self.assertTrue('mark shuttleworth' in
61+ context.gettextvalue('txt1'))
62+
63+ def ttest_follow_link_while_loading_crash(self):
64+ """Create a crash
65+
66+ Test that following a link while loading a search result causes a
67+ crash.
68+ """
69+ context = ooldtp.context(self.window_name)
70+ context.settextvalue('txtSearch', 'network')
71+ context.enterstring('txtSearch', '<enter>')
72+ ldtp.waittillguiexist('frmnetwork')
73+ ldtp.mouseleftclick('frmnetwork', 'Office')
74+ ldtp.waittillguiexist('frmLoading*')
75+ ldtp.wait(2)
76+ ldtp.mouseleftclick('frmLoading*', 'Office')
77+ self.assertTrue(ldtp.guiexist('frmLoading*'))
78+
79+ def test_follow_all_links_from_home(self):
80+ """Click all links on the home page
81+
82+ Test that following all links on the home page doesn't crash.
83+ Apparently some of the ukn links cause yelp to close so start with 12.
84+ """
85+ links = [item for item in ldtp.getobjectlist(self.window_name)
86+ if 'ukn' in item]
87+ for link in links:
88+ if int(link.replace('ukn', '')) > 11:
89+ ldtp.waittillguiexist(self.window_name)
90+ ldtp.mouseleftclick(self.window_name, link)
91+ ldtp.wait(2)
92+ wname = self.application.get_windowname(discover=True)
93+ ldtp.waittillguiexist(wname)
94+ ldtp.mouseleftclick(wname, 'btnBack')
95+
96+if __name__ == "__main__":
97+ unittest.main()

Subscribers

People subscribed via source and target branches