Merge lp:~pedro/mago/gnome-system-log into lp:~mago-contributors/mago/mago-1.0

Proposed by Pedro Villavicencio
Status: Merged
Merged at revision: 155
Proposed branch: lp:~pedro/mago/gnome-system-log
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: 256 lines (+231/-0)
5 files modified
gnome_system_log/README (+18/-0)
gnome_system_log/gnome_system_log_tests.py (+24/-0)
gnome_system_log/gnome_system_log_tests.xml (+23/-0)
mago/application/gnome_system_log.py (+146/-0)
mago/test_suite/gnome_system_log.py (+20/-0)
To merge this branch: bzr merge lp:~pedro/mago/gnome-system-log
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Approve
Review via email: mp+43064@code.launchpad.net

Description of the change

Gnome system log tests, tests available for now are:

* Check logs, verify that logs are displayed.
* Expand logs with more versions of it.
* Change Zoom levels.
* Test about dialog.

To post a comment you must log in.
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Nice test. Many thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'gnome_system_log'
2=== added file 'gnome_system_log/README'
3--- gnome_system_log/README 1970-01-01 00:00:00 +0000
4+++ gnome_system_log/README 2010-12-08 12:03:45 +0000
5@@ -0,0 +1,18 @@
6+GNOME SYSTEM LOG TESTS
7+=======================
8+
9+Safety
10+------
11+None of these tests touches any configuration or system files. They are safe to run.
12+
13+Configuration
14+-------------
15+No files besides the logs at /var/log are required.
16+
17+Available Tests
18+---------------
19+
20+* Check logs, verify that logs are displayed.
21+* Expand logs with more versions of it.
22+* Change Zoom levels.
23+* Test about dialog.
24
25=== added file 'gnome_system_log/gnome_system_log_tests.py'
26--- gnome_system_log/gnome_system_log_tests.py 1970-01-01 00:00:00 +0000
27+++ gnome_system_log/gnome_system_log_tests.py 2010-12-08 12:03:45 +0000
28@@ -0,0 +1,24 @@
29+# -*- coding: utf-8 -*-
30+import os
31+from time import time, gmtime, strftime
32+
33+from mago.test_suite.gnome_system_log import Gnome_system_logTestSuite
34+
35+class Gnome_system_logTests(Gnome_system_logTestSuite):
36+
37+ def expand_logs(self):
38+ self.application.gsl_expand_log_sidepane()
39+
40+ def check_logs(self):
41+ self.application.gsl_check_logs()
42+
43+ def testAboutdialog(self):
44+ self.application.runAboutdialog()
45+
46+ def change_zoom_levels(self):
47+ self.application.gsl_change_zoom_level(True)
48+ self.application.gsl_change_zoom_level(False)
49+
50+if __name__ == "__main__":
51+ gnome_system_log_test = Gnome_system_logTests()
52+ gnome_system_log_test.run()
53
54=== added file 'gnome_system_log/gnome_system_log_tests.xml'
55--- gnome_system_log/gnome_system_log_tests.xml 1970-01-01 00:00:00 +0000
56+++ gnome_system_log/gnome_system_log_tests.xml 2010-12-08 12:03:45 +0000
57@@ -0,0 +1,23 @@
58+<?xml version="1.0"?>
59+<suite name="Gnome_system_log">
60+ <class>gnome_system_log_tests.Gnome_system_logTests</class>
61+ <description>
62+ Tests to verify the functionality of GNOME System Log
63+ </description>
64+ <case name="expand_logs">
65+ <method>expand_logs</method>
66+ <description>Verify that logs having childs can expand correctly</description>
67+ </case>
68+ <case name="check_logs">
69+ <method>check_logs</method>
70+ <description>Verify that the logs are displayed on the ui</description>
71+ </case>
72+ <case name="zoom_levels">
73+ <method>change_zoom_levels</method>
74+ <description>Change the zoom levels</description>
75+ </case>
76+ <case name="about_dialog">
77+ <method>testAboutdialog</method>
78+ <description>Verify that the about dialog launches</description>
79+ </case>
80+</suite>
81
82=== added file 'mago/application/gnome_system_log.py'
83--- mago/application/gnome_system_log.py 1970-01-01 00:00:00 +0000
84+++ mago/application/gnome_system_log.py 2010-12-08 12:03:45 +0000
85@@ -0,0 +1,146 @@
86+PACKAGE = "mago"
87+
88+#-*- coding:utf-8 -*-
89+"""
90+This is the "gnome_system_log" module.
91+
92+This module provides a wrapper for LDTP to make writing Gnome_system_log tests easier.
93+"""
94+import ooldtp
95+import ldtp
96+import os
97+from .main import Application
98+from ..gconfwrapper import GConf
99+from ..cmd import globals
100+import time
101+import gettext
102+
103+gettext.install (True)
104+gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
105+gettext.textdomain (PACKAGE)
106+t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
107+_ = t.gettext
108+
109+
110+class Gnome_system_log(Application):
111+ """
112+ gnome_system_log manages the Gnome_system_log application.
113+ """
114+
115+ LAUNCHER = 'gnome-system-log'
116+ LAUNCHER_ARGS = []
117+ WINDOW = 'frm*-SystemLogViewer'
118+
119+ BTN_CLEAR = _('btnClear')
120+ BTN_CLOSE = _('btnClose')
121+ BTN_FINDNEXT = _('btnFindNext')
122+ BTN_FINDPREVIOUS = _('btnFindPrevious')
123+ CBO_0 = _('cbo0')
124+ ICO_ERROR = _('icoError')
125+ MNU_28 = _('mnu28')
126+ MNU_ABOUT = _('mnuAbout')
127+ MNU_CLOSE = _('mnuClose')
128+ MNU_CONTENTS = _('mnuContents')
129+ MNU_COPY = _('mnuCopy')
130+ MNU_EDIT = _('mnuEdit')
131+ MNU_EMPTY = _('mnuEmpty')
132+ MNU_EMPTY1 = _('mnuEmpty1')
133+ MNU_EMPTY2 = _('mnuEmpty2')
134+ MNU_EMPTY3 = _('mnuEmpty3')
135+ MNU_EMPTY4 = _('mnuEmpty4')
136+ MNU_FILE = _('mnuFile')
137+ MNU_FILTERS = _('mnuFilters')
138+ MNU_FIND = _('mnuFind')
139+ MNU_HELP = _('mnuHelp')
140+ MNU_MANAGEFILTERS = _('mnuManageFilters')
141+ MNU_NORMALSIZE = _('mnuNormalSize')
142+ MNU_OPEN = _('mnuOpen')
143+ MNU_QUIT = _('mnuQuit')
144+ MNU_SELECTALL = _('mnuSelectAll')
145+ MNU_SHOWMATCHESONLY = _('mnuShowmatchesonly')
146+ MNU_SIDEPANE = _('mnuSidePane')
147+ MNU_STATUSBAR = _('mnuStatusbar')
148+ MNU_VIEW = _('mnuView')
149+ MNU_ZOOMIN = _('mnuZoomIn')
150+ MNU_ZOOMOUT = _('mnuZoomOut')
151+ SCB_R0 = _('scbr0')
152+ SCB_R1 = _('scbr1')
153+ SCB_R2 = _('scbr2')
154+ TTB_L0 = _('ttbl0')
155+ TXT_0 = _('txt0')
156+ TXT_FIND = _('txtFind')
157+
158+ def gsl_expand_log_sidepane(self):
159+ gsl = ooldtp.context(self.WINDOW)
160+ logs = gsl.getchild(self.TTB_L0)
161+
162+ if logs.getrowcount() <= 0:
163+ raise AssertionError, "No logs were found"
164+ row = 0
165+ while row < logs.getrowcount():
166+ try:
167+ logs.expandtablecell(row, 0)
168+ except:
169+ pass
170+ row+=1
171+
172+ def gsl_check_logs(self):
173+ gsl = ooldtp.context(self.WINDOW)
174+ logs = gsl.getchild(self.TTB_L0)
175+ row = 0
176+ while row < logs.getrowcount():
177+ logs.getcellvalue(row, 0)
178+ row+=1
179+
180+ def gsl_change_zoom_level(self, zoom):
181+ gsl = ooldtp.context(self.WINDOW)
182+ count = 0
183+ while count < 20:
184+ if zoom:
185+ gsl.getchild(self.MNU_ZOOMIN).selectmenuitem()
186+ else:
187+ gsl.getchild(self.MNU_ZOOMOUT).selectmenuitem()
188+ count +=1
189+
190+ def runAboutdialog(self):
191+ """
192+ This basic test simply verifies that the application launches
193+ and that the UI reacts
194+ The About dialog is the only menu that is always present in the UI
195+ """
196+ if self.MNU_ABOUT:
197+ self.main_window.click(self.MNU_ABOUT)
198+
199+ # Wait for the dialog to open
200+ # Name of about dialogs change with the app
201+ timeout=60
202+ dlgAbout=None
203+ while not ( timeout>0 and dlgAbout):
204+ dlgs=[ w for w in ldtp.getwindowlist() if w.startswith('dlgAbout')]
205+ if dlgs:
206+ dlgAbout = dlgs[0]
207+ timeout -= 1
208+ time.sleep(1)
209+
210+ if not dlgAbout:
211+ raise AssertionError('About Dialog not found')
212+
213+
214+ # Looking for a button to close the window
215+ found = None
216+ for btnClose in ('btnClose', 'btnOK', 'btnCancel'):
217+ try:
218+ found = ldtp.getchild(dlgAbout, btnClose, 'push button')
219+ break
220+ except:
221+ pass
222+
223+ if not found:
224+ return
225+
226+ ldtp.click(dlgAbout, btnClose)
227+
228+
229+ def __init__(self):
230+ Application.__init__(self)
231+ self.main_window = ooldtp.context(self.WINDOW)
232
233=== added file 'mago/test_suite/gnome_system_log.py'
234--- mago/test_suite/gnome_system_log.py 1970-01-01 00:00:00 +0000
235+++ mago/test_suite/gnome_system_log.py 2010-12-08 12:03:45 +0000
236@@ -0,0 +1,20 @@
237+"""
238+This module contains the definition of the test suite for Gnome_system_lo testing.
239+"""
240+import ldtp, ooldtp
241+from .main import SingleApplicationTestSuite
242+from ..application.gnome_system_log import Application, Gnome_system_log
243+
244+class Gnome_system_logTestSuite(SingleApplicationTestSuite):
245+ """
246+ Default test suite for Gnome_system_lo
247+ """
248+ APPLICATION_FACTORY = Gnome_system_log
249+ def setup(self):
250+ self.application.open()
251+
252+ def teardown(self):
253+ self.application.close()
254+
255+ def cleanup(self):
256+ pass

Subscribers

People subscribed via source and target branches

to status/vote changes: