summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorwei <>2006-10-01 10:37:06 +0000
committerwei <>2006-10-01 10:37:06 +0000
commit9fee2935d91e92235b068632d3608c748ef41bfe (patch)
tree4e05ba6e0fb298ef7c935c3e0082409cec766fd8 /tests
parent36f2ce766bde98c11d57b889fd9e1a7f8dff6010 (diff)
fix image button, update functional test cases for opera
Diffstat (limited to 'tests')
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php3
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php3
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php2
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php3
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php3
-rw-r--r--tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php30
-rw-r--r--tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php47
-rw-r--r--tests/test_tools/selenium/php/selenium.php27
8 files changed, 109 insertions, 9 deletions
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php
index a66cf853..03081f9e 100644
--- a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php
@@ -4,6 +4,9 @@ class ActiveCheckBoxListTestCase extends SeleniumTestCase
{
function test()
{
+ //problem with test runner clicking on radio buttons
+ $this->skipBrowsers(self::OPERA);
+
$this->open("active-controls/index.php?page=TActiveCheckBoxListTest");
$this->verifyTextPresent("TActiveCheckBoxList Test Case");
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php
index 6bf00f05..ce2ce430 100644
--- a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php
@@ -4,6 +4,9 @@ class ActiveCheckBoxTestCase extends SeleniumTestCase
{
function test()
{
+ //problem with test runner clicking on checkboxes
+ $this->skipBrowsers(self::OPERA);
+
$this->open("active-controls/index.php?page=ActiveCheckBoxTest");
$this->verifyTextPresent("Active CheckBox Test");
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php
index 3d9937bd..d497e915 100644
--- a/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php
@@ -10,7 +10,7 @@ class ActiveImageButtonTestCase extends SeleniumTestCase
$this->click("image1");
$this->pause(800);
//unable to determine mouse position
- $this->assertTextPresent("Image clicked at x=0, y=0");
+ $this->assertTextPresent("regexp:Image clicked at x=\d+, y=\d+");
}
}
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php
index 386caa55..ce269cd1 100644
--- a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php
@@ -4,6 +4,9 @@ class ActiveRadioButtonListTestCase extends SeleniumTestCase
{
function test()
{
+ //problem with test runner clicking on radio buttons
+ $this->skipBrowsers(self::OPERA);
+
$this->open("active-controls/index.php?page=ActiveRadioButtonListTest");
$this->verifyTextPresent("TActiveRadioButtonList Test Case");
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php
index c21426cb..46925960 100644
--- a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php
@@ -4,6 +4,9 @@ class ActiveRadioButtonTestCase extends SeleniumTestCase
{
function test()
{
+ //problem with test runner clicking on radio buttons
+ $this->skipBrowsers(self::OPERA);
+
$this->open("active-controls/index.php?page=ActiveRadioButtonTest");
$this->verifyTextPresent("Active Radio Button Test");
$this->assertText('label1', 'Label 1');
diff --git a/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php b/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php
index e49eb513..c733a7fd 100644
--- a/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php
@@ -4,6 +4,8 @@ class CallbackAdapterTestCase extends SeleniumTestCase
{
function test()
{
+ $this->skipBrowsers(self::INTERNET_EXPLORER);
+
$this->open("active-controls/index.php?page=ControlAdapterTest");
$this->assertTextPresent('Control Adapter - State Tracking Tests');
@@ -27,6 +29,34 @@ class CallbackAdapterTestCase extends SeleniumTestCase
$this->assertAlert('baz!');
}
+
+ function testIE()
+ {
+ $this->targetBrowsers(self::INTERNET_EXPLORER);
+
+ $this->open("active-controls/index.php?page=ControlAdapterTest");
+ $this->assertTextPresent('Control Adapter - State Tracking Tests');
+
+ $this->click('button2');
+ $this->assertAlert('ok');
+
+ $this->click('test6');
+ $this->pause(800);
+ $this->click('test7');
+ $this->pause(800);
+ $this->click('test8');
+ $this->pause(800);
+ $this->click('test9');
+ $this->pause(800);
+
+ $this->click('button1');
+ $this->assertAlert('haha!');
+
+ //IE alerts in diffrent order
+ $this->click('button2');
+ $this->assertAlert('baz!');
+ $this->assertAlert('ok');
+ }
}
?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php
index be0d0645..b90607e6 100644
--- a/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php
@@ -4,6 +4,8 @@ class ReplaceContentTestCase extends SeleniumTestCase
{
function test()
{
+ $this->skipBrowsers(self::INTERNET_EXPLORER);
+
$this->open('active-controls/index.php?page=ReplaceContentTest');
$this->assertTextPresent('Callback Replace Content Test');
@@ -43,6 +45,51 @@ class ReplaceContentTestCase extends SeleniumTestCase
$this->assertText('panel1', 'Main Panel pradomauahahahaphp');
}
+
+ function testIE()
+ {
+ $this->targetBrowsers(self::INTERNET_EXPLORER);
+
+ $this->open('active-controls/index.php?page=ReplaceContentTest');
+ $this->assertTextPresent('Callback Replace Content Test');
+
+ $this->assertText('subpanel', 'Sub Panel');
+ $this->assertText('panel1', 'regexp:Main Panel\s*Sub Panel');
+
+ $this->type('content', 'something');
+
+ $this->click('btn_append');
+ $this->pause(800);
+
+ $this->assertText('subpanel', 'Sub Panel something');
+ $this->assertText('panel1', 'regexp:Main Panel\s*Sub Panel\s*something');
+
+ $this->type('content', 'more');
+ $this->click('btn_prepend');
+ $this->pause(800);
+
+ $this->assertText('subpanel', 'regexp:more\s*Sub Panel\s*something');
+ $this->assertText('panel1', 'regexp:Main Panel\s*moreSub Panel\s*something');
+
+
+ $this->type('content', 'prado');
+ $this->click('btn_before');
+ $this->pause(800);
+
+ $this->assertText('subpanel', 'regexp:more\s*Sub Panel\s*something');
+ $this->assertText('panel1', 'regexp:Main Panel\s*prado\s*more\s*Sub Panel\s*something');
+
+ $this->type('content', ' php ');
+ $this->click('btn_after');
+ $this->pause(800);
+
+ $this->type('content', 'mauahahaha');
+ $this->click('btn_replace');
+ $this->pause(1000);
+
+ $this->assertText('panel1', 'Main Panel pradomauahahahaphp');
+ }
+
}
?> \ No newline at end of file
diff --git a/tests/test_tools/selenium/php/selenium.php b/tests/test_tools/selenium/php/selenium.php
index fcbbe562..bfba617a 100644
--- a/tests/test_tools/selenium/php/selenium.php
+++ b/tests/test_tools/selenium/php/selenium.php
@@ -49,7 +49,7 @@ class SeleniumTestRunner
if((php_sapi_name() == 'cli')) return;
$file = dirname(__FILE__).'/TestRunner.php';
$driver = $this->driver;
-
+
//$base_dir = $this->base_dir;
$base_dir = $driver.'?sr=';
include($file);
@@ -130,20 +130,20 @@ class SeleneseInterpreter
public function __call($func, $args)
{
if($func{0} == '_') return;
-
+
$trace = debug_backtrace();
if($this->isTestOptionFunction($func,$args,$trace))
return;
-
+
$ID = isset($args[0]) ? $args[0] : "";
$value = isset($args[1]) ? $args[1] : "";
if(strpos(strtolower($func),'htmlpresent') || strpos(strtolower($func),'htmlnotpresent'))
$ID = htmlspecialchars($ID);
$command = array($func, $ID, $value);
-
+
if(is_int(strpos(strtolower($func), 'visible')))
$this->addCommand(array('pause','500',''),$trace);
-
+
return $this->addCommand($command, $trace);
}
@@ -416,7 +416,7 @@ class SeleniumTestRunnerServer
$case = $command[5];
$option=isset($options[$case])?$options[$case]:null;
$this->cases[$case][] =
- array('test' => $command[2],
+ array('test' => $command[2],
'trace' => $command[4], 'option'=>$option);
if(is_null($this->name))
$this->name = $command[6];
@@ -528,7 +528,12 @@ class SeleniumTestCase extends UnitTestCase
function skipBrowsers()
{
- $arg_list = func_get_args();
+ $conditions = $this->getBrowserOptions(func_get_args());
+ $this->selenium->skipCondition($conditions);
+ }
+
+ protected function getBrowserOptions($arg_list)
+ {
$browsers=array();
foreach($arg_list as $arg)
{
@@ -537,7 +542,13 @@ class SeleniumTestCase extends UnitTestCase
else
$browsers[] = $arg;
}
- $this->selenium->skipCondition(implode(' || ', $browsers));
+ return implode(' || ', $browsers);
+ }
+
+ function targetBrowsers()
+ {
+ $conditions = $this->getBrowserOptions(func_get_args());
+ $this->selenium->skipCondition("!(".$conditions.")");
}
}