[AHK_Firefox_3.0.11]

Match new design, add few more checks.
All 4 tests works fine in win2k3 sp2.

svn path=/trunk/ahk_tests/; revision=1608
This commit is contained in:
Edijs Kolesnikovičs 2012-09-07 09:56:04 +00:00
parent 0e0f7e0089
commit b41c1050d9
6 changed files with 337 additions and 287 deletions

View File

@ -21,9 +21,13 @@ TestName = 2.address_bar
; Check if can open some website by typing text in address bar
TestsTotal++
if bContinue
if not bContinue
TestsFailed("We failed somwehere in 'prepare.ahk'.")
else
{
IfWinActive, Mozilla Firefox Start Page - Mozilla Firefox
IfWinNotActive, Mozilla Firefox Start Page - Mozilla Firefox
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
else
{
Sleep, 1000
SendInput, {ALTDOWN}d{ALTUP} ; Go to address bar
@ -35,15 +39,16 @@ if bContinue
Sleep, 7500 ; Let it to load the page, maybe we will crash
WinWaitActive, DSx86 by Patrick Aalto - Mozilla Firefox,, 7
if not ErrorLevel
TestsOK("'DSx86 by Patrick Aalto - Mozilla Firefox' window appeared, so typing URL works (Alt+D).")
else
if ErrorLevel
TestsFailed("'DSx86 by Patrick Aalto - Mozilla Firefox' window failed to appear, so, typing URL failed (Alt+D).")
else
{
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 5
if ErrorLevel ; The PID still exists.
TestsFailed("Unable to terminate '" ProcessExe "' process.")
else
TestsOK("'DSx86 by Patrick Aalto - Mozilla Firefox' window appeared, so typing URL works (Alt+D), '" ProcessExe "' process closed.")
}
}
else
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
}
else
TestsFailed("We failed somwehere in 'prepare.ahk'.")
Process, Close, firefox.exe ; Teminate process

View File

@ -21,19 +21,27 @@ TestName = 3.download
; Check if can download some file
TestsTotal++
if bContinue
if not bContinue
TestsFailed("We failed somwehere in 'prepare.ahk'.")
else
{
IfWinActive, Mozilla Firefox Start Page - Mozilla Firefox
IfWinNotActive, Mozilla Firefox Start Page - Mozilla Firefox
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
else
{
Sleep, 2500
FileDelete, %A_Desktop%\livecd-56407-dbg.7z ; Make sure it doesn't exist before continuing
Sleep, 2500
IfNotExist, %A_Desktop%\livecd-56407-dbg.7z
IfExist, %A_Desktop%\livecd-56407-dbg.7z
TestsFailed("Failed to delete '" A_Desktop "\livecd-56407-dbg.7z'.")
else
{
SendInput, {CTRLDOWN}l{CTRLUP}http://iso.reactos.org/livecd/livecd-56407-dbg.7z{ENTER} ;Download some file
WinWaitActive, Opening livecd-56407-dbg.7z,,25
if not ErrorLevel
if ErrorLevel
TestsFailed("'Opening livecd-56407-dbg.7z' window failed to appear, so, downloading failed.")
else
{
; 'ControlClick' won't work here
SendInput, {ALTDOWN}s{ALTUP} ; Check 'Save file' radio button
@ -41,29 +49,26 @@ if bContinue
SendInput, {ENTER} ; Save file by hitting 'OK'. The button is focused by default
Sleep, 3500
SetTitleMatchMode, 3
WinWaitActive, Downloads,,60 ; Should be enought time to download the file?
if not ErrorLevel
WinWaitActive, Downloads,,65 ; Should be enought time to download the file?
if ErrorLevel
TestsFailed("'Downloads' window failed to appear, so, downloading failed. Wasn't enough time?")
else
{
FileGetSize, DFileSize, %A_Desktop%\livecd-56407-dbg.7z ; Desktop is our download dir. See prepare.ahk
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%, 5
if ErrorLevel ; The PID still exists.
TestsFailed("Unable to terminate '" ProcessExe "' process.")
else
TestsOK("File downloaded. Size the same as expected, '" ProcessExe "' process closed.")
}
}
else
TestsFailed("'Downloads' window failed to appear, so, downloading failed. Wasn't enough time?")
}
else
TestsFailed("'Opening livecd-56407-dbg.7z' window failed to appear, so, downloading failed.")
}
else
TestsFailed("Failed to delete '" A_Desktop "\livecd-56407-dbg.7z'.")
}
}
else
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
}
else
TestsFailed("We failed somwehere in 'prepare.ahk'.")
Process, Close, firefox.exe ; Teminate process

