[AHK_Firefox_2.0.0.20]

Add prepare.ahk, test for search bar and update zz_firefox_2.0.0.20_test.ahk to have all parameters.
Tested and works on win2k3  SP3.

svn path=/trunk/ahk_tests/; revision=1515
This commit is contained in:
Edijs Kolesnikovičs 2012-08-16 17:07:39 +00:00
parent a074ab3a49
commit ffe284d249
3 changed files with 197 additions and 3 deletions

View File

@ -0,0 +1,105 @@
/*
* Designed for Mozilla Firefox 2.0.0.20
* 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
*/
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 (2.0.0.20), 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
{
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.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
szDownloadDir := "user_pref(""browser.download.folderList""`, 0)`;" ; Desktop is our default download directory
szNoDefBrowser := "user_pref(""browser.shell.checkDefaultBrowser""`, false)`;" ; Do not check if it is default browser
FileAppend, %szNoWarningOnClose%`n%szNoFirstRun%`n%szRightsShown%`n%szNoImprvHelp%`n`n%szDownloadDir%`n%szNoDefBrowser%, %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
bContinue := false
}
}
else
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to create and edit '%A_AppData%\Mozilla\Firefox\Profiles\ReactOS.default\prefs.js'.`n
bContinue := false
}
}
else
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to create and edit '%A_AppData%\Mozilla\Firefox\profiles.ini'.`n
bContinue := false
}
}
else
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to create dir tree '%A_AppData%\Mozilla\Firefox\ReactOS.default'.`n
bContinue := false
}
}
else
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Seems like we failed to delete '%A_AppData%\Mozilla'.`n
bContinue := false
}
}
else
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Can NOT find '%ModuleExe%'.`n
bContinue := false
}

View File

@ -0,0 +1,77 @@
/*
* Designed for Mozilla Firefox 2.0.0.20
* 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 = 4.search_bar
; Check if we can change search engine to Yahoo! and type inside search field
TestsTotal++
if bContinue
{
IfWinActive, Mozilla Firefox Start Page - Mozilla Firefox
{
SearchArrowImg = %A_WorkingDir%\Media\FF_2_Search_Arrow.jpg
Sleep, 1000
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *11 %SearchArrowImg%
if ErrorLevel = 2
{
TestsFailed++
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Could not conduct the ImageSearch (%SearchArrowImg% is missing?).`n
bContinue := false
}
else if ErrorLevel = 1
{
TestsFailed++
OutputDebug, %TestName%:%A_LineNumber%: Test failed: The search arrow image %SearchArrowImg% could NOT be found on the screen.`n
bContinue := false
}
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++
OutputDebug, OK: %TestName%:%A_LineNumber%: 'edijus - Yahoo! Search Results - Mozilla Firefox' window appeared, so search bar works.`n
bContinue := true
}
else
{
TestsFailed++
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'edijus - Yahoo! Search Results - Mozilla Firefox' window failed to appear, so, search bar do not work. Bugs 5574, 5930, 6990?. Active window caption: '%title%'.`n
bContinue := false
}
}
}
else
{
TestsFailed++
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'Mozilla Firefox Start Page - Mozilla Firefox' is not active window. Active window caption: '%title%'.`n
bContinue := false
}
}
Process, Close, firefox.exe ; Teminate process

View File

@ -36,6 +36,21 @@ else if 1 = 1.install
}
else
{
#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
OutputDebug, Bad parameters: '%1%'!`r`n
}
@ -47,9 +62,6 @@ if 1 != --list
WindowCleanUp(fName)
}
; Delete saved settings
Sleep, 1500
FileRemoveDir, %A_AppData%\Mozilla, 1
TestsSkipped := TestsTotal - TestsOK - TestsFailed
TestsExecuted := TestsOK + TestsFailed