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