src/tests/gui/t_pm_install.py
changeset 2991 75e616731cc3
parent 2990 2cc6693a7d83
child 2992 e48a94cff862
equal deleted inserted replaced
2990:2cc6693a7d83 2991:75e616731cc3
     1 #!/usr/bin/python
       
     2 #
       
     3 # CDDL HEADER START
       
     4 #
       
     5 # The contents of this file are subject to the terms of the
       
     6 # Common Development and Distribution License (the "License").
       
     7 # You may not use this file except in compliance with the License.
       
     8 #
       
     9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
    10 # or http://www.opensolaris.org/os/licensing.
       
    11 # See the License for the specific language governing permissions
       
    12 # and limitations under the License.
       
    13 #
       
    14 # When distributing Covered Code, include this CDDL HEADER in each
       
    15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    16 # If applicable, add the following below this CDDL HEADER, with the
       
    17 # fields enclosed by brackets "[]" replaced with your own identifying
       
    18 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    19 #
       
    20 # CDDL HEADER END
       
    21 #
       
    22 
       
    23 # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
       
    24 
       
    25 import testutils
       
    26 if __name__ == "__main__":
       
    27         testutils.setup_environment("../../../proto")
       
    28 import pkg5unittest
       
    29 import unittest
       
    30 
       
    31 try:
       
    32         import ldtp
       
    33         import ldtputils
       
    34         if not "getmin" in dir(ldtp):
       
    35             raise ImportError
       
    36 except ImportError:
       
    37         raise ImportError, "ldtp 2.X package not installed."
       
    38 
       
    39 class TestPkgGuiInstallBasics(pkg5unittest.SingleDepotTestCase):
       
    40 
       
    41         # pygtk requires unicode as the default encoding.
       
    42         default_utf8 = True
       
    43 
       
    44         foo10 = """
       
    45             open [email protected],5.11-0
       
    46             add set name="description" value="Some package1 description"
       
    47             close """
       
    48 
       
    49         def setUp(self):
       
    50                 pkg5unittest.SingleDepotTestCase.setUp(self)
       
    51 
       
    52         def tearDown(self):
       
    53                 pkg5unittest.SingleDepotTestCase.tearDown(self)
       
    54 
       
    55         def testInstallSimplePackage(self):
       
    56                 pkgname = 'package1'
       
    57                 pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
       
    58 
       
    59                 self.pkgsend_bulk(self.rurl, self.foo10)
       
    60                 self.image_create(self.rurl)
       
    61 
       
    62                 ldtp.launchapp(pm_str,["-R", self.get_img_path()])
       
    63                 ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
       
    64                 ldtp.selectindex('Package Manager', 'Publisher', 0)
       
    65                 ldtp.selectrow('Package Manager', 'Packages', pkgname)
       
    66                 ldtp.selectmenuitem('Package Manager', 'mnuEdit;mnuSelect All')
       
    67                 ldtp.click('Package Manager', 'btnInstall/Update')
       
    68                 ldtp.waittillguiexist('dlgInstall Confirmation')
       
    69                 ldtp.click('dlgInstall Confirmation', 'btnProceed')
       
    70 
       
    71                 while (ldtp.objectexist('dlgInstall/Update', 'btnClose') == 0):
       
    72                         ldtp.wait(0.1)
       
    73 
       
    74                 ldtp.click('dlgInstall/Update', 'btnClose')
       
    75 
       
    76                 ldtp.waittillguinotexist('dlgInstall/Update')
       
    77 
       
    78                 # Verify result
       
    79                 self.pkg('verify')
       
    80 
       
    81                 # Quit packagemanager
       
    82                 ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
       
    83                 
       
    84 
       
    85 if __name__ == "__main__":
       
    86 	unittest.main()