You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/03/28 17:34:37 UTC
svn commit: r1582810 - in
/myfaces/tobago/trunk/tobago-example/tobago-example-test/src:
main/webapp/script/tobago-assert.js
test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
Author: lofwyr
Date: Fri Mar 28 16:34:36 2014
New Revision: 1582810
URL: http://svn.apache.org/r1582810
Log:
tests
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js?rev=1582810&r1=1582809&r2=1582810&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js Fri Mar 28 16:34:36 2014
@@ -21,6 +21,8 @@
var TobagoAssert = {
+ failed: false,
+
assertLeft:function (elementOrId, left, epsilon) {
var element = TobagoAssert.jQueryElement(elementOrId);
epsilon = epsilon != null ? epsilon : 0;
@@ -68,7 +70,14 @@ var TobagoAssert = {
} else {
text = name + ": expected=" + expected + " actual=" + actual;
}
- console.assert(false, text);
+ TobagoAssert.assert(false, text);
+ },
+
+ assert: function (test, text) {
+ console.assert(test, text);
+ if (!test) {
+ TobagoAssert.failed = true;
+ }
},
assertLayout:function (elementOrId, left, top, width, height) {
@@ -81,28 +90,29 @@ var TobagoAssert = {
assertAbsence:function (id) {
var element = document.getElementById(id);
- console.assert(element == null, "The element with id=" + id + " was found, but should not!");
+ var result = element == null;
+ TobagoAssert.assert(result, "The element with id=" + id + " was found, but should not!");
},
assertAttribute:function (elementOrId, attribute, expected) {
- console.assert("value" != attribute,
+ TobagoAssert.assert("value" != attribute,
"The assertAttribute() is not allowed for the value attribute, please use assertValue() instead.");
var element = TobagoAssert.jQueryElement(elementOrId);
- console.assert(element.attr(attribute) == expected,
+ TobagoAssert.assert(element.attr(attribute) == expected,
"The attribute '" + attribute + "' of element with id=" + element.attr('id')
+ " is '" + element.attr(attribute) + "', but expected was '" + expected + "'.");
},
assertValue:function (elementOrId, expected) {
var element = TobagoAssert.jQueryElement(elementOrId);
- console.assert(element.val() == expected,
+ TobagoAssert.assert(element.val() == expected,
"The value of element with id=" + element.attr('id')
+ " is '" + element.val() + "', but expected was '" + expected + "'.");
},
assertContent:function (elementOrId, expected) {
var element = TobagoAssert.jQueryElement(elementOrId);
- console.assert(element.html() == expected,
+ TobagoAssert.assert(element.html() == expected,
"The content of element with id=" + element.attr('id')
+ " is '" + element.html() + "', but expected was '" + expected + "'.");
},
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java?rev=1582810&r1=1582809&r2=1582810&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java Fri Mar 28 16:34:36 2014
@@ -54,7 +54,7 @@ public class TobagoSelenium extends Defa
if (location.endsWith(".xhtml") || location.endsWith(".jspx")) {
try {
if (isErrorOnPage()) {
- Assert.fail(format(HAS_ERROR_SEVERITY, location, html, getErrors()));
+ Assert.fail(format(HAS_ERROR_SEVERITY, location, html, "TobagoAssert.failed"));
}
} catch (final SeleniumException e) {
Assert.fail(format(IS_BROKEN, location, html, "Not a Tobago page? Exception=" + e));
@@ -90,11 +90,7 @@ public class TobagoSelenium extends Defa
* If the page is not a Tobago page, or any other problem with JavaScript or the page.
*/
protected boolean isErrorOnPage() throws SeleniumException {
- final String errorSeverity = getEval("window.LOG.getMaximumSeverity() >= window.LOG.ERROR");
+ final String errorSeverity = getEval("window.TobagoAssert && window.TobagoAssert.failed");
return Boolean.parseBoolean(errorSeverity);
}
-
- protected String getErrors() throws SeleniumException {
- return getEval("window.LOG.getMessages(window.LOG.INFO)");
- }
}