[AHK_Opera_9.64]

Improve uninstall process, add a lot of various checks, reduce waiting time, remove unnecessary sleep calls.
All 5 tests works fine in win2k3 sp2 (with Flash Player plugin installed)

svn path=/trunk/ahk_tests/; revision=1794
This commit is contained in:
Edijs Kolesnikovičs 2012-10-02 09:31:32 +00:00
parent 000218e14b
commit cfaf0ae296
6 changed files with 326 additions and 159 deletions

View File

@ -25,22 +25,19 @@ if not bContinue
TestsFailed("We failed somewhere in prepare.ahk")
else
{
WinWaitActive, Welcome to Opera - Opera,, 4 ; Window caption might change?
if ErrorLevel
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
IfWinNotActive, Speed Dial - Opera
TestsFailed("Window 'Speed Dial - Opera' is not active window.")
else
{
Sleep, 1000
SendInput, {CTRLDOWN}l{CTRLUP} ; Toggle address bar
Sleep, 1000
SendInput, http{:}//dsx86{.}patrickaalto{.}com{ENTER}
Sleep, 5000 ; Let it to sleep, maybe it will crash ;)
WinWaitActive, DSx86 by Patrick Aalto - Opera,,15
WinWaitActive, DSx86 by Patrick Aalto - Opera,,10
if ErrorLevel
TestsFailed("Window 'DSx86 by Patrick Aalto - Opera' was NOT found. Failed to open URL. Ctrl+L doesnt work?")
else
{
Sleep, 4000 ; Let it to sleep, maybe it will crash ;)
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 4
if ErrorLevel

View File

@ -25,56 +25,56 @@ if not bContinue
TestsFailed("We failed somewhere in prepare.ahk")
else
{
WinWaitActive, Welcome to Opera - Opera,, 5
if ErrorLevel
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
IfWinNotActive, Speed Dial - Opera
TestsFailed("Window 'Speed Dial - Opera' is not active window.")
else
{
SendInput, {CTRLDOWN}t{CTRLUP}
WinWaitActive, Speed Dial - Opera,,15
IfExist, %A_MyDocuments%\bootcd-54727-dbgwin.7z
FileDelete, %A_MyDocuments%\bootcd-54727-dbgwin.7z
SendInput, {CTRLDOWN}l{CTRLUP} ; Toggle address bar
SendInput, http://iso.reactos.org/bootcd/bootcd-54727-dbgwin.7z{ENTER}
iTimeOut := 45
while iTimeOut > 0
{
IfWinActive, Blank page - Opera
{
WinWaitActive, Downloading file bootcd-54727-dbgwin.7z,,1
iTimeOut--
}
else
break ; exit the loop if something poped-up
}
WinWaitActive, Downloading file bootcd-54727-dbgwin.7z,, 1
if ErrorLevel
TestsFailed("Window 'Speed Dial - Opera' was NOT found. Failed to open new tab.")
TestsFailed("Window 'Downloading file bootcd-54727-dbgwin.7z' failed to appear (iTimeOut=" iTimeOut ").")
else
{
IfExist, %A_MyDocuments%\bootcd-54727-dbgwin.7z
FileDelete, %A_MyDocuments%\bootcd-54727-dbgwin.7z
Sleep, 1000
SendInput, {CTRLDOWN}l{CTRLUP}
Sleep, 700
SendInput, http://iso.reactos.org/bootcd/bootcd-54727-dbgwin.7z{ENTER}
WinWaitActive, Downloading file bootcd-54727-dbgwin.7z,,15
TestsInfo("'Downloading file bootcd-54727-dbgwin.7z' window appeared (iTimeOut=" iTimeOut ").")
SendInput, !n ; Focus 'File name' field
SendInput, %A_MyDocuments%\bootcd-54727-dbgwin.7z
SendInput, {ENTER} ; Hit 'Save'
SetTitleMatchMode, 1 ; A window's title must start with the specified WinTitle to be a match.
WinWaitActive, Save,, 7
if ErrorLevel
TestsFailed("Window 'Downloading file bootcd-54727-dbgwin.7z' failed to appear.")
TestsFailed("'Save as' dialog failed to appear (SetTitleMatchMode=1).")
else
{
Sleep, 700
SendInput, !n ; Focus 'File name' field
SendInput, %A_MyDocuments%\bootcd-54727-dbgwin.7z
Sleep, 700
SendInput, {ENTER} ; Hit 'Save' in Opera
SetTitleMatchMode, 1 ; A window's title must start with the specified WinTitle to be a match.
WinWaitActive, Save,, 15
SendInput, {ALTDOWN}s{ALTUP} ; Hit 'Save' in 'Save as'
Sleep, 3500 ; Download for 3.5 sec before closing Opera
WinClose, Blank page - Opera,,5
WinWaitActive, Active,,7 ; ROS 'Active transfers', WinXP 'Active Transfers'
if ErrorLevel
TestsFailed("'Save as' dialog failed to appear (SetTitleMatchMode=1).")
TestsFailed("'Active' dialog failed to appear(SetTitleMatchMode=1).")
else
{
Sleep, 2500
SendInput, {ALTDOWN}s{ALTUP} ; Hit 'Save' in 'Save as'
Sleep, 3500 ; Download for 3.5 sec before closing Opera
WinClose, Blank page - Opera,,5
WinWaitActive, Active,,7 ; ROS 'Active transfers', WinXP 'Active Transfers'
SendInput, {ENTER} ; Hit 'OK'
WinWaitClose, Blank page - Opera,,10
if ErrorLevel
TestsFailed("'Active' dialog failed to appear(SetTitleMatchMode=1).")
TestsFailed("Window 'Blank page - Opera' failed to close.")
else
{
Sleep, 1500
SendInput, {ENTER} ; Hit 'OK'
WinWaitClose, Blank page - Opera,,10
if ErrorLevel
TestsFailed("Window 'Blank page - Opera' failed to close.")
else
TestsOK("Closing Opera while download is in progress works.")
}
TestsOK("Closing Opera while download is in progress works.")
}
}
}

View File

@ -25,54 +25,93 @@ if not bContinue
TestsFailed("We failed somewhere in prepare.ahk")
else
{
WinWaitActive, Welcome to Opera - Opera,, 5
if ErrorLevel
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
IfWinNotActive, Speed Dial - Opera
TestsFailed("Window 'Speed Dial - Opera' is not active window.")
else
{
IfExist, %A_MyDocuments%\livecd-56407-dbg.7z
FileDelete, %A_MyDocuments%\livecd-56407-dbg.7z
SendInput, {CTRLDOWN}l{CTRLUP}
Sleep, 700
SendInput, http://iso.reactos.org/livecd/livecd-56407-dbg.7z{ENTER} ;Download some file
Sleep, 5000 ; Let it to respond
WinWaitActive, Downloading file livecd-56407-dbg.7z,,25
iTimeOut := 45
while iTimeOut > 0
{
IfWinActive, Blank page - Opera
{
WinWaitActive, Downloading file livecd-56407-dbg.7z,,1
iTimeOut--
}
else
break ; exit the loop if something poped-up
}
WinWaitActive, Downloading file livecd-56407-dbg.7z,, 1
if ErrorLevel
TestsFailed("Window 'Downloading file livecd-56407-dbg.7z' failed to appear.")
TestsFailed("Window 'Downloading file livecd-56407-dbg.7z' failed to appear (iTimeOut=" iTimeOut ").")
else
{
TestsInfo("'Downloading file livecd-56407-dbg.7z' window appeared (iTimeOut=" iTimeOut ").")
SendInput, {ENTER} ; Default option is 'Save' and Alt+S doesn't work here. :/
SetTitleMatchMode, 1 ; ReactOS 'Save as', WinXP 'Save As', so match if wnd starts with 'Save'
WinWaitActive, Save,, 15 ; FIXME: add WinText, so we really know it is right dialog
WinWaitActive, Save,, 7
if ErrorLevel
TestsFailed("'Save as' dialog failed to appear.")
else
{
Sleep, 700
SendInput, !n ; Focus 'File name' field
SendInput, %A_MyDocuments%\livecd-56407-dbg.7z
Sleep, 700
SendInput, {ALTDOWN}s{ALTUP} ; Hit 'Save'
Sleep, 2500
SendInput, {CTRLDOWN}{TAB}{CTRLUP} ; Navigate thru tabs to 'Transfers' tab
WinWaitActive, Transfers - Opera,,60 ; 1 minute
WinWaitClose, Save,,3
if ErrorLevel
TestsFailed("Window 'Transfers - Opera' failed to appear.")
TestsFailed("'Save' dialog failed to close.")
else
{
Sleep, 1500
FileGetSize, DFileSize, %A_MyDocuments%\livecd-56407-dbg.7z
ExpectedSize = 23030114
if not (InStr(%DFileSize%, %ExpectedSize%))
TestsFailed("Downloaded file size is NOT the same as expected [is " DFileSize " and should be " ExpectedSize "].")
WinWaitActive, Blank page - Opera,, 3
if ErrorLevel
TestsFailed("'Blank page - Opera' window failed to appear.")
else
{
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 4
SendInput, {CTRLDOWN}{TAB}{CTRLUP} ; Navigate thru tabs to 'Transfers' tab
SetTitleMatchMode, 1 ; A window's title must start with the specified WinTitle to be a match.
WinWaitActive, Transfers 0,, 5 ; Expected window title is something like 'Transfers 03:12 - Opera'
if ErrorLevel
TestsFailed("Unable to terminate '" ProcessExe "' process.")
TestsFailed("Window 'Transfers 0' failed to appear ( SetTitleMatchMode=1).")
else
TestsOK("File downloaded. Size the same as expected.")
{
iTimeOut := 120
while iTimeOut > 0
{
IfWinActive, Transfers 0
{
WinWaitActive, Transfers - Opera,,1
iTimeOut--
}
else
break ; exit the loop if something poped-up
}
WinWaitActive, Transfers - Opera,,1
if ErrorLevel
TestsFailed("Window 'Transfers - Opera' failed to appear (iTimeOut=" iTimeOut ").")
else
{
Sleep, 2000 ; Extra sleep is required, because download is not actually done
FileGetSize, DFileSize, %A_MyDocuments%\livecd-56407-dbg.7z
ExpectedSize := 23030114
if DFileSize <> %ExpectedSize%
TestsFailed("Downloaded file size is NOT the same as expected [is " DFileSize " and should be " ExpectedSize "].")
else
{
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 4
if ErrorLevel
TestsFailed("Unable to terminate '" ProcessExe "' process.")
else
TestsOK("File downloaded. Size the same as expected.")
}
}
}
}
}
}

View File

@ -25,37 +25,41 @@ if not bContinue
TestsFailed("We failed somewhere in prepare.ahk")
else
{
WinWaitActive, Welcome to Opera - Opera,, 5
if ErrorLevel
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
IfWinNotActive, Speed Dial - Opera
TestsFailed("Window 'Speed Dial - Opera' is not active window.")
else
{
SendInput, {CTRLDOWN}t{CTRLUP} ; Open new tab
WinWaitActive, Speed Dial - Opera,, 15
if ErrorLevel
TestsFailed("Window 'Speed Dial - Opera' failed to appear.")
IfNotExist, %A_WinDir%\System32\Macromed\Flash\*Plugin.exe ; Check if file pattern exist
TestsFailed("Can NOT find any file in '" A_WinDir "\System32\Macromed\Flash' that matches file pattern '*Plugin.exe'.")
else
{
IfNotExist, %A_WinDir%\System32\Macromed\Flash
TestsFailed("Can NOT find '" A_WinDir "\System32\Macromed\Flash'.")
SendInput, {CTRLDOWN}l{CTRLUP} ; Toggle address bar
SendInput, http://beastybombs.com/play.php{ENTER}
iTimeOut := 30
while iTimeOut > 0
{
IfWinActive, Blank page - Opera
{
WinWaitActive, Beasty Bombs - Cats & Dogs Fights - Play - Opera,,1
iTimeOut--
}
else
break ; exit the loop if something poped-up
}
WinWaitActive, Beasty Bombs - Cats & Dogs Fights - Play - Opera,,1
if ErrorLevel
TestsFailed("Window 'Beasty Bombs - Cats & Dogs Fights - Play - Opera' failed to appear (iTimeOut=" iTimeOut ").")
else
{
SendInput, {CTRLDOWN}l{CTRLUP}
Sleep, 1500
SendInput, http://beastybombs.com/play.php{ENTER}
Sleep, 10000 ; Let it to fully load. Maybe it will crash
WinWaitActive, Beasty Bombs - Cats & Dogs Fights - Play - Opera,,20
Sleep, 3500 ; Let it to load more, maybe it will crash
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 4
if ErrorLevel
TestsFailed("Window 'Beasty Bombs - Cats & Dogs Fights - Play - Opera' failed to appear.")
TestsFailed("Process '" ProcessExe "' failed to close after opening website.")
else
{
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 4
if ErrorLevel
TestsFailed("Process '" ProcessExe "' failed to close after opening website.")
else
TestsOK("Window caption is 'Beasty Bombs - Cats & Dogs Fights - Play - Opera' that means no crash while opening Flash Game.")
}
TestsOK("Window caption is 'Beasty Bombs - Cats & Dogs Fights - Play - Opera' that means no crash while opening Flash Game (iTimeOut=" iTimeOut ").")
}
}
}

View File

@ -40,49 +40,68 @@ else
; There was a problem (such as a nonexistent key or value).
; That probably means we have not installed this app before.
; Check in default directory to be extra sure
IfNotExist, %A_ProgramFiles%\Opera
bContinue := true ; No previous versions detected in hardcoded path
else
bHardcoded := true ; To know if we got path from registry or not
szDefaultDir = %A_ProgramFiles%\Opera
IfNotExist, %szDefaultDir%
{
bHardcoded := true ; To know if we got path from registry or not
IfExist, %A_ProgramFiles%\Opera
TestsInfo("No previous versions detected in hardcoded path: '" szDefaultDir "'.")
bContinue := true
}
else
{
UninstallerPath = %A_WinDir%\System32\MsiExec.exe /X{E1BBBAC5-2857-4155-82A6-54492CE88620} /qn
WaitUninstallDone(UninstallerPath, 5)
if bContinue
{
RunWait, MsiExec.exe /X{E1BBBAC5-2857-4155-82A6-54492CE88620} /qn ; Silently uninstall it
Sleep, 7000
}
IfNotExist, %A_ProgramFiles%\Opera ; Uninstaller might delete the dir
bContinue := true
{
FileRemoveDir, %A_ProgramFiles%\Opera, 1
if ErrorLevel
TestsFailed("Unable to delete existing '" A_ProgramFiles "\Opera' ('" MainAppFile "' process is reported as terminated).'")
else
IfNotExist, %szDefaultDir% ; Uninstaller might delete the dir
{
TestsInfo("Uninstaller deleted hardcoded path: '" szDefaultDir "'.")
bContinue := true
}
else
{
FileRemoveDir, %szDefaultDir%, 1
if ErrorLevel
TestsFailed("Unable to delete hardcoded path '" szDefaultDir "' ('" MainAppFile "' process is reported as terminated).'")
else
{
TestsInfo("Succeeded deleting hardcoded path, because uninstaller did not: '" szDefaultDir "'.")
bContinue := true
}
}
}
}
}
else
{
IfNotExist, %InstallLocation%
InstalledDir = %InstallLocation%
IfNotExist, %InstalledDir%
{
TestsInfo("Got '" InstalledDir "' from registry and such path does not exist.")
bContinue := true
}
else
{
IfExist, %InstallLocation%
UninstallerPath = %A_WinDir%\System32\MsiExec.exe /X{E1BBBAC5-2857-4155-82A6-54492CE88620} /qn
WaitUninstallDone(UninstallerPath, 5)
if bContinue
{
RunWait, MsiExec.exe /X{E1BBBAC5-2857-4155-82A6-54492CE88620} /qn ; Silently uninstall it
Sleep, 7000
}
IfNotExist, %InstallLocation%
bContinue := true
else
{
FileRemoveDir, %InstallLocation%, 1 ; Delete just in case
if ErrorLevel
TestsFailed("Unable to delete existing '" InstallLocation "' ('" MainAppFile "' process is reported as terminated).")
else
IfNotExist, %InstalledDir%
{
TestsInfo("Uninstaller deleted path (registry data): '" InstalledDir "'.")
bContinue := true
}
else
{
FileRemoveDir, %InstalledDir%, 1 ; Uninstaller leaved the path for us to delete, so, do it
if ErrorLevel
TestsFailed("Unable to delete existing '" InstalledDir "' ('" MainAppFile "' process is reported as terminated).")
else
{
TestsInfo("Succeeded deleting path (registry data), because uninstaller did not: '" InstalledDir "'.")
bContinue := true
}
}
}
}
}
@ -114,14 +133,13 @@ else
TestsTotal++
if bContinue
{
WinWaitActive, Choose Setup Language, Select the language, 15 ; Wait 15 secs for window to appear
WinWaitActive, Choose Setup Language, Select the language, 7
if ErrorLevel
TestsFailed("'Choose Setup Language (Select the language)' window failed to appear.")
else
{
Sleep, 700
SendInput, {ENTER} ;Hit 'OK' button in 'Choose Setup Language' window
WinWaitClose, Choose Setup Language, Select the language, 5
WinWaitClose, Choose Setup Language, Select the language, 3
if ErrorLevel
TestsFailed("'Choose Setup Language (Select the language)' window failed to close despite 'ENTER' was sent to it.")
else
@ -130,21 +148,67 @@ if bContinue
}
; Test if 'InstallShield Wizard (Preparing to Install)' window appeared
TestsTotal++
if bContinue
{
WinWaitActive, InstallShield Wizard, Preparing to Install, 7
if ErrorLevel
{
IfWinNotActive, Opera 9.64 - InstallShield Wizard, Start
TestsFailed("'InstallShield Wizard (Preparing to Install)' window failed to appear.")
else
TestsOK("'Opera 9.64 - InstallShield Wizard (Start)' window appeared.")
}
else
{
iTimeOut := 20
while iTimeOut > 0
{
IfWinActive, InstallShield Wizard, Preparing to Install
{
WinWaitClose, InstallShield Wizard, Preparing to Install, 1
iTimeOut--
}
else
break ; exit the loop if something poped-up
}
WinWaitClose, InstallShield Wizard, Preparing to Install, 1
if ErrorLevel
TestsFailed("'InstallShield Wizard (Preparing to Install)' window failed to close (iTimeOut=" iTimeOut ").")
else
TestsOK("'InstallShield Wizard (Preparing to Install)' window closed (iTimeOut=" iTimeOut ").")
}
}
; Test if window with 'Start Setup' button can appear
TestsTotal++
if bContinue
{
WinWaitActive, Opera 9.64 - InstallShield Wizard, Start, 25 ; Same exe: 'Start set-up' in ROS, 'Start Setup' in Windows
WinWaitActive, Windows Installer, Preparing to install..., 4 ; ReactOD doesn't have such window
if not ErrorLevel
{
iTimeOut := 40
while iTimeOut > 0
{
IfWinActive, Windows Installer, Preparing to install...
{
WinWaitClose, Windows Installer, Preparing to install..., 1
iTimeOut--
}
else
break ; exit the loop if something poped-up
}
}
WinWaitActive, Opera 9.64 - InstallShield Wizard, Start, 5 ; Same exe: 'Start set-up' in ROS, 'Start Setup' in Windows
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard' window with 'Start Setup' button failed to appear.")
else
{
Sleep, 5000 ; window flashes, so let it to appear correctly
SendInput, {ALTDOWN)
Sleep, 500 ; Opera setup requires those sleeps
SendInput, s
Sleep, 500
SendInput, {ALTUP} ;Hit 'Start Setup' button in 'Opera 9.64 - InstallShield Wizard' window
SendInput, !s
TestsOK("'Opera 9.64 - InstallShield Wizard' window with 'Start Setup' button appeared, Alt+S was sent.")
}
}
@ -154,12 +218,11 @@ if bContinue
TestsTotal++
if bContinue
{
WinWaitActive, Opera 9.64 - InstallShield Wizard, Installation of Opera requires, 20
WinWaitActive, Opera 9.64 - InstallShield Wizard, Installation of Opera requires, 3
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (Installation of Opera requires)' window failed to appear.")
else
{
Sleep, 700
SendInput, {ALTDOWN}a{ALTUP} ;Hit 'I Accept' button in 'Opera Browser Licence Agreement' window
TestsOK("'Opera 9.64 - InstallShield Wizard (Installation of Opera requires)' window appeared, Alt+A was sent.")
}
@ -170,7 +233,7 @@ if bContinue
TestsTotal++
if bContinue
{
WinWaitActive, Opera 9.64 - InstallShield Wizard, Welcome to the Opera, 15
WinWaitActive, Opera 9.64 - InstallShield Wizard, Welcome to the Opera, 3
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (Welcome to the Opera)' window failed to appear.")
else
@ -185,42 +248,67 @@ if bContinue
TestsTotal++
if bContinue
{
WinWaitActive, Opera 9.64 - InstallShield Wizard, Ready to install the program, 15
WinWaitActive, Opera 9.64 - InstallShield Wizard, Ready to install the program, 3
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (Ready to install the program)' window failed to appear.")
else
{
Sleep, 700
SendInput, {ALTDOWN}i{ALTUP} ;Hit 'Install' button in 'Ready to install the program' window
TestsOK("'Opera 9.64 - InstallShield Wizard (Ready to install the program)' window appeared, Alt+I was sent.")
}
}
; Test if can get thru 'Opera 9.64 - InstallShield Wizard (Installing)' window
TestsTotal++
if bContinue
{
WinWaitActive, Opera 9.64 - InstallShield Wizard, Installing, 3
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (Installing)' window failed to appear.")
else
{
iTimeOut := 45
while iTimeOut > 0
{
IfWinActive, Opera 9.64 - InstallShield Wizard, Installing
{
WinWaitClose, Opera 9.64 - InstallShield Wizard, Installing, 1
iTimeOut--
}
else
break ; exit the loop if something poped-up
}
WinWaitClose, Opera 9.64 - InstallShield Wizard, Installing, 1
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (Installing)' window failed to close (iTimeOut=" iTimeOut ").")
else
TestsOK("'Opera 9.64 - InstallShield Wizard (Installing)' window closed (iTimeOut=" iTimeOut ").")
}
}
; Test if 'InstallShield Wizard Completed' can appear
TestsTotal++
if bContinue
{
WinWaitActive, Opera 9.64 - InstallShield Wizard, InstallShield Wizard Completed, 30
WinWaitActive, Opera 9.64 - InstallShield Wizard, InstallShield Wizard Completed, 3
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window failed to appear.")
else
{
Sleep, 700
SendInput, {TAB} ; Focus 'Run Opera when I press Finish'
Sleep, 500
SendInput, {SPACE}
Sleep, 500
SendInput, {ALTDOWN}f{ALTUP} ;Hit 'Finish' button in 'InstallShield Wizard Completed' window
WinWaitClose, Opera 9.64 - InstallShield Wizard, InstallShield Wizard Completed, 7
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window failed to close after Alt+F was sent.")
ControlGet, bChecked, Checked, Button3
if bChecked = 1
TestsFailed("'Run Opera when I press Finish' checkbox in 'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window reported as unchecked, but further inspection proves that it was still checked.")
else
{
Process, wait, %MainAppFile%, 4
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID != 0
TestsFailed("'" MainAppFile "' process appeared despite 'Run Opera when I press Finish' checkbox unchecked in 'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window.")
SendInput, {ALTDOWN}f{ALTUP} ;Hit 'Finish' button in 'InstallShield Wizard Completed' window
WinWaitClose, Opera 9.64 - InstallShield Wizard, InstallShield Wizard Completed, 3
if ErrorLevel
TestsFailed("'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window failed to close after Alt+F was sent.")
else
TestsOK("'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window appeared, TAB, SPACE, Alt+F were sent, window was closed.")
}
@ -232,7 +320,6 @@ if bContinue
TestsTotal++
if bContinue
{
Sleep, 2000
RegRead, InstallLocation, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E1BBBAC5-2857-4155-82A6-54492CE88620}, InstallLocation
if ErrorLevel
TestsFailed("Either we can't read from registry or data doesn't exist.")

View File

@ -19,14 +19,16 @@
TestName = prepare
RegRead, InstalledPathReg, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E1BBBAC5-2857-4155-82A6-54492CE88620}, InstallLocation
; Test if the app is installed
TestsTotal++
RegRead, InstallLocation, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E1BBBAC5-2857-4155-82A6-54492CE88620}, InstallLocation
if ErrorLevel
{
ModuleExe = %A_ProgramFiles%\Opera\Opera.exe
OutputDebug, %TestName%:%A_LineNumber%: Can NOT read data from registry. Key might not exist. Using hardcoded path.`n
}
TestsFailed("Either registry key does not exist or we failed to read it.")
else
ModuleExe = %InstalledPathReg%Opera.exe ; InstalledPathReg already contains backslash
{
ModuleExe = %InstallLocation%Opera.exe ; InstallLocation already contains backslash
TestsOK("")
}
; Terminate application
@ -57,6 +59,40 @@ if bContinue
}
; Tests if can write settings
TestsTotal++
if bContinue
{
FileCreateDir, %A_AppData%\Opera\Opera\profile\sessions
if ErrorLevel
TestsFailed("Unable to create dir tree '" A_AppData "\Opera\Opera\profile\sessions'.")
else
{
IfNotExist, %A_WorkingDir%\Media\opera6.ini
TestsFailed("Can NOT find '" A_WorkingDir "\\Media\opera6.ini'.")
else
{
FileCopy, %A_WorkingDir%\Media\opera6.ini, %A_AppData%\Opera\Opera\profile\opera6.ini
if ErrorLevel
TestsFailed("Can NOT copy existing '" A_WorkingDir "\\Media\opera6.ini' to '" A_AppData "\Opera\Opera\profile\opera6.ini'")
else
{
IfNotExist, %A_WorkingDir%\Media\autosave.win
TestsFailed("Can NOT find '" A_WorkingDir "\\Media\autosave.win'.")
else
{
FileCopy, %A_WorkingDir%\Media\autosave.win, %A_AppData%\Opera\Opera\profile\sessions\autosave.win
if ErrorLevel
TestsFailed("Can NOT copy existing '" A_WorkingDir "\\Media\autosave.win' to '" A_AppData "\Opera\Opera\profile\sessions\autosave.win'")
else
TestsOK("")
}
}
}
}
}
TestsTotal++
if bContinue
{
@ -65,13 +101,17 @@ if bContinue
else
{
Run, %ModuleExe% ; Setup/install registers Opera as default browser
WinWaitActive, Welcome to Opera - Opera,, 20 ; Window caption might change?
WinWaitActive, Speed Dial - Opera,, 10
if ErrorLevel
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
else
{
Sleep, 1000
TestsOK("")
Process, Exist, %ProcessExe%
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
TestsFailed("Window 'Speed Dial - Opera' failed to appear. No '" ProcessExe "' process detected.")
else
TestsFailed("Window 'Speed Dial - Opera' failed to appear. '" ProcessExe "' process detected.")
}
else
TestsOK("")
}
}