From c5f2fb2c77e7140277349d5b1f1a8f6017909dc6 Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 24 Jan 2006 01:49:53 +0000 Subject: Added assertHTMLPresent and assertHTMLNotPresent --- tests/FunctionalTests/selenium/php/selenium.php | 2 ++ .../FunctionalTests/selenium/prado-functional-test.js | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'tests/FunctionalTests') diff --git a/tests/FunctionalTests/selenium/php/selenium.php b/tests/FunctionalTests/selenium/php/selenium.php index e9f7250d..36d86e1e 100644 --- a/tests/FunctionalTests/selenium/php/selenium.php +++ b/tests/FunctionalTests/selenium/php/selenium.php @@ -116,6 +116,8 @@ class SeleneseInterpreter if($ID instanceof TControl) $ID = $ID->ClientID; $value = isset($args[1]) ? $args[1] : ""; + if(strpos(strtolower($func),'htmlpresent') || strpos(strtolower($func),'htmlnotpresent')) + $ID = htmlspecialchars($ID); //$command = "|{$func}|{$ID}|{$value}|"; $command = array($func, $ID, $value); $trace = debug_backtrace(); diff --git a/tests/FunctionalTests/selenium/prado-functional-test.js b/tests/FunctionalTests/selenium/prado-functional-test.js index 37e26516..be2ea795 100644 --- a/tests/FunctionalTests/selenium/prado-functional-test.js +++ b/tests/FunctionalTests/selenium/prado-functional-test.js @@ -172,4 +172,21 @@ function get_color_status(element) if(color == failColor) return "failed"; if(color == doneColor) return "done"; return ""; -} \ No newline at end of file +} + + + + +Selenium.prototype.assertHTMLPresent = function(expectedValue) { + var actualValue = this.page().currentDocument.body.innerHTML; + if(actualValue.indexOf(expectedValue) >= 0) + return; + Assert.fail("Unable to find '"+(expectedValue.replace(//g, ">").replace(/"/g, "\""))+"' in document.body"); +}; + +Selenium.prototype.assertHTMLNotPresent = function(expectedValue) { + var actualValue = this.page().currentDocument.body.innerHTML; + if(actualValue.indexOf(expectedValue) < 0) + return; + Assert.fail("'"+(expectedValue.replace(//g, ">").replace(/"/g, "\""))+"' was found in document.body"); +}; \ No newline at end of file -- cgit v1.2.3