diff --git a/Firefox/2.0.0.20/address_bar.ahk b/Firefox/2.0.0.20/address_bar.ahk index 0f130fc..5099664 100644 --- a/Firefox/2.0.0.20/address_bar.ahk +++ b/Firefox/2.0.0.20/address_bar.ahk @@ -29,26 +29,34 @@ else TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.") else { - Sleep, 1000 SendInput, {ALTDOWN}d{ALTUP} ; Go to address bar - Sleep, 1200 ; Let it to respond - SendInput, http{:}//dsx86{.}patrickaalto{.}com - Sleep, 500 - SendInput, {ENTER} - - Sleep, 7500 ; Let it to load the page, maybe we will crash - - WinWaitActive, DSx86 by Patrick Aalto - Mozilla Firefox,, 7 + ; copy text to clipboard and compare + clipboard = ; Empty the clipboard + Send, ^c + ClipWait, 2 if ErrorLevel - TestsFailed("'DSx86 by Patrick Aalto - Mozilla Firefox' window failed to appear, so, typing URL failed (Alt+D).") + TestsFailed("The attempt to copy text onto the clipboard failed.") else { - Process, Close, %ProcessExe% - Process, WaitClose, %ProcessExe%, 5 - if ErrorLevel ; The PID still exists. - TestsFailed("Unable to terminate '" ProcessExe "' process.") + if clipboard <> http://start.mozilla.org/en-US/ + TestsFailed("Clipboard content is not the same as expected (is '" clipboard "', should be 'http://start.mozilla.org/en-US/') Can't focus address bar using Alt+D?.") else - TestsOK("'DSx86 by Patrick Aalto - Mozilla Firefox' window appeared, so typing URL works (Alt+D), '" ProcessExe "' process closed.") + { + SendInput, http{:}//dsx86{.}patrickaalto{.}com{ENTER} + WinWaitActive, DSx86 by Patrick Aalto - Mozilla Firefox,, 7 + if ErrorLevel + TestsFailed("'DSx86 by Patrick Aalto - Mozilla Firefox' window failed to appear, so, typing URL failed (Alt+D).") + else + { + Sleep, 5500 ; Let it to load the page, maybe we will crash + 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.") + } + } } } } diff --git a/Firefox/2.0.0.20/download.ahk b/Firefox/2.0.0.20/download.ahk index c09d567..7f6e0dc 100644 --- a/Firefox/2.0.0.20/download.ahk +++ b/Firefox/2.0.0.20/download.ahk @@ -29,43 +29,55 @@ else 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 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 + WinWaitActive, Opening livecd-56407-dbg.7z,,10 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 - Sleep, 1200 + ; 'OK' button is disabled for split of second. There is no way for us to find out + ; is it enabled or not (there is no control name AHK could use), so, sleep is a must + Sleep, 1000 ; Depends on connection speed? SendInput, {ENTER} ; Save file by hitting 'OK'. The button is focused by default - Sleep, 3500 - SetTitleMatchMode, 3 - WinWaitActive, Downloads,,65 ; Should be enought time to download the file? + WinWaitClose,,,5 if ErrorLevel - TestsFailed("'Downloads' window failed to appear, so, downloading failed. Wasn't enough time?") + TestsFailed("'Opening livecd-56407-dbg.7z' window failed to close despite 'ENTER' was sent.") else { - FileGetSize, DFileSize, %A_Desktop%\livecd-56407-dbg.7z ; Desktop is our download dir. See prepare.ahk - ExpectedSize = 23030114 - if not (InStr(%DFileSize%, %ExpectedSize%)) - TestsFailed("Downloaded file size is NOT the same as expected [is " DFileSize " and should be " ExpectedSize "].") + SetTitleMatchMode, 2 ; A window's title can contain WinTitle anywhere inside it to be a match. + WinWaitActive, of 1 file - Downloads,,10 + if ErrorLevel + TestsFailed("Window 'of 1 file - Downloads' failed to appear (SetTitleMatchMode=2).") else { - Process, Close, %ProcessExe% - Process, WaitClose, %ProcessExe%, 5 - if ErrorLevel ; The PID still exists. - TestsFailed("Unable to terminate '" ProcessExe "' process.") + SetTitleMatchMode, 3 ; A window's title must exactly match WinTitle to be a match. + WinWaitActive, Downloads,,95 ; Should be enought time to download the file? + if ErrorLevel + TestsFailed("'Downloads' window failed to appear, so, downloading failed. Wasn't enough time?") else - TestsOK("File downloaded. Size the same as expected, '" ProcessExe "' process closed.") + { + FileGetSize, DFileSize, %A_Desktop%\livecd-56407-dbg.7z ; Desktop is our download dir. See prepare.ahk + 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%, 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.") + } + } } } } diff --git a/Firefox/2.0.0.20/install_test.ahk b/Firefox/2.0.0.20/install_test.ahk index bef06da..76e7b68 100644 --- a/Firefox/2.0.0.20/install_test.ahk +++ b/Firefox/2.0.0.20/install_test.ahk @@ -28,9 +28,8 @@ IfNotExist, %ModuleExe% else { Process, Close, %MainAppFile% ; Teminate process - Sleep, 2000 - Process, Exist, %MainAppFile% - if ErrorLevel <> 0 + Process, WaitClose, %MainAppFile%, 4 + if ErrorLevel ; The PID still exists. TestsFailed("Unable to terminate '" MainAppFile "' process.") ; So, process still exists else { @@ -40,25 +39,50 @@ 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%\Mozilla Firefox - 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%\Mozilla Firefox + IfNotExist, %szDefaultDir% { - bHardcoded := true ; To know if we got path from registry or not - IfExist, %A_ProgramFiles%\Mozilla Firefox\uninstall\helper.exe + TestsInfo("No previous versions detected in hardcoded path: '" szDefaultDir "'.") + bContinue := true + } + else + { + UninstallerPath = %szDefaultDir%\uninstall\helper.exe /S + ; There is child process, but seems we can not detect it + ; Process Explorer shows that 'Au_.exe' was started by 'Non-existent Process' and we start 'helper.exe' + WaitUninstallDone(UninstallerPath, 3) + if bContinue { - 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).'") + ; 2.0.0.20, 3.0.11, 12.0 starts 'Au_.exe' process + Process, WaitClose, Au_.exe, 7 + if ErrorLevel ; The PID still exists + { + TestsInfo("'Au_.exe' process failed to close.") + Process, Close, Au_.exe + Process, WaitClose, Au_.exe, 3 + if ErrorLevel ; The PID still exists + TestsFailed("Unable to terminate 'Au_.exe' process.") + } else - bContinue := true + { + 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 + } + } + } } } } @@ -67,29 +91,50 @@ else SplitPath, UninstallerPath,, InstalledDir SplitPath, InstalledDir,, InstalledDir ; Split once more, since installer was in subdir (v2.0.0.20 specific) IfNotExist, %InstalledDir% + { + TestsInfo("Got '" InstalledDir "' from registry and such path does not exist.") bContinue := true + } else { - IfExist, %UninstallerPath% + UninstallerPath = %UninstallerPath% /S + WaitUninstallDone(UninstallerPath, 3) + if bContinue { - 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).") + Process, WaitClose, Au_.exe, 7 + if ErrorLevel ; The PID still exists + { + TestsInfo("'Au_.exe' process failed to close.") + Process, Close, Au_.exe + Process, WaitClose, Au_.exe, 3 + if ErrorLevel ; The PID still exists + TestsFailed("Unable to terminate 'Au_.exe' process.") + } else - bContinue := true + { + 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 + } + } + } } } } } + if bContinue { RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\Mozilla @@ -125,7 +170,7 @@ if bContinue TestsFailed("'Extracting' window failed to appear.") else { - OutputDebug, OK: %TestName%:%A_LineNumber%: 'Extracting' window appeared, waiting for it to close.`n + TestsInfo("'Extracting' window appeared, waiting for it to close.") WinWaitClose, Extracting, Cancel, 15 if ErrorLevel TestsFailed("'Extracting' window failed to dissapear.") @@ -146,8 +191,7 @@ if bContinue 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 + ControlClick, Button2 if ErrorLevel TestsFailed("Unable to hit 'Next' in 'Mozilla Firefox Setup (Welcome to the Mozilla Firefox)' window.") else @@ -161,24 +205,23 @@ TestsTotal++ if bContinue { WindowSpace := "Mozilla Firefox Setup " - WinWaitActive, %WindowSpace%, License Agreement, 15 + WinWaitActive, %WindowSpace%, License Agreement, 3 if ErrorLevel TestsFailed("'Mozilla Firefox Setup (License Agreement)' window failed to appear.") else { - Sleep, 700 - ControlClick, Button4, %WindowSpace%, License Agreement ; check 'I accept' radio button + ControlClick, Button4, %WindowSpace%, License Agreement ; check 'I accept' radio button (need to pass all params) if ErrorLevel - TestsFailed("Unable to check 'I agree' radio button in 'License Agreement' window.") + TestsFailed("Unable to check 'I accept' radio button in 'License Agreement' window.") else { - Sleep, 1500 ; Give some time for 'Next' to get enabled - ControlGet, OutputVar, Enabled,, Button2, %WindowSpace%, License Agreement + Sleep, 300 ; Give some time for 'Next' to get enabled + ControlGet, OutputVar, Enabled,, Button2 if not %OutputVar% - TestsFailed("'I agree' radio button is checked in 'License Agreement', but 'Next' button is disabled.") + TestsFailed("'I accept' radio button is checked in 'License Agreement', but 'Next' button is disabled.") else { - ControlClick, Button2, %WindowSpace%, License Agreement + ControlClick, Button2 if ErrorLevel TestsFailed("Unable to hit 'Next' button in 'Mozilla Firefox Setup (License Agreement)' window despite it is enabled.") else @@ -193,13 +236,12 @@ if bContinue TestsTotal++ if bContinue { - WinWaitActive, Mozilla Firefox Setup, Setup Type, 7 + WinWaitActive, Mozilla Firefox Setup, Setup Type, 3 if ErrorLevel TestsFailed("'Mozilla Firefox Setup (Setup Type)' window failed to appear.") else { - Sleep, 700 - ControlClick, Button2, Mozilla Firefox Setup, Setup Type + ControlClick, Button2 if ErrorLevel TestsFailed("Unable to hit 'Next' in 'Mozilla Firefox Setup (Setup Type)' window.") else @@ -212,14 +254,13 @@ if bContinue TestsTotal++ if bContinue { - WinWaitActive, %WindowSpace%, Installing, 7 + WinWaitActive, %WindowSpace%, Installing, 3 if ErrorLevel TestsFailed("'Mozilla Firefox Setup (Installing)' window failed to appear.") else { - Sleep, 700 - OutputDebug, OK: %TestName%:%A_LineNumber%: 'Mozilla Firefox Setup (Installing)' window appeared, waiting for it to close.`n - WinWaitClose, %WindowSpace%, Installing, 25 + TestsInfo("'Mozilla Firefox Setup (Installing)' window appeared, waiting for it to close.") + WinWaitClose, %WindowSpace%, Installing, 25 ; It is a must to pass all parameters if ErrorLevel TestsFailed("'Mozilla Firefox Setup (Installing)' window failed to dissapear.") else @@ -232,13 +273,12 @@ if bContinue TestsTotal++ if bContinue { - WinWaitActive, %WindowSpace%, Completing, 7 + WinWaitActive, %WindowSpace%, Completing, 3 if ErrorLevel TestsFailed("'Mozilla Firefox Setup (Completing)' window failed to appear.") else { - Sleep, 700 - ControlClick, Button4, %WindowSpace%, Completing ; Uncheck 'Launch Mozilla Firefox now' + ControlClick, Button4 ; Uncheck 'Launch Mozilla Firefox now' if ErrorLevel { TestsFailed("Unable to uncheck 'Launch Mozilla Firefox now' in 'Mozilla Firefox Setup (Completing)' window.") @@ -246,26 +286,21 @@ if bContinue } else { - Sleep, 500 - ControlClick, Button2, %WindowSpace%, Completing ; Hit 'Finish' - if ErrorLevel - TestsFailed("Unable to hit 'Finish' button in 'Mozilla Firefox Setup (Completing)' window.") + ControlGet, bChecked, Checked, Button4 + if bChecked = 1 + TestsFailed("'Lounch Firefox now' checkbox in 'Mozilla Firefox Setup (Completing)' window reported as unchecked, but further inspection proves that it was still checked.") else { - WinWaitClose, %WindowSpace%, Completing, 5 + ControlClick, Button2 ; Hit 'Finish' if ErrorLevel - TestsFailed("'Mozilla Firefox Setup (Completing)' window failed to close despite 'Finish' button being clicked.") + TestsFailed("Unable to hit 'Finish' button in 'Mozilla Firefox Setup (Completing)' window.") 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% - } + WinWaitClose,,, 5 + if ErrorLevel + TestsFailed("'Mozilla Firefox Setup (Completing)' window failed to close despite 'Finish' button being clicked.") else - TestsOK("'Mozilla Firefox Setup (Completing)' window appeared, 'Finish' button clicked, window closed, '" MainAppFile "' process did not appear.") + TestsOK("'Mozilla Firefox Setup (Completing)' window appeared, 'Lounch Firefox now' checkbox unchecked, 'Finish' button clicked, window closed.") } } } @@ -277,7 +312,6 @@ if bContinue TestsTotal++ if bContinue { - Sleep, 2000 RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox (2.0.0.20), UninstallString if ErrorLevel TestsFailed("Either we can't read from registry or data doesn't exist.") diff --git a/Firefox/2.0.0.20/prepare.ahk b/Firefox/2.0.0.20/prepare.ahk index b4d5dfc..d5cb9e2 100644 --- a/Firefox/2.0.0.20/prepare.ahk +++ b/Firefox/2.0.0.20/prepare.ahk @@ -46,9 +46,7 @@ if bContinue 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 @@ -63,7 +61,7 @@ if bContinue 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 + szNoWarningOnClose := "user_pref(""browser.tabs.warnOnClose""`, false)`;" ; Now, we do not want any warnings when closing multiple tabs szNoFirstRun := "user_pref(""browser.startup.homepage_override.mstone""`, ""rv:1.8.1.20"")`;" ; 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 @@ -88,7 +86,6 @@ if bContinue else { TestsOK("") - Sleep, 700 } } } diff --git a/Firefox/2.0.0.20/search_bar.ahk b/Firefox/2.0.0.20/search_bar.ahk index 39dabdb..371445b 100644 --- a/Firefox/2.0.0.20/search_bar.ahk +++ b/Firefox/2.0.0.20/search_bar.ahk @@ -35,7 +35,6 @@ else TestsFailed("Can NOT find '" SearchArrowImg "'.") else { - Sleep, 1000 ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *11 %SearchArrowImg% if ErrorLevel = 2 TestsFailed("Could not conduct the ImageSearch.") @@ -44,22 +43,36 @@ else 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 + SendInput, {CTRLDOWN}k{CTRLUP}edijus ; Go to search bar and type 'edijus' + ; copy text to clipboard and compare + clipboard = ; Empty the clipboard + Send, ^a ; Select all + Send, ^c + ClipWait, 2 if ErrorLevel - TestsFailed("'edijus - Yahoo! Search Results - Mozilla Firefox' window failed to appear, so, search bar do not work. Bugs 5574, 5930, 6990?") + TestsFailed("The attempt to copy text onto the clipboard failed.") else { - Process, Close, %ProcessExe% - Process, WaitClose, %ProcessExe%, 5 - if ErrorLevel ; The PID still exists. - TestsFailed("Unable to terminate '" ProcessExe "' process.") + if clipboard <> edijus + TestsFailed("Clipboard content is not the same as expected (is '" clipboard "', should be 'edijus') Can't focus serch bar using Ctrl+K?.") else - TestsOK("'edijus - Yahoo! Search Results - Mozilla Firefox' window appeared, so search bar works, '" ProcessExe "' process closed.") + { + SendInput, {ENTER} + WinWaitActive, edijus - Yahoo! Search Results - Mozilla Firefox,,15 ; Time depends on connection speed + if ErrorLevel + TestsFailed("'edijus - Yahoo! Search Results - Mozilla Firefox' window failed to appear, so, search bar do not work. Bugs 5574, 5930, 6990?") + else + { + Sleep, 5500 ; Let the URL to load, maybe something will fail + 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.") + } + } } } }