strongwind-0.9/0000755000175000017500000000000010707757223011730 5ustar jonjonstrongwind-0.9/MAINTAINERS0000644000175000017500000000006710707045357013426 0ustar jonjonJonathan Tai E-mail: jon tgpsolutions com Userid: jtai strongwind-0.9/AUTHORS0000644000175000017500000000021710707736663013005 0ustar jonjonRaul Jimenez Bailey Kong Jonathan Tai Andreas Nilsson (Strongwind Logo) strongwind-0.9/resources/0000755000175000017500000000000010707757223013742 5ustar jonjonstrongwind-0.9/resources/procedures.xsl0000644000175000017500000000367110707753076016656 0ustar jonjon <xsl:value-of select="test/name"/>

Strongwind


Strongwind Test Script


Test Procedures

Step Action Expected Results Screenshot Actual Results

Tested By: ________________________________
Date of Execution: ________________________________

strongwind-0.9/resources/procedures.css0000644000175000017500000000136010707045357016625 0ustar jonjonbody { font: 10pt Verdana, sans-serif; } .header { text-align: center; width: 100%; } hr { margin: 1.0em 0; height: 1px; border: 0; color: #000; background: #000; } #testName { font-size: 11pt; font-weight: bold; } #documentName { font-size: 10.5pt; } #testDescription { font-size: 10pt; font-style: italic; } table { border-collapse: collapse; } th, td { border: 1px solid #333; padding: 3px; vertical-align: top; text-align: left; } th { font: bold 10pt Verdana, sans-serif; background: #d0d0d0; } td { font: 10pt Verdana, sans-serif; } #stepNumber { width: 1%; } #action { width: 30%; } #expectedResult { width: 30%; } #screenshot { width: 9%; } #actualResult { width: 30%; } img { border: 0; } #signature { text-align: right; line-height: 2.5em; } strongwind-0.9/resources/strongwind.svg0000644000175000017500000004074410707736663016677 0ustar jonjon image/svg+xml image/svg+xml Strongwind Logo Andreas Nilsson October 2007 strongwind Brad Taylor http://medsphere.org/projects/strongwind Strongwind Strongwind Strongwind strongwind-0.9/resources/strongwind.png0000644000175000017500000003542610707736663016665 0ustar jonjonPNG  IHDRֽVsRGBbKGD pHYs B(xtIME 2[ IDATxw\g}9e}WbYŲ-Wi HʓJHBؘ "anٲڪۙS?fwfG+l{]{i蜙޿o4Mf4PB 9dcџG>bn ԯ7ǁe+>=[JT%)`v\i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g(FR(K6,bOֱi(ePw"V]DZ'z"X1< Wf1ƭQdC/̯~6S#:}ƛtQ2D#U !ec8}gIdTVb$M*}nJǟvjnO`ɢZ8 n>=^S Ui1vCQVNy|\ aZ1|+q1d' 2؆EO,@Ϲ/Cf,VBi6gxI *y<:"<jÙ~/-/"h1%lXf-LG{?7m3V7PxPSQFN1 wyڕSbcOS峳dI#am4!K4.r@O$xVQVW>Tdx-E4μR\oZ8d40+>}77}[d{j,Ml^Fq9P'NuxNC{Ȧsj[9.@s`T/)j";Z-V8wl:A$ .H+Cm-d1ln?EX;/M{1%iw*ôVOøpFau3 Ak`uuW\omdRn`,C!B*oi 6~> t": ݲVDj'ݹ+r=]a'953l}4*}N0{_)R6h 풃Eu5TxVA?1U,x?, @s%dHkptc$?>L5jx6qZ</hCqD[O;N)X>ŵflgHj{8o4u(#xtJjWnW]=5dV>㛳cڽci^& dҴ-W8tt 'u"vOMfF뙘g8C,jlKXXk7d;fػvtcE oo&QSrڊ>K/ HOL <q9/2`v|G#w24%\ v\M.xܵ{<|hR([ǿoPV.Qs{L<ڽ_z'=yWFV0,pKov\>-޵{=z0Jc{{i~J+\6w4@;/ m  ti%R0q!Ց w߱ҰkΏҐ Ԕt]wӣ*cgKU•cym_/Gv۟( U W~(^"u WxS$bZMY%kuv/ a ck4%,$b%;:%g3pۮ;KM%,b\xiQC?00p#{GKBί=\zwl?VfX@%q|rIENDB`strongwind-0.9/COPYING0000644000175000017500000004310310706217561012757 0ustar jonjon GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. strongwind-0.9/README0000644000175000017500000000173110706217561012605 0ustar jonjonStrongwind is a GUI test automation framework inspired by dogtail. Strongwind is object-oriented and extensible. You can use Strongwind to build object-oriented representations of your applications ("application wrappers"), then reuse the application wrappers to quickly develop many test scripts. Strongwind scripts generate a human-readable log that contains the action, expected result and a screen shot of each step. Most simple actions are logged automatically. Strongwind is written in Python and uses the pyatspi library to manipulate and query the state of applications. Strongwind automatically classifies widgets by their ATK role. By default, Strongwind provides implementations for common actions on regular widgets -- for example, selecting an item in a menu or asserting that a window has closed -- but you can extend Strongwind's implementations or add your own implementations for custom widgets to handle alternate behaviors or custom widgets in your applications. strongwind-0.9/strongwind/0000755000175000017500000000000010707757224014127 5ustar jonjonstrongwind-0.9/strongwind/__init__.py0000644000175000017500000000251310707601273016231 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # """ Strongwind is a GUI test automation framework inspired by dogtail. Strongwind is object-oriented and extensible. You can use Strongwind to build object-oriented representations of your applications ("application wrappers"), then reuse the application wrappers to quickly develop many test scripts. Strongwind scripts generate a human-readable log that contains the action, expected result and a screen shot of each step. Most simple actions are logged automatically. """ import config import procedurelogger import watchdog import cache from errors import * from utils import * from accessibles import * strongwind-0.9/strongwind/accessibles.py0000644000175000017500000011121010707472777016764 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 'Define the base Accessible and widget-specific classes' import re from time import sleep import pyatspi import config import errors import procedurelogger import utils import cache class Accessible(object): ''' A generic Accessible Subclasses of this class in this module provide additional functionality specific to certain ATK roles. (e.g., the MenuBar provides a select() method that this generic Accessible does not provide) ''' def __init__(self, accessible): ''' Constructor for strongwind.accessibles.Accessible Takes a single argument, accessible. accessible can be either a pyatspi.Accessibility.Accessible or another strongwind.accessibles.Accessible. The constructor's main job is to set self._accessible, to the pyatspi.Accessibility.Accessible that this object is wrapping. ''' if isinstance(accessible, pyatspi.Accessibility.Accessible): self._accessible = accessible elif isinstance(accessible, Accessible): self._accessible = accessible._accessible else: raise TypeError # make sure our _accessible is valid assert isinstance(self._accessible, pyatspi.Accessibility.Accessible) def _promote(self, accessible): ''' Promote a pyatspi.Accessibility.Accessible to a specific strongwind class if possible (e.g., a strongwind.accessibles.Dialog), or to a generic strongwind.accessibles.Accessible otherwise. ''' # look in the application/widget cache first if accessible.getRole() == pyatspi.ROLE_APPLICATION: try: return cache.getApplicationById(accessible.queryApplication().id) except KeyError: pass # not in cache else: try: return cache.getWidget(accessible) except KeyError: pass # not in cache # try looking for a specific strongwind class, e.g. strongwind.accessibles.MenuBar try: className = utils.toClassName(accessible.getRoleName()) # convert the accessible's role name to a class name, e.g. "menu bar" => "MenuBar" module = __import__(__name__) # import the current module (strongwind.accessibles) so we can inspect its vars klass = vars(module)[className] # turn the className (a string) into the class of that name (e.g., a MenuBar class) return klass(accessible) # return an instance of the class (e.g., a MenuBar object) except KeyError: return Accessible(accessible) # attribute wrappers def __getattr__(self, attr): if attr == 'childCount': return self._accessible.childCount elif attr == 'name': return self._accessible.name elif attr == 'logName': if not self.__dict__.has_key('logName'): self.__dict__['logName'] = self._accessible.name return self.__dict__['logName'] elif attr == 'description': return self._accessible.description elif attr == 'parent': return self._promote(self._accessible.parent) elif attr == 'role': return self._accessible.getRole() elif attr == 'roleName': return self._accessible.getRoleName() elif attr == 'extents': return self._accessible.queryComponent().getExtents(pyatspi.DESKTOP_COORDS) elif attr == 'layer': return self._accessible.queryComponent().getLayer() elif attr == 'text': itext = self._accessible.queryText() return itext.getText(0, itext.characterCount) elif attr == 'value': return self._accessible.queryValue().currentValue elif attr == 'caretOffset': return self._accessible.queryText().caretOffset elif attr == 'characterCount': return self._accessible.queryText().characterCount elif attr == 'app': try: return cache.getApplicationById(self._accessible.getApplication().id) except Exception: try: return self._promote(self._accessible.getApplication()) except Exception: return None else: # bind states, e.g., showing, focusable, sensitive, etc. a = 'STATE_' + utils.toConstantName(attr) v = vars(pyatspi) if v.has_key(a): try: return self._accessible.getState().contains(v[a]) except AttributeError: # when the app goes down, we sometimes get "AttributeError: 'CORBA.Object' object has no attribute 'contains'" return False # FIXME: bind relations # FIXME: bind attributes # add find methods if attr.startswith('findAll'): a = None translations = { 'findAllCanvases': 'ROLE_CANVAS', 'findAllCheckBoxes': 'ROLE_CHECK_BOX', 'findAllComboBoxes': 'ROLE_COMBO_BOX', 'findAllEmbedded': 'ROLE_EMBEDDED', 'findAllEntries': 'ROLE_ENTRY', 'findAllFillers': 'ROLE_FILLER', 'findAllInvalid': 'ROLE_INVALID', 'findAllLastDefined': 'ROLE_LAST_DEFINED'} try: a = translations[attr] except KeyError: a = 'ROLE' + utils.toConstantName(attr[7:-1]) v = vars(pyatspi) if v.has_key(a): # generate a function on-the-fly and return it def findMethod(name, checkShowing=True, recursive=True): dontCheckShowing = not checkShowing return utils.findAllDescendants(self, lambda x: x.role == v[a] and utils.equalsOrMatches(x.name, name) and (dontCheckShowing or x.showing), recursive) return findMethod if attr.startswith('find'): a = 'ROLE' + utils.toConstantName(attr[4:]) v = vars(pyatspi) if v.has_key(a): # generate a function on-the-fly and return it def findMethod(name, logName=None, checkShowing=True, retry=True, recursive=True, breadthFirst=True, raiseException=True, setReference=False): dontCheckShowing = not checkShowing y = utils.findDescendant(self, lambda x: x.role == v[a] and utils.equalsOrMatches(x.name, name) and (dontCheckShowing or x.showing), \ retry=retry, recursive=recursive, breadthFirst=breadthFirst, raiseException=raiseException) # don't try promoting y if it's None if not raiseException and y is None: return y # look in the widget cache first try: return cache.getWidget(y) except KeyError: pass # not in cache # if the logName isn't given, set it to the name (unless the name is a regex) if logName is None and type(name) is not type(re.compile('r')): logName = name # if we still don't have a logname, just grab the name of the accessible if logName is None: logName = y.name # at this point, we have a logName. next, we look for a class named # logName + roleName in moduleName. if such a class can be found, we promote # the widget to that class, cache the instance, and return it. # # if no such class can be found, and the logName is different than the name # of the widget, set the widget's log name and cache the widget. if the logName # is the same as the widget's logName, there's no need to cache the widget. # if the logName is 'Preferences' and roleName of the widget is 'Dialog', # the name of the class to look for is 'PreferencesDialog' className = utils.toClassName(logName) + utils.toClassName(y.roleName) # the module prefix is the module of this class. so if we had a widget that had # a class medsphere.openvistacis.OpenVistaCIS, and we call findDialog('Preferences') # on it, the module prefix would be medsphere.openvistacis. we append the name of # the class we're looking for to the module prefix to get the name of the module. # so continuing with the example, the full module name would be # medsphere.openvistacis.preferencesdialog. (In the medsphere.openvistacis.preferencesdialog # module, we would look for 'PreferencesDialog' - that code is a few lines down) moduleName = self.__class__.__module__ + '.' + className.lower() try: # import the module, grab the class, and make an instance of it, then cache the instance module = __import__(moduleName, globals(), None, [className]) klass = vars(module)[className] z = klass(y) cache.addWidget(z) except (ImportError, KeyError): # if the found widget's logName isn't the same as the logName # we were given, set the widget's logName and cache the widget if y.name != logName: y.logName = logName cache.addWidget(y) # make the log name stick by caching the object with the logName property set on it z = y # set self.preferencesDialog = the widget we just found/promoted/cached if setReference: self.__setattr__(utils.toVarName(logName) + utils.toClassName(z.roleName), z) return z return findMethod # add assert methods if attr.startswith('assertNo'): a = 'ROLE' + utils.toConstantName(attr[8:]) v = vars(pyatspi) if v.has_key(a): # generate a function on-the-fly and return it def assertMethod(name, checkShowing=True, retry=False, recursive=True, breadthFirst=False, raiseException=False): def descendantNotFound(): dontCheckShowing = not checkShowing return utils.findDescendant(self, lambda x: x.role == v[a] and utils.equalsOrMatches(x.name, name) and (dontCheckShowing or x.showing), \ retry=retry, recursive=recursive, breadthFirst=breadthFirst, raiseException=raiseException) == None assert utils.retryUntilTrue(descendantNotFound) return assertMethod if attr.startswith('assert'): a = 'ROLE' + utils.toConstantName(attr[6:]) v = vars(pyatspi) if v.has_key(a): # generate a function on-the-fly and return it def assertMethod(name, checkShowing=True, retry=False, recursive=True, breadthFirst=False, raiseException=False): def descendantFound(): dontCheckShowing = not checkShowing return utils.findDescendant(self, lambda x: x.role == v[a] and utils.equalsOrMatches(x.name, name) and (dontCheckShowing or x.showing), \ retry=retry, recursive=recursive, breadthFirst=breadthFirst, raiseException=raiseException) != None assert utils.retryUntilTrue(descendantFound) return assertMethod if self.__dict__.has_key(attr): return self.__dict__[attr] raise AttributeError, "%s instance has no attribute '%s'" % (self.__class__.__name__, attr) def __setattr__(self, attr, value): if attr == 'name': self._accessible.name = value elif attr == 'description': self._accessible.description = value elif attr == 'text': self._accessible.queryEditableText().setTextContents(value) elif attr == 'value': self._accessible.queryValue().currentValue = value else: self.__dict__[attr] = value # thin method wrappers def __iter__(self): for i in self._accessible: if i is None: continue yield self._promote(i) def __str__(self): 'Creates a logName representation of this Accessible (ie. Zoom In button)' translations = { pyatspi.ROLE_FRAME: 'window', pyatspi.ROLE_MENU_ITEM: 'menu option', pyatspi.ROLE_PAGE_TAB: 'tab', pyatspi.ROLE_PANEL: 'section', pyatspi.ROLE_PUSH_BUTTON: 'button', pyatspi.ROLE_TABLE: 'list', pyatspi.ROLE_TABLE_CELL: '', pyatspi.ROLE_TEXT: 'text field', pyatspi.ROLE_TOOL_BAR: 'toolbar', pyatspi.ROLE_WINDOW: 'context menu'} try: name = self.logName except AttributeError: name = self.name # get rid of the ... at the end of the names (eg. Edit...) if re.search('\.\.\.$', name): name = name[:-3] # remove/change newlines in names to a space name = name.replace('/\n','/').replace('\n',' ') try: roleName = translations[self.role] except KeyError: roleName = self.roleName if re.search(roleName + '$', name, flags=re.IGNORECASE): return name if name is '' or name is None: return roleName return '%s %s' % (name, roleName) def __nonzero__(self): return self._accessible.__nonzero__() def __getitem__(self, index): return self._promote(self._accessible.__getitem__(index)) def __len__(self): return self._accessible.__len__() def getIndexInParent(self): return self._accessible.getIndexInParent() def getApplication(self): return self._promote(self._accessible.getApplication()) def getChildAtIndex(self, index): return self._promote(self._accessible.getChildAtIndex(index)) # methods to synthesize raw user input # adapted from script_playback.py def _charToKeySym(self, key): import gtk.gdk try: rv = gtk.gdk.unicode_to_keyval(ord(key)) except: rv = getattr(gtk.keysyms, key) return rv # adapted from script_playback.py, originally named type def typeText(self, text): 'Turns text (a string) into a series of keyboard events' text_syms = map(self._charToKeySym, text) for key in text_syms: sleep(config.KEYCOMBO_DELAY) pyatspi.Registry.generateKeyboardEvent(key, None, pyatspi.KEY_SYM) # adapted from script_playback.py def keyCombo(self, combo): 'Focus this Accessible and press a combination of keys simultaneously' import gtk.gdk _keymap = gtk.gdk.keymap_get_default() keySymAliases = { 'enter' : 'Return', 'esc' : 'Escape', 'alt' : 'Alt_L', 'control' : 'Control_L', 'ctrl' : 'Control_L', 'shift' : 'Shift_L', 'del' : 'Delete', 'ins' : 'Insert', 'pageup' : 'Page_Up', 'pagedown' : 'Page_Down', ' ' : 'space', '\t' : 'Tab', '\n' : 'Return' } ModifierKeyCodes = { 'Control_L' : _keymap.get_entries_for_keyval(gtk.keysyms.Control_L)[0][0], 'Alt_L' : _keymap.get_entries_for_keyval(gtk.keysyms.Alt_L)[0][0], 'Shift_L' : _keymap.get_entries_for_keyval(gtk.keysyms.Shift_L)[0][0] } keys = [] for key in re.split('[<>]', combo): if key: key = keySymAliases.get(key.lower(), key) keys.append(key) modifiers = map(ModifierKeyCodes.get, keys[:-1]) try: self.grabFocus() except: pass sleep(config.SHORT_DELAY) for key_code in modifiers: sleep(config.KEYCOMBO_DELAY) pyatspi.Registry.generateKeyboardEvent(key_code, None, pyatspi.KEY_PRESS) sleep(config.KEYCOMBO_DELAY) pyatspi.Registry.generateKeyboardEvent(self._charToKeySym(keys[-1]), None, pyatspi.KEY_SYM) for key_code in modifiers: sleep(config.KEYCOMBO_DELAY) pyatspi.Registry.generateKeyboardEvent(key_code, None, pyatspi.KEY_RELEASE) def mouseClick(self, button=1, xOffset=0, yOffset=0): 'Synthesize a mouse click on this Accessible' bbox = self.extents x = bbox.x + (bbox.width / 2) + xOffset y = bbox.y + (bbox.height / 2) + yOffset pyatspi.Registry.generateMouseEvent(x, y, 'b%dc' % button) # interface methods def _doAction(self, action): 'Wrapper for doAction method in IAction interface' iaction = self._accessible.queryAction() for i in xrange(iaction.nActions): if iaction.getName(i) == action: def sensitive(): return self.sensitive if not utils.retryUntilTrue(sensitive): raise errors.NotSensitiveError iaction.doAction(i) def click(self): "Convenience wrapper for _doAction('click')" self._doAction('click') def activate(self): "Convenience wrapper for _doAction('activate')" self._doAction('activate') def toggle(self): "Convenience wrapper for _doAction('toggle')" self._doAction('toggle') def grabFocus(self): 'Wrapper for grabFocus method in IComponent interface' self._accessible.queryComponent().grabFocus() # MAYBE: any methods from ICollection? # no clue... doesn't show up in the class list # MAYBE: any methods from IDocument? # there are attributes... # MAYBE: any methods from IHyperlink? # MAYBE: any methods from IHypertext? # some methods exist to get URIs # MAYBE: any methods from IImage? # getImageExtents is the only interesting one # MAYBE: any methods from ILoginHelper? # not sure what this does def selectChild(self, childIndex): 'Wrapper for selectChild in ISelection interface' self._accessible.querySelection().selectChild(childIndex) def selectAll(self): 'Wrapper for selectAll in ISelection interface' self._accessible.querySelection().selectAll() def clearSelection(self): 'Wrapper for selectAll in ISelection interface' self._accessible.querySelection().clearSelection() def getSelectedChild(self, selectedChildIndex): 'Wrapper for getSelectedChild in ISelection interface' return self._promote(self._accessible.querySelection().getSelectedChild(selectedChildIndex)) def getSelectedChildren(self): selectedChildren = [] for i in xrange(self._accessible.querySelection().nSelectedChildren): selectedChildren.append(self._promote(self._accessible.querySelection().getSelectedChild(i))) return selectedChildren # MAYBE: any more methods from ISelection? here are the other methods that ISelection # provides: deselectChild, deselectSelectedChild, isChildSelected # # for deselectChild and deselectSelectedChild, we really only use # ISelection for page tab lists, and they can't be deselected # # for isChildSelected we can just use the .selected # property. So I think we're good for now... # MAYBE: any methods from IStreamableContent? # not sure what this does above and beyond the text interface # FIXME: any (more) methods from ITable? # inside Table class # FIXME: any (more) methods from IText? # yes, attribute query methods for color, etc. def getTextAttributes(self, charPos): sep = re.compile(':') itext = self._accessible.queryText() attrdict = {} for x in itext.getDefaultAttributeSet(): (a,v) = sep.split(x) attrdict[a] = v for x in itext.getAttributeRun(charPos, False)[0]: (a,v) = sep.split(x) attrdict[a] = v return attrdict def assertTextAttribute(self, attr, value, charPos): 'Assert attr:value string on text at position charPos (i.e. attr="fg-color", value="0,0,0")' itext = self._accessible.queryText() def checkAttribute(): if attr in self.getTextAttributes(charPos): if self.getTextAttributes(charPos)[attr] == value: return True return False assert utils.retryUntilTrue(checkAttribute) def removeTextSelection(self, index=0): 'Remove selection from text at index' self._accessible.queryText().removeSelection(index) def getSelectedText(self, index=0): return self._accessible.queryText().getText(*itext.getSelection(index)) def assertSelectedText(self, text, index=0): assert utils.retryUntilTrue(lambda: self.getSelectedText(index) == text) class Desktop(Accessible): pass class Application(Accessible): def __init__(self, accessible, subproc=None): super(Application, self).__init__(accessible) self.subproc = subproc # this is used later to determine if the application is closed # FIXME: assert that subproc is the right type? def __getattr__(self, attr): if attr == 'id': return self._accessible.id else: return super(Application, self).__getattr__(attr) def findFrame(self, name, logName=None, retry=True, raiseException=True, setReference=True, log=True): 'Search for a window' func = self.__getattr__('findFrame') frame = func(name, logName=logName, retry=retry, recursive=False, raiseException=raiseException, setReference=setReference) if log: # we need to log after the find() because the frame might be promoted and have a different logName procedurelogger.expectedResult('The %s appears.' % frame) return frame def findDialog(self, name, logName=None, retry=True, raiseException=True, setReference=True, log=True): 'Search for a dialog' func = self.__getattr__('findDialog') dialog = func(name, logName=logName, retry=retry, recursive=False, raiseException=raiseException, setReference=setReference) if log: # we need to log after the find() because the dialog might be promoted and have a different logName procedurelogger.expectedResult('The %s appears.' % dialog) return dialog def findAlert(self, text, logText=None, retry=True, raiseException=True): ''' Search for an alert Alerts typically have no name, so we have to search for them by their content. We look for alerts that are showing and have within them a label that contains the given text. ''' if logText is None: logText = text if raiseException: procedurelogger.expectedResult('An alert appears: %s' % logText) def alertHasLabelContainingText(alert): return alert.role == pyatspi.ROLE_ALERT and alert.showing and \ alert.findLabel(text, retry=False, recursive=True, raiseException=False) is not None return utils.findDescendant(self, alertHasLabelContainingText, retry=retry, recursive=False, raiseException=raiseException) def assertClosed(self): 'Raise an exception if the application is still open' procedurelogger.expectedResult('The application closes.') if self.subproc is not None: def closed(): return self.subproc.poll() == 0 assert utils.retryUntilTrue(closed) class Frame(Accessible): # often, when a window is closed, the application closes. the assertClosed # method needs the role and roleName properties to do its logging, so # ensure that those properties are available, even if the underlying # _accessible object goes away role = pyatspi.ROLE_FRAME roleName = 'Frame' def altF4(self, assertClosed=True): 'Press F4' procedurelogger.action('Press F4.', self) self.keyCombo('F4') if assertClosed: self.assertClosed() def assertClosed(self): 'Raise an exception if the window is still open' procedurelogger.expectedResult('The %s disappears.' % self) def closed(): try: return not self.showing except (LookupError, KeyError, pyatspi.ORBit.CORBA.COMM_FAILURE): return True assert utils.retryUntilTrue(closed) class Dialog(Accessible): def ok(self, assertClosed=True): 'Click the OK button' self._clickPushButton('OK', assertClosed=assertClosed) def cancel(self, assertClosed=True): 'Click the Cancel button' self._clickPushButton('Cancel', assertClosed=assertClosed) def close(self, assertClosed=True): 'Click the Close button' self._clickPushButton('Close', assertClosed=assertClosed) def _clickPushButton(self, name, assertClosed=True): 'Click a button and optionally assert that the dialog closes' self.findPushButton(name).click() if assertClosed: self.assertClosed() def altF4(self, assertClosed=True): 'Press F4' procedurelogger.action('Press F4.', self) self.keyCombo('F4') if assertClosed: self.assertClosed() def assertClosed(self): 'Raise an exception if the dialog is still open' procedurelogger.expectedResult('The %s disappears.' % self) def closed(): try: return not self.showing except LookupError: return True assert utils.retryUntilTrue(closed) class Alert(Accessible): def __init__(self, accessible): super(Alert, self).__init__(accessible) self.message = self.findLabel(None, raiseException=False) def ok(self, assertClosed=True): 'Click the OK button' self._clickPushButton('OK', assertClosed=assertClosed) def yes(self, assertClosed=True): 'Click the Yes button' self._clickPushButton('Yes', assertClosed=assertClosed) def no(self, assertClosed=True): 'Click the No button' self._clickPushButton('No', assertClosed=assertClosed) def _clickPushButton(self, name, assertClosed=True): 'Click a button and optionally assert that the alert closes' self.findPushButton(name).click() if assertClosed: self.assertClosed() def assertClosed(self): 'Raise an exception if the alert is still open' procedurelogger.expectedResult('The %s disappears.' % self) assert utils.retryUntilTrue(lambda: not self.showing) class PageTabList(Accessible): def getPageTabNames(self): 'Returns the string name of all the page tabs' names = [] for child in self: names.append(child.name) return names def getCurrentPage(self): 'Get the current page tab' for child in self: if child.selected: return child def findPageTab(self, name, logName=None, retry=True, raiseException=True, setReference=True): 'Search for a page tab' # for performance, don't search for pageTabs recursively; set a reference to the page tab (if/when found) by default return self.__getattr__('findPageTab')(name, logName=logName, retry=retry, recursive=False, raiseException=raiseException, setReference=setReference) def select(self, name, logName=None, log=True): 'Select a tab' # we don't use self.findPageTab or self.__getattr__('findPageTab') # here because findPageTab tries to promote tabs to specific classes # which may have constructors that look for widgets that are # lazy-loaded, causing bogus searchErrors. tab = utils.findDescendant(self, lambda x: x.role == pyatspi.ROLE_PAGE_TAB and utils.equalsOrMatches(x.name, name) and x.showing, \ recursive=False) # do the work of actually selecting the tab. this should cause # lazy-loaded widgets to be loaded. self.selectChild(tab.getIndexInParent()) # now search for the tab as if we haven't done any of the above, but # don't do any logging tab = self.findPageTab(name, logName=logName) # now that we have the (possibly promoted) tab, do the logging if log: # we need to log after the find() because the tab might be promoted and have a different logName procedurelogger.action('Select the %s.' % tab, self) sleep(config.MEDIUM_DELAY) return tab class PageTab(Accessible): # keep this around in case we want to add to it someday; application wrappers around tabs should extend from this class pass class Table(Accessible): def __getattr__(self, attr): itable = self._accessible.queryTable() if attr == 'nRows': return itable.nRows elif attr == 'nColumns': return itable.nColumns elif attr == 'summary': return itable.summary elif attr == 'caption': return itable.caption elif attr == 'nSelectedRows': return itable.nSelectedRows elif attr == 'nSelectedColumns': return itable.nSelectedColumns elif attr == 'getRowAtIndex': return itable.getRowAtIndex elif attr == 'getColumnAtIndex': return itable.getColumnAtIndex elif attr == 'getSelectedRows': return itable.getSelectedRows elif attr == 'getSelectedColumns': return itable.getSelectedColumns elif attr == 'isRowSelected': return itable.isRowSelected elif attr == 'isColumnSelected': return itable.isColumnSelected elif attr == 'addRowSelection': return itable.addRowSelection elif attr == 'addColumnSelection': return itable.addColumnSelection elif attr == 'removeRowSelection': return itable.removeRowSelection elif attr == 'removeColumnSelection': return itable.removeColumnSelection else: return super(Table, self).__getattr__(attr) def getAccessibleAt(self, row, col): return self._promote(self._accessible.queryTable().getAccessibleAt(row, col)) def assertTableCellAt(self, row, col, text): assert utils.retryUntilTrue(lambda : self.getAccessibleAt(row, col).name == text) def isCellSelected(self, row, col): return self._accessible.queryTable().isSelected(row, col) def select(self, name, logName=None, log=True): 'Select a table cell' sleep(config.MEDIUM_DELAY) # don't checkShowing because we want to allow selecting table cells that are out of the viewport cell = self.findTableCell(name, logName=logName, checkShowing=False, breadthFirst=False) cell.select(log=log) return cell def activate(self, name, logName=None, log=True): 'Activate (double-click) a table cell' sleep(config.MEDIUM_DELAY) # don't checkShowing because we want to allow selecting table cells that are out of the viewport cell = self.findTableCell(name, logName=logName, checkShowing=False, breadthFirst=False) cell.activate(log=log) return cell def assertTableCell(self, name, checkShowing=True, retry=False, recursive=True, breadthFirst=False, raiseException=False): sleep(config.MEDIUM_DELAY) self.__getattr__('assertTableCell')(name, checkShowing=checkShowing, retry=retry, recursive=recursive, breadthFirst=breadthFirst, raiseException=raiseException) def assertNoTableCell(self, name, checkShowing=True, retry=False, recursive=True, breadthFirst=False, raiseException=False): sleep(config.MEDIUM_DELAY) self.__getattr__('assertNoTableCell')(name, checkShowing=checkShowing, retry=retry, recursive=recursive, breadthFirst=breadthFirst, raiseException=raiseException) class TableCell(Accessible): def select(self, log=True): 'Select the table cell' if log: procedurelogger.action('Select %s.' % self, self) self.grabFocus() def activate(self, log=True): 'Activate (double-click) the table cell' if log: procedurelogger.action('Double-click %s.' % self, self) self.grabFocus() super(TableCell, self).activate() def typeText(self, text, log=True): 'Type text into the table cell' self.mouseClick() if log: procedurelogger.action('Enter "%s" into %s.' % (text, self), self) sleep(config.SHORT_DELAY) super(TableCell, self).typeText(text) pyatspi.Registry.generateKeyboardEvent(self._charToKeySym('Return'), None, pyatspi.KEY_SYM) def mouseClick(self, button=1, xOffset=0, yOffset=0, log=True): ''' Click the table cell If the table cell is editable, this should trigger the "edit mode". If you just want to select the table cell, use select() instead. ''' if log: procedurelogger.action('Click %s.' % self, self) super(TableCell, self).mouseClick(button=button, xOffset=xOffset, yOffset=yOffset) class TreeTable(Table): pass class Button(Accessible): # ROLE_BUTTON doesn't actually exist, this is just used as a base class for the following classes def click(self, log=True): 'Click the button' if log: procedurelogger.action('Click the %s.' % self, self) super(Button, self).click() class PushButton(Button): pass class RadioButton(Button): pass class CheckBox(Button): pass class Text(Accessible): def enterText(self, text, log=True): 'Enter text' if log: procedurelogger.action('Enter "%s" into the %s.' % (text, self), self) self.text = text # since we don't absolutely need to use typeText here, lets do it this way since its a lot faster class PasswordText(Text): pass class MenuBar(Accessible): def _open(self, path): 'Open a menu without any logging' parent = self for menu in path: parent = parent.findMenu(menu, recursive=False) parent.click() # open the menu so that the children are showing return parent # return the last menu def select(self, path, log=True): ''' Select a menu item Path must be an array of strings; regular expressions are not supported. ''' if log: procedurelogger.action('Under the %s menu, select %s.' % (' => '.join(path[0:-1]), path[-1].replace('...', '')), self) parent = self._open(path[0:-1]) # the last item in the path is excluded because we're going to click that item item = utils.findDescendant(parent, lambda x: (x.role == pyatspi.ROLE_MENU_ITEM or x.role == pyatspi.ROLE_CHECK_MENU_ITEM) \ and utils.equalsOrMatches(x.name, path[-1]) and x.showing, recursive=False) item.click() return item def open(self, path): ''' Open a menu Path must be an array of strings; regular expressions are not supported. ''' procedurelogger.action('Open the %s menu.' % ' => '.join(path), self) return self._open(path) class ComboBox(Accessible): def select(self, name, logName=None, log=True): 'Select an item' item = self.findMenuItem(name, logName=logName, checkShowing=False) if log: procedurelogger.action('Select %s.' % str(item).replace(' menu option', ''), self) item.click() return item strongwind-0.9/strongwind/watchdog.py0000644000175000017500000001417410707601273016300 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # ''' Detect and terminate hung test scripts The watchdog runs in a separate thread and increments a counter. Callbacks can be registered with the watchdog to be run every n seconds. Calling resetTimeout() will reset to the counter to 0; this is done automatically by procedurelogger.action(). If the counter is allowed to reach config.WATCHDOG_TIMEOUT, test script execution is aborted. Typically, application failures will cause some other aspect of the test to fail before the watchdog kicks in. (e.g., a dialog is supposed to appear, but it cannot be found, so the test fails) However, applications can sometimes hang in a way that causes a pyatspi call to hang. In this case, the main Strongwind thread will hang waiting for the pyatspi call to return - this is when the watchdog would step in and kill the test script. The watchdog is most useful when running a batch of Strongwind tests unattended. If one test hangs, it will eventually be killed by the watchdog so that other tests can be run. ''' import os import sys import threading import atexit from time import sleep import config import procedurelogger _watchdogThread = None _counter = 0 _counterLock = threading.Lock() _terminate = False _terminateLock = threading.Lock() _callbacks = {} _callbacksLock = threading.Lock() def resetTimeout(): ''' Reset the watchdog counter to 0 The watchdog counter is incremented every second. If it reaches config.WATCHDOG_TIMEOUT, script execution is aborted. This method is called by procedurelogger.action(), so most test scripts will not need to call this manually. ''' global _counter _counterLock.acquire() _counter = 0 _counterLock.release() def _watchdog(): ''' The body of the watchdog thread Every second, run any registered callbacks and increment the watchdog counter. If a callback returns False, the script will terminate. ''' global _counter global _terminate global _callbacks def exit(message): sys.stderr.write(message + '\n') # _exit() exits "without calling cleanup handlers, flushing stdio buffers, # etc.", so we have to tell procedurelogger to save its log explicitly procedurelogger.save() os._exit(1) _terminateLock.acquire() _counterLock.acquire() while _terminate is False and _counter < config.WATCHDOG_TIMEOUT: _terminateLock.release() _callbacksLock.acquire() for timeout in _callbacks: if _counter is not 0 and (_counter % timeout) == 0: for callback,args in _callbacks[timeout]: if not callback(*args): _counterLock.release() _callbacksLock.release() exit('Watchdog callback returned False; exiting') _callbacksLock.release() _counter += 1 _counterLock.release() sleep(1) # we sometimes get the following exception when the script is exiting: # # Exception in thread Thread-1 (most likely raised during interpreter shutdown): # Traceback (most recent call last): # File "threading.py", line 460, in __bootstrap # File "threading.py", line 440, in run # File "/tmp/strongwind-node/tests/strongwind/watchdog.py", line 91, in _watchdog # : 'NoneType' object has no attribute 'acquire' # Unhandled exception in thread started by # Error in sys.excepthook: # # Original exception was: # # so try-catch the next statement and abort if we get an AttributeError try: _terminateLock.acquire() except exceptions.AttributeError: return _counterLock.acquire() _counterLock.release() if _terminate is False: _terminateLock.release() exit('Watchdog timeout reached; exiting') _terminateLock.release() def start(): ''' Start the watchdog thread Set the terminate flag to false, create the watchdog thread, start it, and arrange for it to stop when the script exits. ''' global _watchdogThread global _terminate _terminateLock.acquire() _terminate = False _terminateLock.release() if _watchdogThread is None: _watchdogThread = threading.Thread(target=_watchdog) _watchdogThread.setDaemon(True) if not _watchdogThread.isAlive(): _watchdogThread.start() atexit.register(stop) def stop(): ''' Stop the watchdog thread Set the terminate flag to True; the watchdog thread should notice within one second and exit. ''' global _terminate _terminateLock.acquire() _terminate = True _terminateLock.release() def addCallback(timeout, callback, args={}): ''' Add a watchdog callback callback will be called with args every timeout seconds, If callback returns False, the script will terminate. ''' global _callbacks _callbacksLock.acquire() if _callbacks.has_key(timeout): _callbacks[timeout].append((callback, args)) else: _callbacks[timeout] = [(callback, args)] _callbacksLock.release() def removeCallback(timeout, callback, args={}): 'Remove a watchdog callback' global _callbacks _callbacksLock.acquire() _callbacks[timeout].__delitem__((callback, args)) _callbacksLock.release() # start the watchdog start() strongwind-0.9/strongwind/errors.py0000644000175000017500000000171210706217561016010 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 'Custom exceptions' class SearchError(Exception): 'Raised when a search method fails' pass class NotSensitiveError(Exception): 'Raised when an action cannot be performed because the widget is insensitive' pass strongwind-0.9/strongwind/procedurelogger.py0000644000175000017500000002540710707601273017671 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # ''' Log test procedures in a human-readable format The basic pattern for a strongwind test is to do the following: procedurelogger.action('Do something.') app.widget.findOtherWidget('Other widget').doAction('something') procedurelogger.expectedResult('The application reacts to the action.') app.widget.assertWidgetReacted() Notice that calls to the procedure logger occur *before* actually performing the actions. This is intentional - if an exception is encountered performing the action, or asserting the result, the resulting log will show the attempted action/result, then the error that occurred. In many cases, the call to action() is done by the widgets themselves or the application wrapper, so action() calls are not always necessary. For example, a push button's click() method will automatically log the click. Also, some assert methods will automatically log the expected result, so expectedResult() calls are not always necessary, either. ''' import os import sys try: import yaml gotYaml = True except ImportError: print 'Error importing yaml module; tags will not be parsed' gotYaml = False import atexit import traceback try: import xml.etree.ElementTree as ET # python 2.5 except ImportError: try: import cElementTree as ET # cElementTree is faster except ImportError: import elementtree.ElementTree as ET # fallback on regular ElementTree import datetime import pyatspi import config import cache import utils import watchdog _procedures = [] _actionBuffer = '' _expectedResultBuffer = '' _oldParents = [] # roles we want to search up the tree for _containerParentRoles = [ pyatspi.ROLE_APPLICATION, pyatspi.ROLE_FRAME, pyatspi.ROLE_ALERT, pyatspi.ROLE_DIALOG, pyatspi.ROLE_FILE_CHOOSER, pyatspi.ROLE_PAGE_TAB, pyatspi.ROLE_PANEL, pyatspi.ROLE_TOOL_BAR] _windowLikeParentRoles = [ pyatspi.ROLE_FRAME, pyatspi.ROLE_DIALOG] # roles of child which can be set as parent but is not searched for up the tree # only child is checked against this list _childRoles = [ pyatspi.ROLE_APPLICATION, pyatspi.ROLE_FRAME, pyatspi.ROLE_ALERT, pyatspi.ROLE_DIALOG, pyatspi.ROLE_FILE_CHOOSER, pyatspi.ROLE_PAGE_TAB, pyatspi.ROLE_COMBO_BOX, pyatspi.ROLE_TABLE, pyatspi.ROLE_TOOL_BAR] def action(action, child=None): ''' Log an action, e.g., Click Cancel If a child is given ... FIXME: decipher mysterious code below Multiple calls to action() (without a call to expectedResult() in between) will cause the message from each call to be concatenated to the message from previous calls. ''' _flushBuffers() global _actionBuffer global _oldParents prefix = '' # TODO: benchmark the performance hit we receive from logparent using lists of parents if child is not None: def getValidParents(child, validRoles, checkParents=True): 'Grab parents whose role is in validRoles' validParents = [] current = child while current is not None: if current.role in validRoles: validParents.append(current) if not checkParents: return validParents if current.role == pyatspi.ROLE_APPLICATION: break current = current.parent return validParents def isDifferent(new): 'Relies on role and name to differentiate widgets' try: for old in _oldParents: if old.role == new.role and old.name == new.name: if new.role == pyatspi.ROLE_ALERT: oldText = old.message newText = new.message if oldText == newText: return False else: return False except (LookupError, KeyError, pyatspi.ORBit.CORBA.COMM_FAILURE): pass return True newParents = getValidParents(child, _childRoles, False) + getValidParents(child.parent, _containerParentRoles) application = None windowLike = None container = None #app if len(_oldParents) > 0: old = _oldParents[-1] new = newParents[-1] try: if old.id != new.id: application = cache.getApplicationById(new.id) except (LookupError, KeyError, pyatspi.ORBit.CORBA.COMM_FAILURE): application = cache.getApplicationById(new.id) #container for x in newParents: if (container is None) and (x.role in _containerParentRoles) and isDifferent(x): if x.name != "": container = x continue #windowLike #only execute this line if container is found if (container is not None) and (x.role in _windowLikeParentRoles) and isDifferent(x): windowLike = x if application is not None: prefix += "Switch to %s. " % application if container is not None: prefix += "In the %s" % container if windowLike is not None: prefix += " of the %s, " % windowLike else: prefix += ", " action = action[0].lower() + action[1:] _oldParents = newParents _actionBuffer += prefix + action + ' ' print 'Action:', prefix + action # after each action, reset the watchdog timeout watchdog.resetTimeout() def expectedResult(expectedResult): ''' Log an expected result, e.g., The dialog closes Multiple calls to expectedResult() (without a call to action() in between) will cause the message from each call to be concatenated to the message from previous calls. ''' global _expectedResultBuffer _expectedResultBuffer += expectedResult + ' ' print 'Expected result:', expectedResult def _flushBuffers(): ''' Append (_actionBuffer, _expectedResultBuffer) to the _procedures list, then reset _actionBuffer and _expectedResultBuffer After a call to expectedResult() and before the next call to action(), (after an action/expectedResult pair), we want to append the pair to the _procedures list and possibly take a screenshot. ''' global _actionBuffer global _expectedResultBuffer if _actionBuffer and _expectedResultBuffer: if config.TAKE_SCREENSHOTS: filename = 'screen%02d.png' % (len(_procedures) + 1) utils.takeScreenshot(os.path.join(config.OUTPUT_DIR, filename)) print 'Screenshot:', filename _procedures.append((_actionBuffer.rstrip(), _expectedResultBuffer.rstrip(), filename)) else: _procedures.append((_actionBuffer.rstrip(), _expectedResultBuffer.rstrip())) _actionBuffer = '' _expectedResultBuffer = '' print '' def save(): 'Save logged actions and expected results to an XML file' global _expectedResultBuffer try: _expectedResultBuffer += ''.join(traceback.format_exception(sys.last_type, sys.last_value, sys.last_traceback)) except AttributeError: # sys.last_* may not be defined if there was no unhandled exception pass _flushBuffers() root = ET.Element('test') ET.SubElement(root, 'name').text = testName ET.SubElement(root, 'description').text = testDescription parameters = ET.SubElement(root, 'parameters') # FIXME: replace with a general YAML => XML function environments = ET.SubElement(parameters, 'environments') if testParameters.has_key('Environments'): for e in testParameters['Environments']: environment = ET.SubElement(environments, 'environment') for key, value in e.items(): if type(value) == type(datetime.date(2000, 1, 1)): value = value.ctime() ET.SubElement(environment, key.lower()).text = value procedures = ET.SubElement(root, 'procedures') for p in _procedures: step = ET.SubElement(procedures, 'step') ET.SubElement(step, 'action' ).text = p[0] ET.SubElement(step, 'expectedResult').text = p[1] if config.TAKE_SCREENSHOTS: ET.SubElement(step, 'screenshot').text = p[2] assert os.path.isdir(config.OUTPUT_DIR) file = open(os.path.join(config.OUTPUT_DIR, 'procedures.xml'), 'w') file.write('') file.write('') ET.ElementTree(root).write(file) file.close() def _getTestInfo(): "Inspect the file being executed to determine the test's name, description, and parameters" name = '' try: name = utils.getBasenameWithoutExtension(sys.modules['__main__'].__file__) except AttributeError: pass desc = '' therest = None try: # try parsing the test script's docblock assuming it is in the form: # """ # Test description # # YAML tags # """ desc, therest = sys.modules['__main__'].__doc__.split('\n\n', 1) desc = desc.lstrip() except Exception: try: # try parsing the test script's docblock assuming it is in the form: # """Test description""" desc = sys.modules['__main__'].__doc__.lstrip() except Exception: pass if desc is None: # how does this happen? desc = '' parameters = {} if therest: try: parameters = yaml.load(therest) except NameError: pass return (name, desc, parameters) testName, testDescription, testParameters = _getTestInfo() if not os.path.isdir(config.OUTPUT_DIR): os.mkdir(config.OUTPUT_DIR) if testName != '': print testName + ':', testDescription # prevent reference errors at exit def _cleanup(): global _oldParents del _oldParents atexit.register(_cleanup) atexit.register(save) strongwind-0.9/strongwind/cache.py0000644000175000017500000002101010707045357015533 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # ''' Application and widget cache Caches are typically used to increase performance, but the application and widget caches in this module do not improve performance (in fact, there is a slight performance penalty). The reason we cache applications is so that we can resolve a single instance of a strongwind.accessible.Application object (or subclass) associated with an application id. Consider the following example: we launch gcalctool, then immediately create an instance of an application wrapper, gcalctool.Gcalctool, which extends strongwind.accessibles.Application. Later in the test, one of the widgets calls its getApplication() method, hoping to receive an instance of the galctool.Gcacltool, but instead receives a new instance of strongwind.accessibles.Application. Calls to methods and properties defined in galctool.Gcacltool but not in strongwind.accessibles.Application will fail. With the application cache, when we first create the instance of the application wrapper, we cache that object. Later, the widget can call getApplication(), then look up the resulting strongwind.accessibles.Application's id in the application cache to get a handle to the cached gcalctool.Gcalctool object. The widget cache exists for similar reasons. ''' import os import pyatspi import re import subprocess import weakref import atexit from time import sleep import config import errors import accessibles import procedurelogger import utils _desktop = accessibles.Desktop(pyatspi.Registry.getDesktop(0)) _applications = weakref.WeakValueDictionary() _widgets = {} def addWidget(widget): ''' Add a strongwind.accessibles.Accessible (or a subclass) to the widget cache If a widget with the same key has already been added, a subsequent call to this method will replace the previous widget in the cache. The key is comprised of the widget's role, the widget's name, and the hash of the widget's _accessible. Since the widget's name is part of the key, if a widget is re-used in an application but it changes names, the cache will treat the widget as a different widget. ''' if not isinstance(widget, accessibles.Accessible): raise TypeError, "Cannot add %s instance to the widget cache" % widget.__class__.__name__ key = (widget._accessible.getRole(), widget._accessible.name, hash(widget._accessible)) if _widgets.has_key(key): del _widgets[key] _widgets[key] = widget def getWidget(widget): ''' Retrieve a widget from the widget cache If this method is called with a dead widget, an exception will be raised. A widget is considered dead if its parent is None. ''' if isinstance(widget, pyatspi.Accessibility.Accessible): accessible = widget elif isinstance(widget, accessibles.Accessible): accessible = widget._accessible else: raise KeyError key = (accessible.getRole(), accessible.name, hash(accessible)) if _widgets.has_key(key): # make sure the widget is still alive if _widgets[key]._accessible.parent is None: del _widgets[key] return _widgets[key] def addApplication(app): ''' Add a strongwind.accessibles.Application (or a subclass) to the application cache If an application with the same id has already been added, a subsequent call to this method will replace the previous application in the cache. ''' if not isinstance(app, accessibles.Application): raise TypeError, "Cannot add %s instance to the application cache" % app.__class__.__name__ # if this application already exists in the cache, remove it first if _applications.has_key(app.id): del _applications[app.id] _applications[app.id] = app def getApplicationById(id): ''' Retrieve an application from the application cache If this method is called with the id of a closed application, an exception will be raised. An application is considered closed if querying for its id results in a COMM_FAILURE exception. ''' if _applications.has_key(id): try: # poke the application first to make sure it's not stale _applications[id]._accessible.id except (LookupError, pyatspi.ORBit.CORBA.COMM_FAILURE): del _applications[id] return _applications[id] def getApplicationsList(): ''' Returns all of the applications in the application cache Closed applications are pruned from the cache before returning the contents of the cache. An application is considered closed if querying for its id results in a COMM_FAILURE exception. ''' for k,v in _applications.items(): try: # poke each application in the cache and remove stale applications v._accessible.id except (LookupError, pyatspi.ORBit.CORBA.COMM_FAILURE): del _applications[k] return _applications.values() def launchApplication(args=[], name=None, find=None, cwd=None, env=None, wait=config.MEDIUM_DELAY, cache=True, logString=None): ''' Launch an application with accessibility enabled Returns a tuple containing a strongwind.accessibles.Application object and a Popen object. ''' # if a name for the application is not specified, try to guess it if name is None: name = utils.getBasenameWithoutExtension(args[0]) if logString is None: logString = 'Launch %s.' % name procedurelogger.action(logString) if env is None: env = os.environ # enable accessibility for this application if not env.has_key('GTK_MODULES'): env['GTK_MODULES'] = 'gail:atk-bridge' if find is None: find = re.compile('^' + name) if cwd is None: cwd = os.getcwd() def findAppWithLargestId(desktop, find): ''' Find the application with the largest id whose name matches find If ids are not recycled (i.e., ids always increment and never start over again at 1), the application with the highest id will be the last launched. We're making this assumption. ''' appWithLargestId = None apps = utils.findAllDescendants(desktop, lambda x: pyatspi.ROLE_APPLICATION == x.role and find.search(x.name), False) if len(apps) > 0: appWithLargestId = apps[0] for a in apps: if a._accessible.id > appWithLargestId._accessible.id: appWithLargestId = a return appWithLargestId # before we launch the application, check to see if there is another # instance of the application already open existingApp = findAppWithLargestId(_desktop, find) # launch the application subproc = subprocess.Popen(args, cwd=cwd, env=env) # wait for the application to launch and for the applications list to # settle. if we try to list the desktop's applications too soon, we get # crashes sometimes. sleep(wait) def findNewApplication(): ''' Find the application we just launched If there is an existing application, make sure the app we find here has an id larger than the existing application. If no application is found, wait and retry a number of times before returning None. ''' for i in xrange(config.RETRY_TIMES): app = findAppWithLargestId(_desktop, find) try: if existingApp is None or existingApp.id < app.id: return app except (LookupError, pyatspi.ORBit.CORBA.COMM_FAILURE): return app sleep(config.RETRY_INTERVAL) raise errors.SearchError app = findNewApplication() if cache: addApplication(app) return (app, subproc) # prevent reference errors at exit def _cleanup(): global _desktop del _desktop _widgets.clear() _applications.clear() atexit.register(_cleanup) strongwind-0.9/strongwind/utils.py0000644000175000017500000001232410706217561015635 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 'Utility functions' import os import re from time import sleep import pyatspi import config import errors import cache def getBasenameWithoutExtension(path): 'Takes a path like "/tmp/testscript.py" and returns "testscript"' dir, file = os.path.split(path) base, ext = os.path.splitext(file) return base def toClassName(str): 'Takes a string like "push button" or "Patient Select" and returns "PushButton" or "PatientSelect"' regex = re.compile('^[0-9]') if str.isalnum(): name = str.capitalize() else: name = '' for word in re.split('[^a-zA-Z0-9]', str): name = name + word.capitalize() if regex.search(name): name = '_' + name return name def toVarName(str): 'Takes a string like "push button" or "Patient Select" and returns "pushButton" or "patientSelect"' regex = re.compile('^[0-9]') if str.isalnum(): name = str.lower() else: words = re.split('[^a-zA-Z0-9]', str) name = words[0].lower() for word in words[1:]: name = name + word.capitalize() if regex.search(name): name = '_' + name return name def toConstantName(str): 'Takes a string like "pushButton" and returns "PUSH_BUTTON"' name = '' for c in str: if c.isupper(): name += '_' name += c.upper() return name def equalsOrMatches(str, strOrRegex): 'Returns True if str is equal to or matches strOrRegex, or if strOrRegex is None' if strOrRegex is None: return True if type(strOrRegex) is type(re.compile('r')): return strOrRegex.search(str) return str == strOrRegex def retryUntilTrue(func, args=[], kargs={}): 'Executes func until either func returns true or the maximum number of tries is exceeded' for i in xrange(config.RETRY_TIMES): if func(*args,**kargs): return True sleep(config.RETRY_INTERVAL) return False def findDescendant(acc, pred, retry=True, recursive=True, breadthFirst=True, raiseException=True): ''' Returns the first descendant of acc matching pred If multiple descendants match the predicate, which descendant is returned depends on the search order, which can be specified by setting breadthFirst to False. If no descendants matching the predicate is found and raiseException is True, a SearchError execption is raised. If raiseException is False, None is returned. ''' tries = (1, config.RETRY_TIMES)[retry] for i in xrange(tries): if recursive: if breadthFirst: ret = pyatspi.utils._findDescendantBreadth(acc, pred) if ret is not None: return ret else: for child in acc: try: ret = pyatspi.utils._findDescendantDepth(child, pred) except Exception: ret = None #raise if ret is not None: return ret else: for child in acc: try: if pred(child): return child except Exception: continue #raise if tries > 1: sleep(config.RETRY_INTERVAL) if raiseException: raise errors.SearchError return None def findAllDescendants(acc, pred, recursive=True): 'Returns all descendants of acc matching pred' matches = [] for child in acc: if pred(child): matches.append(child) if recursive: matches = matches + findAllDescendants(child, pred, recursive) return matches def takeScreenshot(path): 'Takes a screenshot of the desktop' import os.path import gtk.gdk import gobject # pause before taking screenshots, otherwise we get half-drawn widgets sleep(config.SCREENSHOT_DELAY) assert os.path.isdir(os.path.dirname(path)) fileExt = os.path.splitext(path)[1][1:] rootWindow = gtk.gdk.get_default_root_window() geometry = rootWindow.get_geometry() pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, geometry[2], geometry[3]) gtk.gdk.Pixbuf.get_from_drawable(pixbuf, rootWindow, rootWindow.get_colormap(), 0, 0, 0, 0, geometry[2], geometry[3]) # gtk.gdk.Pixbuf.save() needs 'jpeg' and not 'jpg' if fileExt == 'jpg': fileExt = 'jpeg' try: pixbuf.save(path, fileExt) except gobject.GError: raise ValueError, "Failed to save screenshot in %s format" % fileExt assert os.path.exists(path) strongwind-0.9/strongwind/config.py0000644000175000017500000000302210706217561015735 0ustar jonjon# -*- coding: utf-8 -*- # # Strongwind # Copyright (C) 2007 Medsphere Systems Corporation # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 2 as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 'Strongwind configuration' # where to write procedure logger output, screenshots, etc. OUTPUT_DIR = '/tmp/strongwind' # if a widget is not found in a search, how many times should we try the search again RETRY_TIMES = 20 # how long to wait between retries RETRY_INTERVAL = 0.5 # whether or not to take screenshots TAKE_SCREENSHOTS = True # how long to wait before taking a screenshot; sometimes apps need some time to finish rendering SCREENSHOT_DELAY = 0.5 # how long to wait between keystrokes KEYCOMBO_DELAY = 0.1 # these values are used throughout strongwind. lower values will cause test # scripts to complete sooner, but may result in random application crashes or # random failed tests SHORT_DELAY = 0.5 MEDIUM_DELAY = 4 LONG_DELAY = 10 # see resetTimeout() in watchdog.py WATCHDOG_TIMEOUT = 180 strongwind-0.9/ChangeLog0000644000175000017500000000353710707753076013514 0ustar jonjon2007-10-24 Brad Taylor * resources/procedures.xsl: Make the Strongwind logo a link to Strongwind's project page. 2007-10-24 Brad Taylor * AUTHORS: * resources/procedures.xsl: * resources/strongwind.png: * resources/strongwind.svg: Add Strongwind's logo, drawn by Andreas Nilsson . 2007-10-24 Jonathan Tai * strongwind/__init__.py: import procedurelogger as procedurelogger, not as procedures * strongwind/procedurelogger.py: * examples/gcalctool/calculatorframe.py: updates to reflect procedurelogger => procedures change * strongwind/watchdog.py: add documentation from the tutorial I'm writing 2007-10-23 Jonathan Tai * strongwind/accessibles.py: fix a LookupError that can occur when test scripts exit * examples/gcalctool-bug-488226.py: add a test for GNOME bugzilla bug #488226 * examples/gcalctool/calculatorframe.py: (CalculatorFrame.changeMode): don't try to guess if the Change Mode dialog will appear or not; let the test specify whether or not it's expecting the dialog * examples/gcalctool-changing-modes.py: take advantage of changes in app wrapper 2007-10-22 Jonathan Tai * strongwind/accessibles.py: (PageTab): change the behavior of select() and findPageTab() to be more in line with what other classes do (Text): remove commented-out __str__() function * strongwind/accessibles.py: * strongwind/watchdog.py: * strongwind/cache.py: replace tabs with 8 spaces in a few spots where tabs snuck in * resources: add a resources folder with sample XSL and CSS for viewing XML test results * AUTHORS: add an AUTHORS file to give credit to Bailey Kong and Raul Jimenez * Take over maintainership of Strongwind 2007-10-19 Brad Taylor * Initial import strongwind-0.9/examples/0000755000175000017500000000000010707757223013546 5ustar jonjonstrongwind-0.9/examples/gcalctool-bug-488226.py0000755000175000017500000000236610707472777017437 0ustar jonjon#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test for bugzilla bug #488226 """ from strongwind import * from gcalctool import * app = launchGcalctool() app.calculatorFrame.changeMode('Basic') app.calculatorFrame.findPushButton('Numeric 8').click() sleep(config.SHORT_DELAY) app.calculatorFrame.changeMode('Advanced', assertModeChanged=False) # handle the Change Mode dialog ourselves... dialog = app.findDialog(None, logName='Changing Modes Clears Calculation') procedurelogger.action('Press Esc.') dialog.keyCombo('Esc') dialog.assertClosed() del dialog procedurelogger.expectedResult('The mode does not change and the result region still displays 8.') def modeUnchanged(): return app.calculatorFrame.menuBar.findMenu('View').findCheckMenuItem('Basic').checked and app.calculatorFrame.resultRegion.text == '8' assert retryUntilTrue(modeUnchanged) procedurelogger.expectedResult('NOTE: In bugzilla bug #488226, Advanced mode is selected in the View menu, although gcalctool remains in Basic mode.') # check that we can still change to other modes app.calculatorFrame.changeMode('Financial', expectChangeModeDialog=True) procedurelogger.expectedResult('NOTE: In bugzilla bug #488226, gcalctool remains in Basic mode.') app.calculatorFrame.quit() strongwind-0.9/examples/gcalctool-changing-modes.py0000755000175000017500000000166510707472777020773 0ustar jonjon#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test changing modes (Basic, Advanced, Financial, Scientific) """ from strongwind import * from gcalctool import * app = launchGcalctool() app.calculatorFrame.changeMode('Basic') app.calculatorFrame.changeMode('Advanced') app.calculatorFrame.changeMode('Financial') app.calculatorFrame.changeMode('Scientific') app.calculatorFrame.changeMode('Basic') app.calculatorFrame.findPushButton('Numeric 1').click() app.calculatorFrame.changeMode('Advanced', expectChangeModeDialog=True) app.calculatorFrame.findPushButton('Numeric 2').click() app.calculatorFrame.changeMode('Financial', expectChangeModeDialog=True) app.calculatorFrame.findPushButton('Numeric 3').click() app.calculatorFrame.changeMode('Scientific', expectChangeModeDialog=True) app.calculatorFrame.findPushButton('Numeric 4').click() app.calculatorFrame.changeMode('Basic', expectChangeModeDialog=True) app.calculatorFrame.quit() strongwind-0.9/examples/gcalctool/0000755000175000017500000000000010707757223015515 5ustar jonjonstrongwind-0.9/examples/gcalctool/__init__.py0000644000175000017500000000236310707472777017642 0ustar jonjon# -*- coding: utf-8 -*- 'Application wrapper for gcalctool' from strongwind import * import os def launchGcalctool(exe=None): 'Launch gcalctool with accessibility enabled and return a Gcalctool object' if exe is None: exe = '/usr/bin/gcalctool' args = [exe] (app, subproc) = cache.launchApplication(args=args) gcalctool = Gcalctool(app, subproc) cache.addApplication(gcalctool) # calculatorFrame's assertClosed() calls self.app.assertClosed(), but if the # app has closed already, self.app will return None. Normally, we would # cache self.app in the constructor of the calculatorFrame class, but at the # time the calculatorFrame's constructor is run, cache.getApplication(self._app_id) # resolves to an accessible.Application(). We promote the application to # a Gcalctool object here, so we must set calculatorFrame.app immediately # afterward. gcalctool.calculatorFrame.app = gcalctool return gcalctool class Gcalctool(accessibles.Application): def __init__(self, accessible, subproc=None): 'Get a reference to the calculator window' super(Gcalctool, self).__init__(accessible, subproc) self.findFrame(re.compile('^Calculator'), logName='Calculator') strongwind-0.9/examples/gcalctool/calculatorframe.py0000644000175000017500000000354110707601273021227 0ustar jonjon# -*- coding: utf-8 -*- from strongwind import * from gcalctool import * class CalculatorFrame(accessibles.Frame): logName = 'Calculator' def __init__(self, accessible): super(CalculatorFrame, self).__init__(accessible) # get a reference to commonly-used child widgets self.menuBar = self.findMenuBar('') self.resultRegion = self.findEditbar('') def assertResult(self, result): 'Raise an exception if the result region does not match the given result' procedurelogger.expectedResult('The result region displays %s.' % result) def resultMatches(): return self.resultRegion.text == str(result) assert retryUntilTrue(resultMatches) def changeMode(self, mode, expectChangeModeDialog=False, assertModeChanged=True): ''' Change the mode Mode can be one of: Basic, Advanced, Financial, or Scientific. ''' if expectChangeModeDialog: sleep(config.SHORT_DELAY) self.menuBar.select(['View', mode]) if expectChangeModeDialog: self.app.findDialog(None, logName='Changing Modes Clears Calculation')._clickPushButton('Change Mode') if assertModeChanged: procedurelogger.expectedResult('The mode changes to %s mode and the result region displays 0.' % mode) def modeChanged(): return self.menuBar.findMenu('View').findCheckMenuItem(mode).checked and self.resultRegion.text == '0' assert retryUntilTrue(modeChanged) def quit(self): 'Quit gcalctool' self.menuBar.select(['Calculator', 'Quit']) self.assertClosed() def assertClosed(self): super(CalculatorFrame, self).assertClosed() # if the calculator window closes, the entire app should close. assert that this is true self.app.assertClosed() strongwind-0.9/examples/gcalctool-basic-ops.py0000755000175000017500000000323110706217561017742 0ustar jonjon#!/usr/bin/env python # -*- coding: utf-8 -*- """ Exercise basic operations """ from strongwind import * from gcalctool import * app = launchGcalctool() app.calculatorFrame.assertResult(0) app.calculatorFrame.changeMode('Basic') app.calculatorFrame.findPushButton('Numeric 2').click() app.calculatorFrame.findPushButton('Add').click() app.calculatorFrame.findPushButton(re.compile('^Numeric 4')).click() app.calculatorFrame.assertResult('2+4') app.calculatorFrame.findPushButton('Calculate result').click() app.calculatorFrame.assertResult(6) app.calculatorFrame.findPushButton('Divide').click() app.calculatorFrame.findPushButton('Numeric 3').click() app.calculatorFrame.assertResult('6/3') app.calculatorFrame.findPushButton('Calculate result').click() app.calculatorFrame.assertResult(2) app.calculatorFrame.findPushButton('Change sign [c]').click() app.calculatorFrame.assertResult('-(2)') app.calculatorFrame.findPushButton('Multiply').click() app.calculatorFrame.findPushButton('Numeric 3').click() app.calculatorFrame.assertResult('-(2)*3') app.calculatorFrame.findPushButton('Backspace').click() app.calculatorFrame.findPushButton('Numeric 7').click() app.calculatorFrame.assertResult('-(2)*7') app.calculatorFrame.findPushButton('Calculate result').click() app.calculatorFrame.assertResult(-14) app.calculatorFrame.findPushButton('Subtract').click() app.calculatorFrame.findPushButton('Numeric 6').click() app.calculatorFrame.assertResult('-14-6') app.calculatorFrame.findPushButton('Calculate result').click() app.calculatorFrame.assertResult(-20) app.calculatorFrame.findPushButton('Clear').click() app.calculatorFrame.assertResult(0) app.calculatorFrame.quit() strongwind-0.9/setup.py0000755000175000017500000000144110706217561013440 0ustar jonjon#!/usr/bin/env python """ Strongwind is a GUI test automation framework inspired by dogtail. Strongwind is object-oriented and extensible. You can use Strongwind to build object-oriented representations of your applications ("application wrappers"), then reuse the application wrappers to quickly develop many test scripts. Strongwind scripts generate a human-readable log that contains the action, expected result and a screen shot of each step. Most simple actions are logged automatically. """ from distutils.core import setup setup(name='Strongwind', version='0.9', description='GUI Test Automation Framework', author='Jonathan Tai', author_email='jon@tgpsolutions.com', url='http://www.medsphere.org/projects/strongwind/', packages=['strongwind'], )