mirror of
https://github.com/reactos/ahk_tests.git
synced 2024-11-23 11:39:42 +00:00
[AHK_Opera_9.64]
Match new design, add few more checks. All 5 tests works fine in win2k3 sp2. svn path=/trunk/ahk_tests/; revision=1622
This commit is contained in:
parent
d925c412ad
commit
ac39bfb60c
@ -17,6 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
TestName = 2.AddressBar
|
||||
|
||||
; Test if we can enter URL
|
||||
TestsTotal++
|
||||
@ -25,7 +26,9 @@ if not bContinue
|
||||
else
|
||||
{
|
||||
WinWaitActive, Welcome to Opera - Opera,, 4 ; Window caption might change?
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
else
|
||||
{
|
||||
Sleep, 1000
|
||||
SendInput, {CTRLDOWN}l{CTRLUP} ; Toggle address bar
|
||||
@ -34,13 +37,16 @@ else
|
||||
Sleep, 5000 ; Let it to sleep, maybe it will crash ;)
|
||||
|
||||
WinWaitActive, DSx86 by Patrick Aalto - Opera,,15
|
||||
if not ErrorLevel
|
||||
TestsOK("Window caption is 'DSx86 by Patrick Aalto - Opera' that means we opened URL by sending Ctrl+L.")
|
||||
else
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'DSx86 by Patrick Aalto - Opera' was NOT found. Failed to open URL. Ctrl+L doesnt work?")
|
||||
else
|
||||
{
|
||||
Process, Close, %ProcessExe%
|
||||
Process, WaitClose, %ProcessExe%, 4
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to terminate '" ProcessExe "' process.")
|
||||
else
|
||||
TestsOK("Window caption is 'DSx86 by Patrick Aalto - Opera' that means we opened URL by sending Ctrl+L.")
|
||||
}
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
}
|
||||
|
||||
Process, Close, Opera.exe ; Terminate process
|
||||
|
@ -17,6 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
TestName = 5.CloseDownload
|
||||
|
||||
; Test if we can exit properly when download in progress. Bug #5651
|
||||
TestsTotal++
|
||||
@ -25,11 +26,15 @@ if not bContinue
|
||||
else
|
||||
{
|
||||
WinWaitActive, Welcome to Opera - Opera,, 5
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
else
|
||||
{
|
||||
SendInput, {CTRLDOWN}t{CTRLUP}
|
||||
WinWaitActive, Speed Dial - Opera,,15
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Speed Dial - Opera' was NOT found. Failed to open new tab.")
|
||||
else
|
||||
{
|
||||
IfExist, %A_MyDocuments%\bootcd-54727-dbgwin.7z
|
||||
FileDelete, %A_MyDocuments%\bootcd-54727-dbgwin.7z
|
||||
@ -38,40 +43,40 @@ else
|
||||
Sleep, 700
|
||||
SendInput, http://iso.reactos.org/bootcd/bootcd-54727-dbgwin.7z{ENTER}
|
||||
WinWaitActive, Downloading file bootcd-54727-dbgwin.7z,,15
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Downloading file bootcd-54727-dbgwin.7z' failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 1500
|
||||
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
|
||||
SetTitleMatchMode, 1 ; A window's title must start with the specified WinTitle to be a match.
|
||||
WinWaitActive, Save,, 15
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Save as' 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
|
||||
SetTitleMatchMode, 1
|
||||
WinWaitActive, Active,,7 ; ROS 'Active transfers', WinXP 'Active Transfers'
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Active' dialog failed to appear(SetTitleMatchMode=1).")
|
||||
else
|
||||
{
|
||||
Sleep, 1500
|
||||
SendInput, {ENTER} ; Hit 'OK'
|
||||
TestsOK("Closing Opera while download is in progress works.")
|
||||
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.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Active transfers' dialog failed to appear.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Save as' dialog failed to appear.")
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Downloading file bootcd-54727-dbgwin.7z' failed to appear.")
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Speed Dial - Opera' was NOT found. Failed to open new tab.")
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
}
|
||||
|
||||
Process, Close, Opera.exe ; Terminate process
|
@ -17,6 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
TestName = 3.Download
|
||||
|
||||
; Test if we can download some file
|
||||
TestsTotal++
|
||||
@ -24,51 +25,57 @@ if not bContinue
|
||||
TestsFailed("We failed somewhere in prepare.ahk")
|
||||
else
|
||||
{
|
||||
WinWaitActive, Welcome to Opera - Opera,, 15
|
||||
if not ErrorLevel
|
||||
WinWaitActive, Welcome to Opera - Opera,, 5
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
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
|
||||
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
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Downloading file livecd-56407-dbg.7z' failed to appear.")
|
||||
else
|
||||
{
|
||||
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
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Save as' dialog failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 2500
|
||||
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
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Transfers - Opera' failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 1500
|
||||
FileGetSize, DFileSize, %A_MyDocuments%\livecd-56407-dbg.7z
|
||||
ExpectedSize = 23030114
|
||||
if (InStr(%DFileSize%, %ExpectedSize%))
|
||||
TestsOK("File downloaded. Size the same as expected.")
|
||||
else
|
||||
if not (InStr(%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.")
|
||||
}
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Transfers - Opera' failed to appear.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Save as' dialog failed to appear.")
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Downloading file livecd-56407-dbg.7z' failed to appear.")
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
}
|
||||
|
||||
Process, Close, Opera.exe ; Terminate process
|
@ -17,6 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
TestName = 4.FlashPlayer
|
||||
|
||||
; Test if can open flash
|
||||
TestsTotal++
|
||||
@ -25,27 +26,37 @@ if not bContinue
|
||||
else
|
||||
{
|
||||
WinWaitActive, Welcome to Opera - Opera,, 5
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
else
|
||||
{
|
||||
SendInput, {CTRLDOWN}t{CTRLUP} ; Open new tab
|
||||
WinWaitActive, Speed Dial - Opera,, 15
|
||||
if not ErrorLevel
|
||||
{
|
||||
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
|
||||
if not ErrorLevel
|
||||
TestsOK("Window caption is 'Beasty Bombs - Cats & Dogs Fights - Play - Opera' that means no crash while opening Flash Game.")
|
||||
else
|
||||
TestsFailed("Window 'Yahoo! - Opera' failed to appear.")
|
||||
}
|
||||
else
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Speed Dial - Opera' failed to appear.")
|
||||
else
|
||||
{
|
||||
IfNotExist, %A_WinDir%\System32\Macromed\Flash
|
||||
TestsFailed("Can NOT find '" A_WinDir "\System32\Macromed\Flash'.")
|
||||
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
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Beasty Bombs - Cats & Dogs Fights - Play - Opera' failed to appear.")
|
||||
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.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
}
|
||||
|
||||
Process, Close, Opera.exe ; Terminate process
|
@ -1,156 +0,0 @@
|
||||
/*
|
||||
* Designed for Opera 9.64
|
||||
* Copyright (C) 2012 Edijs Kolesnikovics
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
ModuleExe = %A_WorkingDir%\Apps\Opera Setup.exe
|
||||
bContinue := false
|
||||
TestName = 1.install
|
||||
|
||||
TestsFailed := 0
|
||||
TestsOK := 0
|
||||
TestsTotal := 0
|
||||
|
||||
Process, Close, Opera.exe
|
||||
FileRemoveDir, %A_ProgramFiles%\Opera
|
||||
RunWait, MsiExec.exe /X{E1BBBAC5-2857-4155-82A6-54492CE88620} /qn
|
||||
Sleep, 3000
|
||||
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MicroSoft\Windows\CurrentVersion\Uninstall\{E1BBBAC5-2857-4155-82A6-54492CE88620}
|
||||
|
||||
; Test if Setup file exists
|
||||
TestsTotal++
|
||||
IfExist, %ModuleExe%
|
||||
{
|
||||
TestsOK("")
|
||||
Run %ModuleExe%
|
||||
}
|
||||
else
|
||||
TestsFailed("'" ModuleExe "' not found.")
|
||||
|
||||
; Test if can start setup
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Choose Setup Language, Select the language, 15 ; Wait 15 secs for window to appear
|
||||
if not ErrorLevel ;Window is found and it is active
|
||||
{
|
||||
Sleep, 250
|
||||
SendInput, {ENTER} ;Hit 'OK' button in 'Choose Setup Language' window
|
||||
TestsOK("'Choose Setup Language (Select the language)' window appeared and 'ENTER' was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Choose Setup Language (Select the language)' window failed to appear.")
|
||||
}
|
||||
|
||||
; 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
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 2500 ; 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
|
||||
TestsOK("'Opera 9.64 - InstallShield Wizard' window with 'Start Setup' button appeared, Alt+S was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Opera 9.64 - InstallShield Wizard' window with 'Start Setup' button failed to appear.")
|
||||
}
|
||||
|
||||
; Test if 'Opera Browser Licence Agreement' window can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, Installation of Opera requires, 20
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 250
|
||||
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.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Opera 9.64 - InstallShield Wizard (Installation of Opera requires)' window failed to appear.")
|
||||
}
|
||||
|
||||
; Test if 'Welcome to the Opera installer' can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, Welcome to the Opera, 15
|
||||
if not ErrorLevel
|
||||
{
|
||||
SendInput, {ALDOWN}n{ALTUP} ;Hit 'Next' button in 'Welcome to the Opera installer' window
|
||||
TestsOK("'Opera 9.64 - InstallShield Wizard (Welcome to the Opera)' window appeared, Alt+N was sent")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Opera 9.64 - InstallShield Wizard (Welcome to the Opera)' window failed to appear.")
|
||||
}
|
||||
|
||||
; Test if 'Ready to install the program' can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, Ready to install the program, 15
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 250
|
||||
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.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Opera 9.64 - InstallShield Wizard (Ready to install the program)' window failed to appear.")
|
||||
}
|
||||
|
||||
; Test if 'InstallShield Wizard Completed' can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, InstallShield Wizard Completed, 30
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 250
|
||||
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.")
|
||||
else
|
||||
TestsOK("'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window appeared, TAB, SPACE, Alt+F were sent, window was closed.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window failed to appear.")
|
||||
}
|
||||
|
||||
; Check if Opera.exe exists
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
Sleep, 2500
|
||||
IfExist, %A_ProgramFiles%\Opera\opera.exe
|
||||
TestsOK("Should be installed, because '" A_ProgramFiles "\Opera\opera.exe' was found.")
|
||||
else
|
||||
TestsFailed("Can NOT find '" A_ProgramFiles "\Opera\opera.exe'.")
|
||||
}
|
||||
|
||||
Process, Close, msiexec.exe ; Just in case we failed
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Designed for Opera v9.64
|
||||
* Copyright (C) 2012 Edijs Kolesnikovics
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
TestName = prepare
|
||||
ModuleExe = %A_ProgramFiles%\Opera\Opera.exe
|
||||
bContinue := false
|
||||
TestsTotal := 0
|
||||
TestsSkipped := 0
|
||||
TestsFailed := 0
|
||||
TestsOK := 0
|
||||
TestsExecuted := 0
|
||||
|
||||
|
||||
IfExist, %ModuleExe%
|
||||
{
|
||||
FileRemoveDir, %A_AppData%\Opera, 1
|
||||
Sleep, 1000
|
||||
Run, %ModuleExe% ; Setup/install registers Opera as default browser
|
||||
WinWaitActive, Welcome to Opera - Opera,, 20 ; Window caption might change?
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 1000
|
||||
bContinue := true
|
||||
}
|
||||
else
|
||||
OutputDebug, FAILED: %TestName%:%A_LineNumber%: Window 'Welcome to Opera - Opera' was NOT found. Active window caption: '%title%'`n
|
||||
}
|
||||
else
|
||||
OutputDebug, FAILED: %TestName%:%A_LineNumber%: Can NOT find '%ModuleExe%'.`n
|
246
Opera/9.64/install_test.ahk
Normal file
246
Opera/9.64/install_test.ahk
Normal file
@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Designed for Opera 9.64
|
||||
* Copyright (C) 2012 Edijs Kolesnikovics
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
ModuleExe = %A_WorkingDir%\Apps\Opera 9.64 Setup.exe
|
||||
TestName = 1.install
|
||||
MainAppFile = Opera.exe ; Mostly this is going to be process we need to look for
|
||||
|
||||
|
||||
; Test if Setup file exists, if so, delete installed files, and run Setup
|
||||
TestsTotal++
|
||||
IfNotExist, %ModuleExe%
|
||||
TestsFailed("'" ModuleExe "' not found.")
|
||||
else
|
||||
{
|
||||
Process, Close, %MainAppFile% ; Teminate process
|
||||
Process, WaitClose, %MainAppFile%, 5
|
||||
if ErrorLevel ; The PID still exists.
|
||||
TestsFailed("Unable to terminate '" MainAppFile "' process.") ; So, process still exists
|
||||
else
|
||||
{
|
||||
RegRead, InstallLocation, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E1BBBAC5-2857-4155-82A6-54492CE88620}, InstallLocation
|
||||
if ErrorLevel
|
||||
{
|
||||
; 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
|
||||
IfExist, %A_ProgramFiles%\Opera
|
||||
{
|
||||
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
|
||||
bContinue := true
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IfNotExist, %InstallLocation%
|
||||
bContinue := true
|
||||
else
|
||||
{
|
||||
IfExist, %InstallLocation%
|
||||
{
|
||||
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
|
||||
bContinue := true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if bContinue
|
||||
{
|
||||
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MicroSoft\Windows\CurrentVersion\Uninstall\{E1BBBAC5-2857-4155-82A6-54492CE88620}
|
||||
IfExist, %A_AppData%\Opera
|
||||
{
|
||||
FileRemoveDir, %A_AppData%\Opera, 1
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete '" A_AppData "\Opera'.")
|
||||
}
|
||||
|
||||
if bContinue
|
||||
{
|
||||
if bHardcoded
|
||||
TestsOK("Either there was no previous versions or we succeeded removing it using hardcoded path.")
|
||||
else
|
||||
TestsOK("Either there was no previous versions or we succeeded removing it using data from registry.")
|
||||
Run %ModuleExe%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Test if can start setup
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Choose Setup Language, Select the language, 15 ; Wait 15 secs for window to appear
|
||||
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
|
||||
if ErrorLevel
|
||||
TestsFailed("'Choose Setup Language (Select the language)' window failed to close despite 'ENTER' was sent to it.")
|
||||
else
|
||||
TestsOK("'Choose Setup Language (Select the language)' window appeared and 'ENTER' was sent.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; 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
|
||||
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
|
||||
TestsOK("'Opera 9.64 - InstallShield Wizard' window with 'Start Setup' button appeared, Alt+S was sent.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Test if 'Opera Browser Licence Agreement' window can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, Installation of Opera requires, 20
|
||||
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.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Test if 'Welcome to the Opera installer' can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, Welcome to the Opera, 15
|
||||
if ErrorLevel
|
||||
TestsFailed("'Opera 9.64 - InstallShield Wizard (Welcome to the Opera)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
SendInput, {ALDOWN}n{ALTUP} ;Hit 'Next' button in 'Welcome to the Opera installer' window
|
||||
TestsOK("'Opera 9.64 - InstallShield Wizard (Welcome to the Opera)' window appeared, Alt+N was sent")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Test if 'Ready to install the program' can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, Ready to install the program, 15
|
||||
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 'InstallShield Wizard Completed' can appear
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Opera 9.64 - InstallShield Wizard, InstallShield Wizard Completed, 30
|
||||
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.")
|
||||
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.")
|
||||
else
|
||||
TestsOK("'Opera 9.64 - InstallShield Wizard (InstallShield Wizard Completed)' window appeared, TAB, SPACE, Alt+F were sent, window was closed.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Check if program exists
|
||||
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.")
|
||||
else
|
||||
{
|
||||
IfNotExist, %InstallLocation%%MainAppFile% ; Registry path contains trailing backslash
|
||||
TestsFailed("Something went wrong, can't find '" InstallLocation MainAppFile "'.")
|
||||
else
|
||||
TestsOK("The application has been installed, because '" InstallLocation MainAppFile "' was found.")
|
||||
}
|
||||
}
|
77
Opera/9.64/prepare.ahk
Normal file
77
Opera/9.64/prepare.ahk
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Designed for Opera v9.64
|
||||
* Copyright (C) 2012 Edijs Kolesnikovics
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
TestName = prepare
|
||||
|
||||
RegRead, InstalledPathReg, 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
|
||||
}
|
||||
else
|
||||
ModuleExe = %InstalledPathReg%Opera.exe ; InstalledPathReg already contains backslash
|
||||
|
||||
|
||||
; Terminate application
|
||||
TestsTotal++
|
||||
SplitPath, ModuleExe, ProcessExe
|
||||
Process, Close, %ProcessExe%
|
||||
Process, WaitClose, %ProcessExe%, 4
|
||||
if ErrorLevel
|
||||
TestsFailed("Process '" ProcessExe "' failed to close.")
|
||||
else
|
||||
TestsOK("")
|
||||
|
||||
|
||||
; Delete settings separately
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
IfExist, %A_AppData%\Opera
|
||||
{
|
||||
FileRemoveDir, %A_AppData%\Opera, 1
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete '" A_AppData "\Opera'.")
|
||||
else
|
||||
TestsOK("")
|
||||
}
|
||||
else
|
||||
TestsOK("")
|
||||
}
|
||||
|
||||
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
IfNotExist, %ModuleExe%
|
||||
TestsFailed("Can NOT find '" ModuleExe "'.")
|
||||
else
|
||||
{
|
||||
Run, %ModuleExe% ; Setup/install registers Opera as default browser
|
||||
WinWaitActive, Welcome to Opera - Opera,, 20 ; Window caption might change?
|
||||
if ErrorLevel
|
||||
TestsFailed("Window 'Welcome to Opera - Opera' was NOT found.")
|
||||
else
|
||||
{
|
||||
Sleep, 1000
|
||||
TestsOK("")
|
||||
}
|
||||
}
|
||||
}
|
@ -18,10 +18,8 @@
|
||||
*/
|
||||
|
||||
#Include ..\..\helper_functions.ahk
|
||||
InitalizeCounters()
|
||||
|
||||
|
||||
if 1 = --list
|
||||
{
|
||||
params =
|
||||
(
|
||||
|
||||
@ -32,44 +30,35 @@ params =
|
||||
5.CloseDownload
|
||||
|
||||
)
|
||||
FileAppend, %params%, *
|
||||
}
|
||||
else if 1 = 1.install
|
||||
{
|
||||
#include Install.ahk
|
||||
}
|
||||
else
|
||||
{
|
||||
#include Preparation.ahk
|
||||
|
||||
if 1 = 2.AddressBar
|
||||
if CheckParam()
|
||||
{
|
||||
; Those brackets are required!
|
||||
if 1 = 1.install
|
||||
{
|
||||
#include AddressBar.ahk
|
||||
#include install_test.ahk
|
||||
}
|
||||
else if 1 = 3.Download
|
||||
else
|
||||
{
|
||||
#include Download.ahk
|
||||
#include prepare.ahk
|
||||
|
||||
if 1 = 2.AddressBar
|
||||
{
|
||||
#include AddressBar.ahk
|
||||
}
|
||||
else if 1 = 3.Download
|
||||
{
|
||||
#include Download.ahk
|
||||
}
|
||||
else if 1 = 4.FlashPlayer
|
||||
{
|
||||
#include FlashPlayer.ahk
|
||||
}
|
||||
else if 1 = 5.CloseDownload
|
||||
{
|
||||
#include CloseDownload.ahk
|
||||
}
|
||||
}
|
||||
else if 1 = 4.FlashPlayer
|
||||
{
|
||||
#include FlashPlayer.ahk
|
||||
}
|
||||
else if 1 = 5.CloseDownload
|
||||
{
|
||||
#include CloseDownload.ahk
|
||||
}
|
||||
else OutputDebug, Bad parameters: '%1%'!`r`n
|
||||
}
|
||||
|
||||
if 1 != --list
|
||||
{
|
||||
if not bContinue
|
||||
{
|
||||
SplitPath, ModuleExe, fName
|
||||
WindowCleanUp(fName)
|
||||
}
|
||||
|
||||
TestsSkipped := TestsTotal - TestsOK - TestsFailed
|
||||
TestsExecuted := TestsOK + TestsFailed
|
||||
OutputDebug, %TestName%: %TestsExecuted% tests executed (0 marked as todo, %TestsFailed% failures), %TestsSkipped% skipped.`n
|
||||
}
|
||||
ShowTestResults()
|
||||
|
Loading…
Reference in New Issue
Block a user