[AHK_Firefox12.0]

prepare.ahk: add EnterURL() function, so, we don't need duplicate code;
address_bar.ahk: use EnterURL() function;
Test succeeds in win2k3 SP1.

svn path=/trunk/ahk_tests/; revision=1997
This commit is contained in:
Edijs Kolesnikovičs 2013-04-05 04:16:17 +00:00
parent b365da483e
commit 6b3c82a315
2 changed files with 59 additions and 23 deletions

View File

@ -29,33 +29,23 @@ else
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
else
{
SendInput, {ALTDOWN}d{ALTUP} ; Go to address bar
; copy text to clipboard and compare
clipboard = ; Empty the clipboard
Send, ^c
ClipWait, 2
if ErrorLevel
TestsFailed("The attempt to copy text onto the clipboard failed.")
else
TestsTotal++
EnterURL("http://dsx86.patrickaalto.com")
if bContinue
{
if clipboard <> about:home
TestsFailed("Clipboard content is not the same as expected (is '" clipboard "', should be 'about:home') Can't focus address bar using Alt+D?.")
; 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
{
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).")
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
{
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.")
}
TestsOK("'DSx86 by Patrick Aalto - Mozilla Firefox' window appeared, so typing URL works (Alt+D), '" ProcessExe "' process closed.")
}
}
}

View File

@ -122,3 +122,49 @@ if bContinue
}
}
}
EnterURL(TheURL)
{
global TestName
global bContinue
global TestsTotal
IfWinNotActive, Mozilla Firefox Start Page - Mozilla Firefox
TestsFailed("'Mozilla Firefox Start Page - Mozilla Firefox' is not active window.")
else
{
SendInput, {ALTDOWN}d{ALTUP} ; Go to address bar
; copy text to clipboard and compare
clipboard = ; Empty the clipboard
Send, ^c
ClipWait, 2
if ErrorLevel
TestsFailed("The attempt to copy text onto the clipboard failed.")
else
{
if clipboard <> about:home
TestsFailed("Clipboard content is not the same as expected (is '" clipboard "', should be 'about:home') Can't focus address bar using Alt+D?.")
else
{
SendInput, %TheURL%
clipboard = ; Empty the clipboard
Send, ^a ; Ctrl+A
Send, ^c ; Ctrl+C
ClipWait, 2
if ErrorLevel
TestsFailed("The attempt to copy text onto the clipboard failed when entering '" TheURL "'.")
else
{
IfNotInString, TheURL, %clipboard%
TestsFailed("Entered URL to addressbar, copied it and clipboard content is wwrong. Is '" clipboard "', should be '" TheURL "'.")
else
{
SendInput, {ENTER} ; Go to URL
TestsOK("Entered '" TheURL "' successfully and sent ENTER to go to it.")
}
}
}
}
}
}