1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: extensions.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-09-04 09:15:21 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : thorsten.bosbach@sun.com
36 '* short description : Function test of extension manager
38 '\************************************************************************
40 testcase tExtensionsFunction
42 ' written for CWS jsc7, in master since SRC680m176
43 ' additions for CWS sb63 - Dependency checking with versioning - documents 24-30
44 ' features: - http://specs.openoffice.org/appwide/packagemanager/simple_extension_license.odt
45 ' - http://specs.openoffice.org/appwide/packagemanager/extensiondependencies1.odt
46 '/// The test documents are available at http://qa.openoffice.org/source/browse/qa/qatesttool/framework/basic/input/extensions/ ///'
47 '/// Textdocuments used in this test and expected messages: ///'
48 '/// (1/31): simpleLicense\BadDesc.oxt ///'
49 '/// - BadDesc.oxt/description.xml contains data which cannot be parsed. ///'
50 '/// - will not install ///'
51 '/// (2/31): simpleLicense\BadNamespace.oxt ///'
52 '/// - BadNamespace.oxt/description.xml contains a root element with an unsupported namespace. ///'
53 '/// - will not install ///'
54 '/// (3/31): simpleLicense\BadRoot.oxt ///'
55 '/// - BadRoot.oxt/description.xml does not contain the root element <description>. ///'
56 '/// - will not install ///'
57 '/// (4/31): simpleLicense\IncompAttr1.oxt ///'
58 '/// - ExtensionSoftwareLicenseAgreement dialog exists ///'
59 '/// - installs and is enabled ///'
60 '/// (5/31): simpleLicense\IncompAttr2.oxt ///'
61 '/// - Cannot find a localized license text or a default license text. ///'
62 '/// - will not install ///'
63 '/// (6/31): simpleLicense\LongLic.oxt ///'
64 '/// - ExtensionSoftwareLicenseAgreement dialog exists ///'
65 '/// - It is a Long License ///'
66 '/// - installs and is enabled ///'
67 '/// (7/31): simpleLicense\MissingLic.oxt ///'
68 '/// - MissingLic.oxt\registration\license_en_US.txt does not exist. ///'
69 '/// - will not install ///'
70 '/// (8/31): simpleLicense\MissingLicRef.oxt ///'
71 '/// - Cannot find a localized license text or a default license text. ///'
72 '/// - will not install ///'
73 '/// (9/31): simpleLicense\NoDesc.oxt ///'
74 '/// - installs and is enabled ///'
75 '/// (10/31): simpleLicense\NoLangNoDefault.oxt ///'
76 '/// - Cannot find a localized license text or a default license text. ///'
77 '/// - will not install ///'
78 '/// (11/31): simpleLicense\OnlyDefault.oxt ///'
79 '/// - Cannot find a localized license text or a default license text. ///'
80 '/// - will not install ///'
81 '/// (12/31): simpleLicense\ShortLicense.oxt ///'
82 '/// - ExtensionSoftwareLicenseAgreement dialog exists ///'
83 '/// - installs and is enabled ///'
85 '/// - will not install ///'
86 '/// (14/31): simpleLicense\ShortLicenseShared.oxt ///'
87 '/// - ExtensionSoftwareLicenseAgreement dialog exists ///'
88 '/// - installs and is enabled ///'
89 '/// (15/31): dependencies\broken-dependency.oxt ///'
90 '/// - broken-dependency.oxt/description.xml contains data which cannot be parsed. ///'
91 '/// - will not install ///'
92 '/// (16/31): dependencies\double-dependencies.oxt ///'
93 '/// - UnsatisfiedDependencies dialog exists ///'
94 '/// (1/2): Dependency 1 ///'
95 '/// (2/2): Dependency 2 ///'
96 '/// - will not install ///'
97 '/// (17/31): dependencies\empty-dependencies.oxt ///'
98 '/// - installs and is enabled ///'
99 '/// (18/31): dependencies\funny-dependency.oxt ///'
100 '/// - UnsatisfiedDependencies dialog exists ///'
101 '/// (1/1): & < > ' " > ' tab . crlf ///'
102 '/// . em-dash�;. line-separator?. paragraph-separator?. xxxxxxxxxxx... ///'
103 '/// - will not install ///'
104 '/// (19/31): dependencies\license-dependency.oxt ///'
105 '/// - UnsatisfiedDependencies dialog exists ///'
106 '/// (1/1): Dependency ///'
107 '/// - will not install ///'
108 '/// (20/31): dependencies\many-dependencies.oxt ///'
109 '/// - UnsatisfiedDependencies dialog exists ///'
110 '/// (1/20): Dependency 1 ///'
111 '/// (2/20): Dependency 2 ///'
112 '/// (3/20): Dependency 3 ///'
113 '/// (4/20): Dependency 4 ///'
114 '/// (5/20): Dependency 5 ///'
115 '/// (6/20): Dependency 6 ///'
116 '/// (7/20): Dependency 7 ///'
117 '/// (8/20): Dependency 8 ///'
118 '/// (9/20): Dependency 9 ///'
119 '/// (10/20): Dependency 10 ///'
120 '/// (11/20): Dependency 11 ///'
121 '/// (12/20): Dependency 12 ///'
122 '/// (13/20): Dependency 13 ///'
123 '/// (14/20): Dependency 14 ///'
124 '/// (15/20): Dependency 15 ///'
125 '/// (16/20): Dependency 16 ///'
126 '/// (17/20): Dependency 17 ///'
127 '/// (18/20): Dependency 18 ///'
128 '/// (19/20): Dependency 19 ///'
129 '/// (20/20): Dependency 20 ///'
130 '/// - will not install ///'
131 '/// (21/31): dependencies\no-dependencies.oxt ///'
132 '/// - installs and is enabled ///'
133 '/// (22/31): dependencies\no-description.oxt ///'
134 '/// - installs and is enabled ///'
135 '/// (23/31): dependencies\unknown-dependency.oxt ///'
136 '/// - UnsatisfiedDependencies dialog exists ///'
137 '/// (1/1): Unknown ///'
138 '/// - will not install ///'
139 '/// (24/31): dependencies\version21.oxt ///'
140 '/// - installs and is enabled ///'
141 '/// (25/31): dependencies\version10000.oxt ///'
142 '/// - UnsatisfiedDependencies dialog exists ///'
143 '/// (1/1): Unknown ///'
144 '/// - will not install ///'
145 '/// (26/31): dependencies\version21ns.oxt ///'
146 '/// - installs and is enabled ///'
147 '/// (27/31): dependencies\version21other.oxt ///'
148 '/// - UnsatisfiedDependencies dialog exists ///'
149 '/// (1/1): Unknown ///'
150 '/// - will not install ///'
151 '/// (25/31): dependencies\version25.oxt ///'
152 '/// - installs and is enabled ///'
153 '/// (25/31): dependencies\version30.oxt ///'
154 '/// - installs and is enabled ///'
155 '/// (25/31): dependencies\version31.oxt ///'
156 '/// - UnsatisfiedDependencies dialog exists ///'
157 '/// (1/1): Unknown ///'
158 '/// - will not install ///'
159 '/// (27/31): dependencies\version21other.oxt ///'
160 '/// - UnsatisfiedDependencies dialog exists ///'
161 '/// (1/1): Unknown ///'
162 '/// (30/31): dependencies\versionempty.oxt ///'
163 '/// - installs and is enabled ///'
164 '/// (31/31): dependencies\versionnone.oxt ///'
165 '/// - installs and is enabled ///'
166 '/// (32/41): versions/plain.oxt
167 '/// - installs and is enabled ///'
168 '/// (33/41): versions/plain.oxt
169 '/// - You are about to install version 1.02.4.7.0 of the extension org.openoffice.legacy.plain.oxt. That version is already installed.
170 '/// - installs and is enabled ///'
171 '/// (34/41): versions/version_none/plain.oxt
172 '/// - You are about to install version 0 of the extension org.openoffice.legacy.plain.oxt. The newer version 1.02.4.7.0 is already installed.
173 '/// - installs and is enabled ///'
174 '/// (35/41): versions/version_1.2.3/plain.oxt
175 '/// - You are about to install version 1.2.3 of the extension org.openoffice.legacy.plain.oxt. The older version 0 is already installed.
176 '/// - installs and is enabled ///'
177 '/// (36/41): versions/version_1.2.3/plain.oxt
178 '/// - You are about to install version 1.2.3 of the extension org.openoffice.legacy.plain.oxt. That version is already installed.
179 '/// - installs and is enabled ///'
180 '/// (37/41): versions/version_0.0/plain.oxt
181 '/// - You are about to install version 0.0 of the extension org.openoffice.legacy.plain.oxt. The newer version 1.2.3 is already installed.
182 '/// - installs and is enabled ///'
183 '/// (38/41): versions/version_1.2.4.7/plain.oxt
184 '/// - You are about to install version 1.2.4.7 of the extension org.openoffice.legacy.plain.oxt. The older version 0.0 is already installed.
185 '/// - installs and is enabled ///'
186 '/// (39/41): versions/version_1.02.4.7.0/plain.oxt
187 '/// - You are about to install version 1.02.4.7.0 of the extension org.openoffice.legacy.plain.oxt. That version is already installed.
188 '/// - installs and is enabled ///'
189 '/// (40/41): versions/version_1.2.3/plain.oxt
190 '/// - You are about to install version 1.2.3 of the extension org.openoffice.legacy.plain.oxt. The newer version 1.02.4.7.0 is already installed.
191 '/// - installs and is enabled ///'
192 '/// (41/41): versions/version_1.2.15.3/plain.oxt
193 '/// - You are about to install version 1.2.15.3 of the extension org.openoffice.legacy.plain.oxt. The older version 1.2.3 is already installed.
195 dim j,b,i,a,x,y as integer
197 dim aFiles(50) as string
198 dim aFeatures(50) as string
199 dim aFileList(50) as string
206 dim sFirstStatus as string
207 dim bFound as boolean
208 dim aRemovePackages(50) as string
209 dim bFoundNumber as boolean
210 dim sLastVersion as string
213 ' want to start and work with just one document window
218 ' load about twenty one extension files, to test the features
219 ' the list tells the filename and in encoded numbers the features
221 ' simpleLicense\LongLic.oxt;0,2,1,0
222 ' - the filename and the features are seperated by a semicolon
223 ' - the numbes for the features are seperated by colons
224 ' 1st number: Unsatisfied dependencies; if there are any, the number counts them; if there are none it is zero and the dialog won't come up
225 ' 2nd number: License; if there is one the value is 1; it it a long one, where the scroll button needs to be used it is 2; 3 if the license should not be accepted for testing purposes, if there is no license the value is zero
226 ' 3rd number: If the extension should successfully install the value is one, else zero.
227 ' 4th number: If an active is expected after selecting a file for installation the value is one, else zero.
228 ' 5th number: If active is expected the expected version information after selecting a file for installation the value is one, else zero and if an upgrade/downgrade is expected, the number is 2.
230 ' Base path for test files
231 sPath = convertPath(gTestToolPath+"extensions/optional/input/")
232 ' read filelist and expected features
233 ListRead(aFileList(), sPath+"files.txt")
234 a = listCount(aFileList())
237 aTemp = split (aFileList(i),";")
238 if uBound(aTemp()) >0 then
239 listAppend(aFiles(),aTemp(0))
240 listAppend(aFeatures(),aTemp(1))
244 ' there are some dependencys to languages...
245 if iSprache = 49 then
247 aFeatures(4) = aFeatures(5)
250 if iSprache <> 01 then
251 aFeatures(4) = aFeatures(5)
252 aFeatures(6) = aFeatures(5)
253 aFeatures(12) = aFeatures(5)
254 aFeatures(13) = aFeatures(5)
255 aFeatures(14) = aFeatures(5)
258 ' cleanup before starting; check that no extension from the list is installed right now; if remove it.
259 '/// Before starting, look into extension manager, if already a file is installed, that will be used in this test ///'
261 a = listCount(aFiles())
264 kontext "PackageManager"
265 If PackageManager.exists(10) then
266 BrowsePackages.typeKeys("<home>")
268 while (ii < BrowsePackages.getItemCount+1 )
269 kontext "PackageManager"
270 'BrowsePackages.typeKeys("+")
271 'BrowsePackages.typeKeys("<down>")
272 BrowsePackages.select ii
273 sTemp = BrowsePackages.getItemText (ii,1)
274 if right(sTemp,3) = "oxt" then
277 aTemp = split(sTemp3,"\")
278 if uBound(aTemp) < 1 then
279 aTemp = split(sTemp3,"/")
281 sTemp3 = aTemp(uBound(aTemp))
282 if sTemp = sTemp3 then
283 qaErrorLog "Package is already installed, trying to remove it: '" + sTemp + "'"
284 if remove.isEnabled then
288 if ( Active.exists( 2 ) ) then
291 warnlog( "No confirmation dialog for Extension removal" )
294 Kontext "AddingPackages"
296 while AddingPackages.exists(1) AND (y<30)
297 printlog "RemovingPackages..."
301 kontext "PackageManager"
302 BrowsePackages.typeKeys("<up>")
305 warnlog "Package is already installed and can't get removed: '" + sTemp + "'"
318 kontext "PackageManager"
323 ' for every test file do...
324 a = listCount(aFiles())
326 printlog "********** Test file ("+i+"/"+a+"): "+aFiles(i)
327 aTemp = split (aFeatures(i),",")
328 '/// call Tools - Package/Extension manager ///'
330 kontext "PackageManager"
331 If PackageManager.exists(10) then
332 '/// going to top of package list and explode every line, until the button 'Add' is enabled ///'
333 '/// should be 'My Packages' ///'
334 'BrowsePackages.typeKeys("<home>")
335 'sTemp = BrowsePackages.getSelText
337 'while (Not Add.isEnabled AND (sTemp <> sTemp2))
338 ' BrowsePackages.typeKeys("+")
339 ' BrowsePackages.typeKeys("<down>")
341 ' sTemp = BrowsePackages.getSelText
343 'if sTemp = sTemp2 then
344 ' warnlog "Couldn't find a way to enable the Add button - aborting"
347 'printlog BrowsePackages.getSelText
348 '/// click button 'Add' ///'
352 warnlog "#i90870# extension manager deadlock/C++ runtimes"
355 kontext "PackageManager"
358 '/// Add Package(s)... dialg comes up ///'
360 if OeffnenDlg.exists(5) then
361 '/// put filename into field ///'
362 Dateiname.setText convertPath(sPath + aFiles(i))
363 printlog DateiTyp.getSelText
364 '/// press button 'Open' ///'
367 warnlog "Add Package(s)... dialog didn't came up"
370 'Asking for whom to install; All: YES, Me: NO, nobody: Cancel
372 if active.exists(5) then
373 sTemp = active.getText
377 warnlog( "Try...catch: Failed to click Yes-button" )
381 '/// Progress dialog comes up ///'
382 Kontext "AddingPackages"
383 if AddingPackages.exists(1) then
384 printlog " - AddingPackages dialog exists"
385 'DialogTest(AddingPackages)
388 '/// If any error happens, an active comes up, telling what is wrong ///'
389 ' error is just a dialog with one button
390 ' version infos have two buttons
392 if active.exists(5) then
393 sTemp = active.getText
394 select case active.getbuttoncount
396 y = instr(sTemp, " ")
397 if cBool(aTemp(3)) then
404 if cBool(aTemp(4)) then
405 printlog "Version info message available."
407 warnlog "Version info message available, but not expected"
411 aTemp2 = split(sTemp," ")
413 while ((NOT bFoundNumber) AND (x < y))
414 stemp2 = left(aTemp2(x),1)
415 if isNumeric(stemp2) then
417 printlog "Try to install version: " + aTemp2(x)
421 if NOT bFoundNumber then
422 warnlog "No version was mentioned in the version message!"
425 while (NOT bFoundNumber AND x < y)
426 stemp2 = left(aTemp2(x),1)
427 if isNumeric(stemp2) then
432 if aTemp(4) = "2" AND bFoundNumber then
433 printlog "Old version is: " + aTemp2(x-1)
434 elseif bFoundNumber then
435 warnlog "No old version expected: " + aTemp2(x-1)
436 elseif aTemp(4) = "2" then
437 warnlog "Old version expected, but not mentioned."
442 if cBool(aTemp(3)) then
444 qaErrorLog "#i73367# "
446 warnlog "errormessage expected, but none came up."
451 '/// If there are any unsatisfied dependencies, they are shown now ///'
452 Kontext "UnsatisfiedDependencies"
453 if UnsatisfiedDependencies.exists(10) then
454 if cBool(aTemp(0)) then
455 printlog " - UnsatisfiedDependencies dialog exists"
457 warnLog "UnsatisfiedDependencies are not expected but available"
459 DialogTest(UnsatisfiedDependencies)
460 y = UnsatisfiedDependencyList.getItemCount
461 if cInt(aTemp(0)) <> y then
462 warnlog "Difference in dependencies; expected: " + aTemp(0) + "; found: " +y
465 printlog " ("+x+"/"+y+"): "+UnsatisfiedDependencyList.getItemText(x)
467 '/// close dialog if available, extension will not be installed ///'
468 UnsatisfiedDependencies.close
470 if cBool(aTemp(0)) then
471 warnLog "UnsatisfiedDependencies expected but none shown."
475 '/// If there is a license, it is shown now ///'
476 Kontext "ExtensionSoftwareLicenseAgreement"
477 if ExtensionSoftwareLicenseAgreement.exists(10) then
478 if cBool(aTemp(1)) then
479 printlog " - ExtensionSoftwareLicenseAgreement dialog exists"
481 warnlog "ExtensionSoftwareLicenseAgreement are not expected but shown"
483 if NOT Accept.isEnabled then
484 if cInt(aTemp(1)) = 2 then
485 printlog " Long License"
487 errorlog "Long License"
490 if NOT cInt(aTemp(1)) = 2 then
491 printlog "Long License"
493 errorlog "Long License"
496 '/// scroll down until accept button is enabled, click accept button ///'
497 LicenseText.typeKeys ("<mod1 a>",true)
498 if Accept.isEnabled then
499 '/// for testing purposes click cancel one time - the extension should not get installed ///'
500 if cInt(aTemp(1)) = 3 then
501 ExtensionSoftwareLicenseAgreement.CANCEL
506 qaErrorLog "Accept not enabled.yet"
507 while NOT Accept.isEnabled
509 printlog "Scrolling..."
512 '/// for testing purposes click cancel one time - the extension should not get installed ///'
513 if cInt(aTemp(1)) = 3 then
514 ExtensionSoftwareLicenseAgreement.CANCEL
520 if cBool(aTemp(1)) then
521 errorlog "ExtensionSoftwareLicenseAgreement dialog expected but not shown."
525 '/// There may come up another active right now, which would be an error ///'
527 if active.exists(5) then
528 sTemp = active.getText
530 qaerrorlog "#i67452# " + sTemp
533 qaerrorlog "#i73307#" + stemp
541 '/// the progress dialog is now available again ///'
542 Kontext "AddingPackages"
544 while AddingPackages.exists(1) AND (x<30)
545 printlog "AddingPackages..."
550 '/// There may come up another active right now, which would be an error ///'
552 if active.exists(5) then
553 sTemp = active.getText
558 ' find out, if the extension got installed
559 kontext "PackageManager"
560 BrowsePackages.typeKeys("<home>")
561 BrowsePackages.typeKeys("+")
562 y = BrowsePackages.getItemCount
564 aTemp2 = split(sTemp,"\")
565 if uBound(aTemp2) < 1 then
566 aTemp2 = split(sTemp,"/")
568 sTemp = aTemp2(uBound(aTemp2))
572 sTemp2 = BrowsePackages.getItemText(x,1)
573 printlog "("+x+"/"+y+"): "+sTemp2
574 ' Mechanism to detect a status change; report it only one time
575 sTemp3 = BrowsePackages.getItemText(x,3) ' enabled?
576 sTemp4 = BrowsePackages.getItemText(x,2) ' version
577 if sTemp3 <> "" AND sFirstStatus = "" then
578 sFirstStatus = sTemp3
580 if (sFirstStatus <> sTemp3) AND (sTemp3 <> "") AND (sFirstStatus <> "alreadyshown") then
581 qaErrorlog "#i67450# " + sFirstStatus + " <> " + sTemp3
582 sFirstStatus= "alreadyshown"
586 printlog " +++ " + sTemp3
589 sLastVersion = sTemp4
590 printlog " Version:" + sTemp4
592 if sTemp = sTemp2 then
593 listAppend(aRemovePackages(), sTemp)
594 if cBool(aTemp(2)) then
595 printlog "-------------------------------- Extension got installed"
599 qaerrorLog "#i73367# "
601 warnLog "-------------------------------- Extension got installed, but shouldn't do that"
606 if NOT cBool(aTemp(2)) and bFound then
609 '/// Close extension manager ///'
613 warnlog "Couldn't call Tools -> Package manager - aborting test at " + i
618 '/// after installing all extensions, remove them ///'
619 ' uninstall all components, that were installed
620 a = listCount(aRemovePackages())
622 kontext "PackageManager"
623 If PackageManager.exists(10) then
624 BrowsePackages.typeKeys("<home>")
626 while (ii < BrowsePackages.getItemCount +1)
627 kontext "PackageManager"
628 'BrowsePackages.typeKeys("+")
629 'BrowsePackages.typeKeys("<down>")
631 BrowsePackages.select ii
632 sTemp = BrowsePackages.getItemText (ii,1)
633 if right(sTemp,3) = "oxt" then
635 if sTemp = aRemovePackages(x) then
636 printlog "Package is installed, trying to remove it: '" + sTemp + "'"
637 if remove.isEnabled then
641 if ( Active.exists( 2 ) ) then
644 warnlog( "No confirmation for extension removal" )
647 Kontext "AddingPackages"
649 while AddingPackages.exists(1) AND (y<30)
650 printlog "RemovingPackages..."
654 kontext "PackageManager"
655 BrowsePackages.typeKeys("<up>")
658 warnlog "Package can't get removed: '" + sTemp + "'"
666 kontext "PackageManager"
669 qaErrorLog "disabling installed extensions failed;"