View File

@ -18,105 +18,122 @@
*/
ModuleExe = %A_WorkingDir%\Apps\Firefox 3.0.11 Setup.exe
bContinue := false
TestName = 1.install
TestsFailed := 0
TestsOK := 0
TestsTotal := 0
MainAppFile = firefox.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
IfExist, %ModuleExe%
TestsTotal++
IfNotExist, %ModuleExe%
TestsFailed("'" ModuleExe "' not found.")
else
{
; Get rid of other versions
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox (3.0.11), UninstallString
if not ErrorLevel
{
IfExist, %UninstallerPath%
{
Process, Close, firefox.exe ; Teminate process
Sleep, 1500
RunWait, %UninstallerPath% /S ; Silently uninstall it
Sleep, 2500
; Delete everything just in case
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\Mozilla
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\mozilla.org
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MozillaPlugins
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MicroSoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox (3.0.11)
SplitPath, UninstallerPath,, InstalledDir
FileRemoveDir, %InstalledDir%, 1
FileRemoveDir, %A_AppData%\Mozilla, 1
Sleep, 1000
IfExist, %InstalledDir%
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to delete '%InstalledDir%'.`n
bContinue := false
}
else
{
bContinue := true
}
}
}
Process, Close, %MainAppFile% ; Teminate process
Sleep, 2000
Process, Exist, %MainAppFile%
if ErrorLevel <> 0
TestsFailed("Unable to terminate '" MainAppFile "' process.") ; So, process still exists
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
IfExist, %A_ProgramFiles%\Mozilla Firefox\uninstall\helper.exe
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox (3.0.11), UninstallString
if ErrorLevel
{
Process, Close, firefox.exe ; Teminate process
Sleep, 1500
RunWait, %A_ProgramFiles%\Mozilla Firefox\uninstall\helper.exe /S ; Silently uninstall it
Sleep, 2500
FileRemoveDir, %A_ProgramFiles%\Mozilla Firefox, 1
FileRemoveDir, %A_AppData%\Mozilla, 1
Sleep, 1000
IfExist, %A_ProgramFiles%\Mozilla Firefox
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Previous version detected and failed to delete '%A_ProgramFiles%\Mozilla Firefox'.`n
bContinue := false
}
; 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%\Mozilla Firefox
bContinue := true ; No previous versions detected in hardcoded path
else
{
bContinue := true
bHardcoded := true ; To know if we got path from registry or not
IfExist, %A_ProgramFiles%\Mozilla Firefox\uninstall\helper.exe
{
RunWait, %A_ProgramFiles%\Mozilla Firefox\uninstall\helper.exe /S ; Silently uninstall it
Sleep, 7000
}
IfNotExist, %A_ProgramFiles%\Mozilla Firefox ; Uninstaller might delete the dir
bContinue := true
{
FileRemoveDir, %A_ProgramFiles%\Mozilla Firefox, 1
if ErrorLevel
TestsFailed("Unable to delete existing '" A_ProgramFiles "\Mozilla Firefox' ('" MainAppFile "' process is reported as terminated).'")
else
bContinue := true
}
}
}
else
{
; No previous versions detected.
bContinue := true
SplitPath, UninstallerPath,, InstalledDir
SplitPath, InstalledDir,, InstalledDir ; Split once more, since installer was in subdir (3.0.11 specific)
IfNotExist, %InstalledDir%
bContinue := true
else
{
IfExist, %UninstallerPath%
{
RunWait, %UninstallerPath% /S ; Silently uninstall it
Sleep, 7000
}
IfNotExist, %InstalledDir%
bContinue := true
else
{
FileRemoveDir, %InstalledDir%, 1 ; Delete just in case
if ErrorLevel
TestsFailed("Unable to delete existing '" InstalledDir "' ('" MainAppFile "' process is reported as terminated).")
else
bContinue := true
}
}
}
}
if bContinue
{
Run %ModuleExe%
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\Mozilla
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\mozilla.org
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MozillaPlugins
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MicroSoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox (3.0.11)
IfExist, %A_AppData%\Mozilla
{
FileRemoveDir, %A_AppData%\Mozilla, 1
if ErrorLevel
TestsFailed("Unable to delete '" A_AppData "\Mozilla'.")
}
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%
}
}
}
else
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: '%ModuleExe%' not found.`n
bContinue := false
}
; Test if can start setup
TestsTotal++
if bContinue
{
SetTitleMatchMode, 1
WinWaitActive, Extracting, Cancel, 10 ; Wait 10 secs for window to appear
if not ErrorLevel ;Window is found and it is active
SetTitleMatchMode, 2 ; A window's title can contain WinTitle anywhere inside it to be a match.
WinWaitActive, Extracting, Cancel, 7 ; Wait 7 secs for window to appear
if ErrorLevel
TestsFailed("'Extracting' window failed to appear.")
else
{
OutputDebug, OK: %TestName%:%A_LineNumber%: 'Extracting' window appeared, waiting for it to close.`n
WinWaitClose, Extracting, Cancel, 15
if not ErrorLevel
TestsOK("'Extracting' window appeared and went away.")
else
if ErrorLevel
TestsFailed("'Extracting' window failed to dissapear.")
else
TestsOK("'Extracting' window appeared and went away.")
}
else
TestsFailed("'Extracting' window failed to appear.")
SetTitleMatchMode, 3 ; A window's title must exactly match WinTitle to be a match. (Default)
}
@ -125,17 +142,17 @@ TestsTotal++
if bContinue
{
WinWaitActive, Mozilla Firefox Setup, Welcome to the Mozilla Firefox, 15
if not ErrorLevel
{
Sleep, 250
ControlClick, Button2, Mozilla Firefox Setup, Welcome to the Mozilla Firefox
if not ErrorLevel
TestsOK("'Mozilla Firefox Setup (Welcome to the Mozilla Firefox)' window appeared and 'Next' was clicked.")
else
TestsFailed("Unable to hit 'Next' button in 'Mozilla Firefox Setup (Welcome to the Mozilla Firefox)' window.")
}
else
if ErrorLevel
TestsFailed("'Mozilla Firefox Setup (Welcome to the Mozilla Firefox)' window failed to appear.")
else
{
Sleep, 700
ControlClick, Button2, Mozilla Firefox Setup, Welcome to the Mozilla Firefox
if ErrorLevel
TestsFailed("Unable to hit 'Next' button in 'Mozilla Firefox Setup (Welcome to the Mozilla Firefox)' window.")
else
TestsOK("'Mozilla Firefox Setup (Welcome to the Mozilla Firefox)' window appeared and 'Next' was clicked.")
}
}
@ -144,17 +161,17 @@ TestsTotal++
if bContinue
{
WinWaitActive, Mozilla Firefox Setup, Setup Type, 7
if not ErrorLevel
{
Sleep, 250
ControlClick, Button2, Mozilla Firefox Setup, Setup Type
if not ErrorLevel
TestsOK("'Mozilla Firefox Setup (Setup Type)' window appeared and 'Next' was clicked.")
else
TestsFailed("Unable to hit 'Next' button in 'Mozilla Firefox Setup (Setup Type)' window.")
}
else
if ErrorLevel
TestsFailed("'Mozilla Firefox Setup (Setup Type)' window failed to appear.")
else
{
Sleep, 700
ControlClick, Button2, Mozilla Firefox Setup, Setup Type
if ErrorLevel
TestsFailed("Unable to hit 'Next' button in 'Mozilla Firefox Setup (Setup Type)' window.")
else
TestsOK("'Mozilla Firefox Setup (Setup Type)' window appeared and 'Next' was clicked.")
}
}
@ -163,17 +180,17 @@ TestsTotal++
if bContinue
{
WinWaitActive, Mozilla Firefox Setup, Summary, 7
if not ErrorLevel
{
Sleep, 250
ControlClick, Button2, Mozilla Firefox Setup, Summary ; Hit 'Install' button
if not ErrorLevel
TestsOK("'Mozilla Firefox Setup (Summary)' window appeared and 'Install' button was clicked.")
else
TestsFailed("Unable to hit 'Install' button in 'Mozilla Firefox Setup (Summary)' window.")
}
else
if ErrorLevel
TestsFailed("'Mozilla Firefox Setup (Summary)' window failed to appear.")
else
{
Sleep, 700
ControlClick, Button2, Mozilla Firefox Setup, Summary ; Hit 'Install' button
if ErrorLevel
TestsFailed("Unable to hit 'Install' button in 'Mozilla Firefox Setup (Summary)' window.")
else
TestsOK("'Mozilla Firefox Setup (Summary)' window appeared and 'Install' button was clicked.")
}
}
@ -181,19 +198,20 @@ if bContinue
TestsTotal++
if bContinue
{
WinWaitActive, Mozilla Firefox Setup, Installing, 7
if not ErrorLevel
{
Sleep, 250
OutputDebug, OK: %TestName%:%A_LineNumber%: 'Installing' window appeared, waiting for it to close.`n
WinWaitClose, Mozilla Firefox Setup, Installing, 25
if not ErrorLevel
TestsOK("'Mozilla Firefox Setup (Installing)' window went away.")
else
TestsFailed("'Mozilla Firefox Setup (Installing)' window failed to dissapear.")
}
WindowSpace := "Mozilla Firefox Setup " ; Note space at the end of window title
WinWaitActive, %WindowSpace%, Installing, 7
if ErrorLevel
TestsFailed("'Mozilla Firefox Setup (Installing)' window failed to appear. Note the space in the end of window title.")
else
TestsFailed("'Mozilla Firefox Setup (Installing)' window failed to appear.")
{
Sleep, 700
OutputDebug, OK: %TestName%:%A_LineNumber%: 'Installing' window appeared, waiting for it to close.`n
WinWaitClose, %WindowSpace%, Installing, 30
if ErrorLevel
TestsFailed("'Mozilla Firefox Setup (Installing)' window failed to dissapear.")
else
TestsOK("'Mozilla Firefox Setup (Installing)' window went away.")
}
}
@ -201,43 +219,62 @@ if bContinue
TestsTotal++
if bContinue
{
WinWaitActive, Mozilla Firefox Setup, Completing, 7
if not ErrorLevel
WinWaitActive, %WindowSpace%, Completing, 7
if ErrorLevel
TestsFailed("'Mozilla Firefox Setup (Completing)' window failed to appear.")
else
{
Sleep, 250
ControlClick, Button4, Mozilla Firefox Setup, Completing ; Uncheck 'Launch Mozilla Firefox now'
if not ErrorLevel
{
ControlClick, Button2, Mozilla Firefox Setup, Completing ; Hit 'Finish'
if not ErrorLevel
TestsOK("'Mozilla Firefox Setup (Completing)' window appeared and 'Finish' was clicked.")
else
TestsFailed("Unable to hit 'Finish' button in 'Mozilla Firefox Setup (Completing)' window.")
}
else
Sleep, 700
ControlClick, Button4, %WindowSpace%, Completing ; Uncheck 'Launch Mozilla Firefox now'
if ErrorLevel
{
TestsFailed("Unable to uncheck 'Launch Mozilla Firefox now' in 'Mozilla Firefox Setup (Completing)' window.")
Process, Close, firefox.exe
}
else
{
Sleep, 500
ControlClick, Button2, %WindowSpace%, Completing ; Hit 'Finish'
if ErrorLevel
TestsFailed("Unable to hit 'Finish' button in 'Mozilla Firefox Setup (Completing)' window.")
else
{
WinWaitClose, %WindowSpace%, Completing, 5
if ErrorLevel
TestsFailed("'Mozilla Firefox Setup (Completing)' window failed to close despite Alt+F was sent.")
else
{
Process, Wait, %MainAppFile%, 4
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID <> 0
{
TestsFailed("Process '" MainAppFile "' appeared despite checkbox 'Launch Mozilla Firefox now' was unchecked.")
Process, Close, %MainAppFile%
}
else
TestsOK("'Mozilla Firefox Setup (Completing)' window appeared, 'Finish' button clicked, window closed, '" MainAppFile "' process did not appear.")
}
}
}
}
else
TestsFailed("'Mozilla Firefox Setup (Completing)' window failed to appear.")
}
;Check if program exists
; Check if program exists
TestsTotal++
if bContinue
{
Sleep, 2000
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox (3.0.11), UninstallString
if not ErrorLevel
{
IfExist, %UninstallerPath%
TestsOK("The application has been installed, because '" UninstallerPath "' was found.")
else
TestsFailed("Something went wrong, can't find '" UninstallerPath "'.")
}
else
if ErrorLevel
TestsFailed("Either we can't read from registry or data doesn't exist.")
else
{
SplitPath, UninstallerPath,, InstalledDir
SplitPath, InstalledDir,, InstalledDir ; Split once more, since installer was in subdir (v3.0.11 specific)
IfNotExist, %InstalledDir%\%MainAppFile%
TestsFailed("Something went wrong, can't find '" InstalledDir "\" MainAppFile "'.")
else
TestsOK("The application has been installed, because '" InstalledDir "\" MainAppFile "' was found.")
}
}

View File

@ -17,70 +17,78 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
bContinue := false
TestsTotal := 0
TestsSkipped := 0
TestsFailed := 0
TestsOK := 0
TestsExecuted := 0
TestName = prepare
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox (3.0.11), UninstallString
if not ErrorLevel
{
StringReplace, UninstallerPath, UninstallerPath, `",, All ; String contains quotes, replace em
SplitPath, UninstallerPath,, InstalledDir
ModuleExe = %InstalledDir%\..\firefox.exe ; Go back one folder
}
else
if ErrorLevel
{
ModuleExe = %A_ProgramFiles%\Mozilla Firefox\firefox.exe
OutputDebug, %TestName%:%A_LineNumber%: Can NOT read data from registry. Key might not exist. Using hardcoded path.`n
}
IfExist, %ModuleExe%
{
Process, Close, firefox.exe ; Teminate process
Sleep, 2500 ; To make sure folders are not locked
FileRemoveDir, %A_AppData%\Mozilla, 1 ; Delete all saved settings
Sleep, 1500
IfNotExist, %A_AppData%\Mozilla
{
FileCreateDir, %A_AppData%\Mozilla\Firefox\Profiles\ReactOS.default
if not ErrorLevel
{
FileAppend, [General]`nStartWithLastProfile=0`n`n[Profile0]`nName=default`nIsRelative=1`nPath=Profiles/ReactOS.default`n, %A_AppData%\Mozilla\Firefox\profiles.ini
if not ErrorLevel
{
szNoWarningOnClose := "user_pref(""browser.tabs.warnOnClose""`, false)`;" ; Now, new do not want any warnings when closing multiple tabs
szNoFirstRun := "user_pref(""browser.startup.homepage_override.mstone""`, ""rv:1.9.0.11"")`;" ; Lets pretend we ran it once
szRightsShown := "user_pref(""browser.rights.3.shown""`, true)`;" ; We know your rights, no need to ask
szNoImprvHelp := "user_pref(""toolkit.telemetry.prompted""`, 2)`;`nuser_pref(""toolkit.telemetry.rejected""`, true)`;" ; We don't want to help to improve
szDownloadDir := "user_pref(""browser.download.folderList""`, 0)`;" ; Desktop is our default download directory
FileAppend, %szNoWarningOnClose%`n%szNoFirstRun%`n%szRightsShown%`n%szNoImprvHelp%`n`n%szDownloadDir%, %A_AppData%\Mozilla\Firefox\Profiles\ReactOS.default\prefs.js
if not ErrorLevel
{
Run, %ModuleExe%,,Max ; Start maximized
WinWaitActive, Mozilla Firefox Start Page - Mozilla Firefox,, 12
if not ErrorLevel
{
bContinue := true ; We are up and running
Sleep, 700
}
else
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'Mozilla Firefox Start Page - Mozilla Firefox' window failed to appear.`n
}
else
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to create and edit '%A_AppData%\Mozilla\Firefox\Profiles\ReactOS.default\prefs.js'.`n
}
else
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to create and edit '%A_AppData%\Mozilla\Firefox\profiles.ini'.`n
}
else
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to create dir tree '%A_AppData%\Mozilla\Firefox\ReactOS.default'.`n
}
else
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Seems like we failed to delete '%A_AppData%\Mozilla'.`n
}
else
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Can NOT find '%ModuleExe%'.`n
{
SplitPath, UninstallerPath,, InstalledDir
ModuleExe = %InstalledDir%\..\firefox.exe ; Go back one folder
}
TestsTotal++
IfNotExist, %ModuleExe%
TestsFailed("Can NOT find '" ModuleExe "'.")
else
{
SplitPath, ModuleExe, ProcessExe
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 5
if ErrorLevel ; The PID still exists.
TestsFailed("Unable to terminate '" ProcessExe "' process.")
else
{
Sleep, 2500 ; To make sure folders are not locked
FileRemoveDir, %A_AppData%\Mozilla, 1 ; Delete all saved settings
Sleep, 1500
IfExist, %A_AppData%\Mozilla
TestsFailed("Seems like we failed to delete '" A_AppData "\Mozilla'.")
else
{
FileCreateDir, %A_AppData%\Mozilla\Firefox\Profiles\ReactOS.default
if ErrorLevel
TestsFailed("Failed to create dir tree '" A_AppData "\Mozilla\Firefox\ReactOS.default'.")
else
{
FileAppend, [General]`nStartWithLastProfile=0`n`n[Profile0]`nName=default`nIsRelative=1`nPath=Profiles/ReactOS.default`n, %A_AppData%\Mozilla\Firefox\profiles.ini
if ErrorLevel
TestsFailed("Failed to create and edit '" A_AppData "\Mozilla\Firefox\profiles.ini'.")
else
{
szNoWarningOnClose := "user_pref(""browser.tabs.warnOnClose""`, false)`;" ; Now, new do not want any warnings when closing multiple tabs
szNoFirstRun := "user_pref(""browser.startup.homepage_override.mstone""`, ""rv:1.9.0.11"")`;" ; Lets pretend we ran it once
szRightsShown := "user_pref(""browser.rights.3.shown""`, true)`;" ; We know your rights, no need to ask
szNoImprvHelp := "user_pref(""toolkit.telemetry.prompted""`, 2)`;`nuser_pref(""toolkit.telemetry.rejected""`, true)`;" ; We don't want to help to improve
szDownloadDir := "user_pref(""browser.download.folderList""`, 0)`;" ; Desktop is our default download directory
FileAppend, %szNoWarningOnClose%`n%szNoFirstRun%`n%szRightsShown%`n%szNoImprvHelp%`n`n%szDownloadDir%, %A_AppData%\Mozilla\Firefox\Profiles\ReactOS.default\prefs.js
if ErrorLevel
TestsFailed("Failed to create and edit '" A_AppData "\Mozilla\Firefox\Profiles\ReactOS.default\prefs.js'.")
else
{
Run, %ModuleExe%,,Max ; Start maximized
WinWaitActive, Mozilla Firefox Start Page - Mozilla Firefox,, 20
if ErrorLevel
{
Process, Exist, %ProcessExe%
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' window failed to appear. No '" ProcessExe "' process detected.")
else
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' window failed to appear. '" ProcessExe "' process detected.")
}
else
{
TestsOK("")
Sleep, 700
}
}
}
}
}
}
}

View File

@ -21,37 +21,47 @@ TestName = 4.search_bar
; Check if we can change search engine to Yahoo! and type inside search field
TestsTotal++
if bContinue
if not bContinue
TestsFailed("We failed somwehere in 'prepare.ahk'.")
else
{
IfWinActive, Mozilla Firefox Start Page - Mozilla Firefox
IfWinNotActive, Mozilla Firefox Start Page - Mozilla Firefox
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
else
{
SearchArrowImg = %A_WorkingDir%\Media\FF_3_Search_Arrow.jpg
Sleep, 1000
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *11 %SearchArrowImg%
if ErrorLevel = 2
TestsFailed("Could not conduct the ImageSearch ('" SearchArrowImg "' is missing?).")
else if ErrorLevel = 1
TestsFailed("The search arrow image '" SearchArrowImg "' could NOT be found on the screen.")
IfNotExist, %SearchArrowImg%
TestsFailed("Can NOT find '" SearchArrowImg "'.")
else
{
MouseClick, left, %FoundX%, %FoundY%
Sleep, 500
SendInput, y ;Y for Yahoo search
Sleep, 700
SendInput, {CTRLDOWN}k{CTRLUP}edijus{ENTER} ; Go to search bar
Sleep, 7500 ; Let it to load, maybe something will fail
WinWaitActive, edijus - Yahoo! Search Results - Mozilla Firefox,,25
if not ErrorLevel
TestsOK("'edijus - Yahoo! Search Results - Mozilla Firefox' window appeared, so search bar works.")
Sleep, 1000
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *11 %SearchArrowImg%
if ErrorLevel = 2
TestsFailed("Could not conduct the ImageSearch.")
else if ErrorLevel = 1
TestsFailed("The search arrow image '" SearchArrowImg "' could NOT be found on the screen.")
else
TestsFailed("'edijus - Yahoo! Search Results - Mozilla Firefox' window failed to appear, so, search bar do not work. Bugs 5574, 5930, 6990?")
{
MouseClick, left, %FoundX%, %FoundY%
Sleep, 500
SendInput, y ;Y for Yahoo search
Sleep, 700
SendInput, {CTRLDOWN}k{CTRLUP}edijus{ENTER} ; Go to search bar
Sleep, 7500 ; Let it to load, maybe something will fail
WinWaitActive, edijus - Yahoo! Search Results - Mozilla Firefox,,25
if ErrorLevel
TestsFailed("'edijus - Yahoo! Search Results - Mozilla Firefox' window failed to appear, so, search bar do not work. Bugs 5574, 5930, 6990?")
else
{
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 5
if ErrorLevel ; The PID still exists.
TestsFailed("Unable to terminate '" ProcessExe "' process.")
else
TestsOK("'edijus - Yahoo! Search Results - Mozilla Firefox' window appeared, so search bar works, '" ProcessExe "' process closed.")
}
}
}
}
else
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
}
else
TestsFailed("We failed somwehere in 'prepare.ahk'.")
Process, Close, firefox.exe ; Teminate process

View File

@ -18,10 +18,8 @@
*/
#Include ..\..\helper_functions.ahk
InitalizeCounters()
if 1 = --list
{
params =
(
@ -31,43 +29,30 @@ params =
4.search_bar
)
FileAppend, %params%, *
}
else if 1 = 1.install
if CheckParam()
{
#include install_test.ahk
}
else
{
#include prepare.ahk
if 1 = 2.address_bar
if 1 = 1.install
{
#include address_bar.ahk
#include install_test.ahk
}
else if 1 = 3.download
else
{
#include download.ahk
#include prepare.ahk
if 1 = 2.address_bar
{
#include address_bar.ahk
}
else if 1 = 3.download
{
#include download.ahk
}
else if 1 = 4.search_bar
{
#include search_bar.ahk
}
}
else if 1 = 4.search_bar
{
#include search_bar.ahk
}
else
OutputDebug, Bad parameters: '%1%'!`r`n
}
if 1 != --list
{
if not bContinue
{
SplitPath, ModuleExe, fName ; Extract filename from given path
WindowCleanUp(fName)
}
TestsSkipped := TestsTotal - TestsOK - TestsFailed
TestsExecuted := TestsOK + TestsFailed
if (TestsSkipped < 0 or TestsExecuted < 0)
OutputDebug, %TestName%: Check TestsTotal, TestsOK and TestsFailed, because results returns less than 0.`n
OutputDebug, %TestName%: %TestsExecuted% tests executed (0 marked as todo, %TestsFailed% failures), %TestsSkipped% skipped.`n
}
ShowTestResults()