~ubuntu-branches/ubuntu/vivid/mago/vivid

« back to all changes in this revision

Viewing changes to mago/test_suite/gnome.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2010-10-18 16:08:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101018160842-6euef3m6mqxjlcai
Tags: 0.3-0ubuntu1
* New upstream release:
  + Added i18n support
  + Tests working on Maverick 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""
2
 
gnome module contains the definition of the test suites used for gnome
3
 
applications
4
 
"""
5
 
import ldtp, ooldtp
6
 
from .main import SingleApplicationTestSuite
7
 
from ..application.gnome import Application, Seahorse, GEdit, GnomeScreenshot, Calculator
8
 
 
9
 
class GCalctoolTestSuite(SingleApplicationTestSuite):
10
 
    """
11
 
    Default test suite for Calculator
12
 
    """
13
 
    APPLICATION_FACTORY = Calculator
14
 
    def setup(self):
15
 
        self.application.open()
16
 
        self.application.push("C")
17
 
 
18
 
    def teardown(self):
19
 
        self.application.close()
20
 
    
21
 
    def cleanup(self):
22
 
        pass
23
 
 
24
 
class GCalctoolViewTestSuite(GCalctoolTestSuite):
25
 
    """
26
 
    Test suite for views populates the screen with some data in setup
27
 
    """
28
 
    def setup(self):
29
 
        GCalctoolTestSuite.setup(self)
30
 
        self.application.push("13.37")   
31
 
 
32
 
class GnomeScreenshotTestSuite(SingleApplicationTestSuite):
33
 
    APPLICATION_FACTORY = GnomeScreenshot   
34
 
 
35
 
class SeahorseTestSuite(SingleApplicationTestSuite):
36
 
    """
37
 
    Default test suite for Seahorse
38
 
    """
39
 
    APPLICATION_FACTORY = Seahorse
40
 
    def setup(self):
41
 
        self.application.open()
42
 
 
43
 
    def teardown(self):
44
 
        self.application.close()
45
 
 
46
 
    def cleanup(self):
47
 
        #TODO: it should delete all the "My Personal Keys"
48
 
        pass
49
 
 
50
 
 
51
 
class GEditTestSuite(SingleApplicationTestSuite):
52
 
    """
53
 
    Default test suite for GEdit
54
 
    """
55
 
    APPLICATION_FACTORY = GEdit
56
 
    def setup(self):
57
 
        self.application.open()
58
 
 
59
 
    def teardown(self):
60
 
        self.application.close()
61
 
 
62
 
    def cleanup(self):
63
 
        # Exit using the Quit menu 
64
 
        try:
65
 
            try:
66
 
                gedit = ooldtp.context(self.application.name)
67
 
                quit_menu = gedit.getchild(self.application.MNU_CLOSE)
68
 
            except ldtp.LdtpExecutionError:
69
 
                raise ldtp.LdtpExecutionError, "The quit menu was not found."
70
 
            quit_menu.selectmenuitem()
71
 
        except ldtp.LdtpExecutionError:
72
 
            raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application."
73
 
 
74
 
        result = ldtp.waittillguiexist(self.application.QUESTION_DLG,
75
 
                                       guiTimeOut = 2)
76
 
 
77
 
        if result == 1:
78
 
            question_dialog = ooldtp.context(self.application.QUESTION_DLG)
79
 
            question_dlg_btn_close = question_dialog.getchild(self.application.QUESTION_DLG_BTN_CLOSE)
80
 
            question_dlg_btn_close.click()
81
 
        
82
 
        try:
83
 
            gedit = ooldtp.context(self.application.name)
84
 
            new_menu = gedit.getchild(self.application.MNU_NEW)
85
 
        except ldtp.LdtpExecutionError:
86
 
            raise ldtp.LdtpExecutionError, "The new menu was not found."
87
 
        new_menu.selectmenuitem()
88
 
 
89
 
        result = ldtp.waittillguiexist(
90
 
            self.application.name, self.application.TXT_FIELD)
91
 
        if result != 1:
92
 
            raise ldtp.LdtpExecutionError, "Failed to set up new document."