From 7eafd95bfa21c9c8603e9c437a9d96dc880d92e7 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Sat, 30 Sep 2006 05:18:39 +0000
Subject: Update selenium to 0.8
---
tests/test_tools/selenium/php/TestRunner.php | 304 +++++++++++-----------
tests/test_tools/selenium/php/TestSuiteHeader.php | 54 ++++
tests/test_tools/selenium/php/selenium.php | 103 ++++++--
3 files changed, 287 insertions(+), 174 deletions(-)
create mode 100644 tests/test_tools/selenium/php/TestSuiteHeader.php
(limited to 'tests/test_tools/selenium/php')
diff --git a/tests/test_tools/selenium/php/TestRunner.php b/tests/test_tools/selenium/php/TestRunner.php
index a82ce0dd..54e46647 100644
--- a/tests/test_tools/selenium/php/TestRunner.php
+++ b/tests/test_tools/selenium/php/TestRunner.php
@@ -1,169 +1,161 @@
-
-
-
-
-
-
-
-Selenium Functional Test Runner
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Selenium Functional Test Runner
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
\ No newline at end of file
+
diff --git a/tests/test_tools/selenium/php/TestSuiteHeader.php b/tests/test_tools/selenium/php/TestSuiteHeader.php
new file mode 100644
index 00000000..6fe2f6b6
--- /dev/null
+++ b/tests/test_tools/selenium/php/TestSuiteHeader.php
@@ -0,0 +1,54 @@
+
+
+
+
+Test Suite
+
+
+
+
+
+
+
+
+
diff --git a/tests/test_tools/selenium/php/selenium.php b/tests/test_tools/selenium/php/selenium.php
index 9ad4955b..1142458f 100644
--- a/tests/test_tools/selenium/php/selenium.php
+++ b/tests/test_tools/selenium/php/selenium.php
@@ -65,12 +65,23 @@ class SeleniumTestStorage
{
protected $outputs = array();
protected $tests = array();
+ protected $options=array();
public function getTests()
{
return $this->tests;
}
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ public function addOption($test_name, $option)
+ {
+ $this->options[$test_name] = $option;
+ }
+
public function addCommand($test_case_id, $command)
{
$data = array($test_case_id, $command);
@@ -105,6 +116,11 @@ class SeleneseInterpreter
return $this->storage->getTests();
}
+ public function getOptions()
+ {
+ return $this->storage->getOptions();
+ }
+
public function getCommand()
{
$command = $this->storage->getCommand();
@@ -115,12 +131,15 @@ class SeleneseInterpreter
{
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);
- $trace = debug_backtrace();
if(is_int(strpos(strtolower($func), 'visible')))
$this->addCommand(array('pause','500',''),$trace);
@@ -128,6 +147,17 @@ class SeleneseInterpreter
return $this->addCommand($command, $trace);
}
+ protected function isTestOptionFunction($func,$args,$trace)
+ {
+ if(strtolower($func)==='skipcondition')
+ {
+ list($trace, $test, $suite) = $this->tracer->getTrace($trace);
+ $this->storage->addOption($test,$args[0]);
+ return true;
+ }
+ return false;
+ }
+
protected function addCommand($command, $trace)
{
list($trace, $test, $suite) = $this->tracer->getTrace($trace);
@@ -236,34 +266,26 @@ class SeleniumTestSuiteWriter
protected function renderHeader()
{
- $contents = <<
-
-
-Test Suite
+ $base_dir = $this->runner->getDriver().'?sr=';
-
+ include(dirname(__FILE__).'/TestSuiteHeader.php');
-
-
-
-
+ $contents = <<{$this->name} |
EOD;
- return $contents;
+ echo $contents;
}
public function render()
{
- echo $this->renderHeader();
+ $this->renderHeader();
foreach($this->suites as $name => $suite)
{
$file = $suite[0]['trace']['file'];
$file = strtr($file,'\\','/');
+ $option = $suite[0]['option']===null?'':' unless="'.$suite[0]['option'].'" ';
$url = $this->runner->getDriver()."?case={$name}&file={$file}";
- echo "\n";
+ echo "
\n";
echo "{$name} | \n";
echo "
\n";
}
@@ -289,7 +311,18 @@ EOD;
{
$trace = '';//$this->getJsTraceInfo();
$contents = <<
+
+
+
+
+ Not supported in this browser
+