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 2012/07/31 14:46:23 UTC
svn commit: r1367521 - in
/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src:
main/webapp/tc/sheet/ main/webapp/tc/tree/
test/java/org/apache/myfaces/tobago/example/test/
test/java/org/apache/myfaces/tobago/example/test/tc/sheet/
Author: lofwyr
Date: Tue Jul 31 12:46:22 2012
New Revision: 1367521
URL: http://svn.apache.org/viewvc?rev=1367521&view=rev
Log:
TOBAGO-1174: Easier handling of Selenium tests
- testing sheet
- clean up
Added:
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-bug-tobago-1090.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.xhtml
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.xhtml
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-20.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-20.xhtml
- copied unchanged from r1365546, myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging.xhtml
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-sort.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-with-model.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-without-model.selenium.html
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
Removed:
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging.xhtml
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/MultiSuffixSeleniumTest.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/sheet/
Modified:
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-bug-tobago-1090.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-bug-tobago-1090.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-bug-tobago-1090.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-bug-tobago-1090.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/sheet/sheet-bug-tobago-1090.xhtml</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet:2:name</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>page:sheet::selected</td>
+ <td>,2,</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::pagingPages::Next</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>page:sheet::selected</td>
+ <td>,2,</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet:6:name</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>page:sheet::selected</td>
+ <td>,6,</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::pagingPages::Prev</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>page:sheet::selected</td>
+ <td>,6,</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::pagingPages::Next</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>page:sheet::selected</td>
+ <td>,6,</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/sheet/sheet-paging-1.xhtml</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>css=.tobago-sheet-footer</td>
+ <td>Zeile 1 von 88123456789...Seite 1 von 88</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.xhtml?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.xhtml (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-1.xhtml Tue Jul 31 12:46:22 2012
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<f:view
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <tc:page id="page">
+ <tc:gridLayoutConstraint width="600px" height="600px"/>
+
+ <tc:sheet value="#{sheet.solarArray}" id="s3" columns="*;*" var="luminary" rows="1">
+ <tc:column label="Name" id="name" sortable="true">
+ <tc:out value="#{luminary.name}"/>
+ </tc:column>
+ <tc:column label="Orbit Of" id="orbit">
+ <tc:out value="#{luminary.orbit}"/>
+ </tc:column>
+ </tc:sheet>
+
+ </tc:page>
+</f:view>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/sheet/sheet-paging-11.xhtml</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>css=.tobago-sheet-footer</td>
+ <td>Zeilen 1 bis 11 von 8812345678Seite 1 von 8</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.xhtml?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.xhtml (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-11.xhtml Tue Jul 31 12:46:22 2012
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<f:view
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <tc:page id="page">
+ <tc:gridLayoutConstraint width="600px" height="600px"/>
+ <f:facet name="layout">
+ <tc:gridLayout rows="100px"/>
+ </f:facet>
+
+ <tc:sheet value="#{sheet.solarArray}" id="s2" columns="*;*" var="luminary" rows="11">
+ <tc:column label="Name" id="name" sortable="true">
+ <tc:out value="#{luminary.name}"/>
+ </tc:column>
+ <tc:column label="Orbit Of" id="orbit">
+ <tc:out value="#{luminary.orbit}"/>
+ </tc:column>
+ </tc:sheet>
+
+ </tc:page>
+</f:view>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-20.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-20.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-20.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-paging-20.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/sheet/sheet-paging-20.xhtml</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>css=.tobago-sheet-footer</td>
+ <td>Zeilen 1 bis 20 von 8812345Seite 1 von 5</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-sort.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-sort.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-sort.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-sort.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/sheet/sheet-sort.xhtml</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_0</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>A</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_0</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>Z</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_1</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>Z</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_1</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>Y</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_2</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>Y</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_2</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>X</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_3</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>X</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_3</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>W</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_4</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>W</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_4</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>V</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_5</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>V</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=page:sheet::header_box_5</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementNotPresent</td>
+ <td>css=.tobago-page-overlay</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyText</td>
+ <td>id=page:sheet:0:out</td>
+ <td>U</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/tree/tree-expanded.xhtml</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:reset</td>
+ <td></td>
+</tr>
+<!--node expanded-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:8:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-expanded tobago-treeNode-markup-folder</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//span[@id='page:tree:8:j_id3']/img[2]</td>
+ <td></td>
+</tr>
+<!--node expanded-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:8:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-folder</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:tree:7:j_id4</td>
+ <td></td>
+</tr>
+<!--node collapsed-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:8:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-folder</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-with-model.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-with-model.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-with-model.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-with-model.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/tree/tree-marked-with-model.xhtml</td>
+ <td></td>
+</tr>
+<!--nothing marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:tree:1:command</td>
+ <td></td>
+</tr>
+<!--sports marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-marked</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:reload</td>
+ <td></td>
+</tr>
+<!--nothing marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-marked</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:tree:1:command</td>
+ <td></td>
+</tr>
+<!--sports marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-marked</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-without-model.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-without-model.selenium.html?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-without-model.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-marked-without-model.selenium.html Tue Jul 31 12:46:22 2012
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/tc/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/faces/tc/tree/tree-marked-without-model.xhtml</td>
+ <td></td>
+</tr>
+<!--nothing marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:tree:1:command</td>
+ <td></td>
+</tr>
+<!--sports marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-marked</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:reload</td>
+ <td></td>
+</tr>
+<!--nothing marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=page:tree:1:command</td>
+ <td></td>
+</tr>
+<!--sports marked-->
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:1:node']@class</td>
+ <td>tobago-treeNode tobago-treeNode-markup-marked</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>//div[@id='page:tree:2:node']@class</td>
+ <td>tobago-treeNode</td>
+</tr>
+</tbody></table>
+</body>
+</html>
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java?rev=1367521&r1=1367520&r2=1367521&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java Tue Jul 31 12:46:22 2012
@@ -49,12 +49,12 @@ public class AutomaticSeleniumTest exten
public void testPageConsistency() throws Exception {
SeleniumScript script = getSeleniumScript(url);
- getCommandProcessor().doCommand("open", new String[] {"http://localhost:8080/" + "KillSession", ""});
+ getSelenium().killSession();
for (SeleniumScriptItem item : script.getItems()) {
LOG.info("Calling: " + item);
- getCommandProcessor().doCommand(item.getCommand(), item.getParameters());
- checkPage();
+ getSelenium().command(item.getCommand(), item.getParameters()[0], item.getParameters()[1]);
+ getSelenium().checkPage();
}
}
@@ -75,7 +75,7 @@ public class AutomaticSeleniumTest exten
if (!new File(base).exists()) {
base = "tobago-example/tobago-example-test/" + base;
}
-
+
collect(paths, base, "");
Collections.sort(paths);
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java?rev=1367521&r1=1367520&r2=1367521&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumScript.java Tue Jul 31 12:46:22 2012
@@ -61,6 +61,11 @@ public class SeleniumScript {
DocumentFragment fragment = document.createDocumentFragment();
try {
parser.parse(scriptUrl, fragment);
+ // not nice, it seems that parse also throws a FileNotFoundException sometimes.
+ // XXX I don't know why
+ if (fragment.getTextContent().contains("The page was not found!")) {
+ throw new FileNotFoundException(scriptUrl);
+ }
addSeleniumItems(fragment, url);
} catch (FileNotFoundException e) {
// using default
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java?rev=1367521&r1=1367520&r2=1367521&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java Tue Jul 31 12:46:22 2012
@@ -17,10 +17,6 @@ package org.apache.myfaces.tobago.exampl
* limitations under the License.
*/
-import com.thoughtworks.selenium.CommandProcessor;
-import com.thoughtworks.selenium.DefaultSelenium;
-import com.thoughtworks.selenium.HttpCommandProcessor;
-import com.thoughtworks.selenium.SeleniumException;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -31,106 +27,23 @@ public abstract class SeleniumTest {
// private static final String CONTEXT_PATH = "tobago-example-test";
private static final String SERVLET_MAPPING = "faces";
- public static final String ERROR_ON_SERVER = "error on server";
- public static final String HAS_ERROR_SEVERITY = "has error severity";
- public static final String IS_BROKEN = "is broken";
-
- @Deprecated
- private static DefaultSelenium selenium;
- private static CommandProcessor commandProcessor;
+ private static TobagoSelenium selenium;
@BeforeClass
public static void setUp() throws Exception {
- selenium = createSeleniumClient();
+ selenium = new TobagoSelenium("http://localhost:8080/");
selenium.start();
-//todo alternative commandProcessor.start();
}
@AfterClass
public static void tearDown() throws Exception {
selenium.stop();
-//todo alternative commandProcessor.stop();
}
- @Deprecated
- protected DefaultSelenium getSelenium() {
+ protected TobagoSelenium getSelenium() {
return selenium;
}
- protected CommandProcessor getCommandProcessor() {
- return commandProcessor;
- }
-
- protected static DefaultSelenium createSeleniumClient() throws Exception {
- commandProcessor = new HttpCommandProcessor("localhost", 4444, "*firefox", "http://localhost:8080/");
- return new DefaultSelenium(commandProcessor);
- }
-
- protected void waitForAjaxComplete() {
- getSelenium().waitForCondition(
- "selenium.browserbot.getCurrentWindow().document.getElementsByClassName('tobago-page-overlay').length == 0",
- "5000"
- );
- }
-
- protected void checkPage() {
- final String location = selenium.getLocation();
- final String html = getHtmlSource();
- if (errorOnServer()) {
- Assert.fail(format(ERROR_ON_SERVER, location, html, ""));
- }
- if (location.endsWith(".xhtml") || location.endsWith(".jspx")) {
- try {
- if (isErrorOnPage()) {
- Assert.fail(format(HAS_ERROR_SEVERITY, location, html, getErrors()));
- }
- } catch (SeleniumException e) {
- Assert.fail(format(IS_BROKEN, location, html, "Not a Tobago page? Exception=" + e));
- }
- }
- }
-
- public String format(String error, String location, String html, String options) {
- StringBuilder b = new StringBuilder();
- b.append(error);
- b.append("\nPage URL: ");
- b.append(location);
- b.append("\n");
- b.append(options);
- b.append("\n---------------------------------------------------------------------------------------------------\n");
- b.append(html);
- b.append("\n---------------------------------------------------------------------------------------------------\n");
- return b.toString();
- }
-
- /**
- * Happen an exception from MyFaces on the page?
- */
- protected boolean errorOnServer() {
- return selenium.getHtmlSource().contains("An Error Occurred");
- }
-
- /**
- * Checks the page for the Tobago JavaScript Logging Framework and tests its severity.
- *
- * @return True if the severity level of the page is error
- * @throws com.thoughtworks.selenium.SeleniumException
- * If the page is not a Tobago page, or any other problem with JavaScrpt or the page.
- */
- protected boolean isErrorOnPage() throws SeleniumException {
- String errorSeverity = selenium.getEval("window.LOG.getMaximumSeverity() >= window.LOG.ERROR");
- return Boolean.parseBoolean(errorSeverity);
- }
-
- protected String getErrors() throws SeleniumException {
- String errors = selenium.getEval("window.LOG.getMessages(window.LOG.INFO)");
- return errors;
- }
-
- protected String getHtmlSource() {
- return selenium.getHtmlSource();
- }
-
protected static String createUrl(String page) {
Assert.assertTrue("Page name must start with a slash.", page.startsWith("/"));
if (CONTEXT_PATH.length() == 0) {
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java?rev=1367521&r1=1367520&r2=1367521&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java Tue Jul 31 12:46:22 2012
@@ -25,7 +25,7 @@ public class SimpleSeleniumTest extends
@Test
public void testHelloWorld() {
getSelenium().open("/faces/simple.xhtml");
- checkPage();
+ getSelenium().checkPage();
Assert.assertEquals("Simple Test", getSelenium().getValue("page:in"));
getSelenium().captureScreenshot(SimpleSeleniumTest.class.getName() + ".testHelloWorld.png");
}
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java?rev=1367521&r1=1367520&r2=1367521&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java Tue Jul 31 12:46:22 2012
@@ -98,7 +98,7 @@ public class TestTheAutomaticSeleniumTes
Assert.fail("The test should fail, but wasn't.");
} catch (AssertionError e) {
- if (e.getMessage().contains(AutomaticSeleniumTest.HAS_ERROR_SEVERITY)) {
+ if (e.getMessage().contains(TobagoSelenium.HAS_ERROR_SEVERITY)) {
// okay, the error was detected.
} else {
throw e;
@@ -117,7 +117,7 @@ public class TestTheAutomaticSeleniumTes
Assert.fail("The test should fail, but wasn't.");
} catch (AssertionError e) {
- if (e.getMessage().contains(AutomaticSeleniumTest.IS_BROKEN)) {
+ if (e.getMessage().contains(TobagoSelenium.IS_BROKEN)) {
// okay, the error was detected.
} else {
throw e;
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java?rev=1367521&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java Tue Jul 31 12:46:22 2012
@@ -0,0 +1,98 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.HttpCommandProcessor;
+import com.thoughtworks.selenium.SeleniumException;
+import org.junit.Assert;
+
+public class TobagoSelenium extends DefaultSelenium {
+
+ public static final String ERROR_ON_SERVER = "error on server";
+ public static final String HAS_ERROR_SEVERITY = "has error severity";
+ public static final String IS_BROKEN = "is broken";
+
+ private String browserUrl;
+
+ public TobagoSelenium(String browserUrl) {
+ super(new HttpCommandProcessor("localhost", 4444, "*firefox", browserUrl));
+ this.browserUrl = browserUrl;
+ }
+
+ public String command(String command, String parameter1, String parameter2) {
+ return commandProcessor.doCommand(command, new String[]{parameter1, parameter2});
+ }
+
+ public void killSession() {
+ open(browserUrl + "KillSession");
+ }
+
+ public void checkPage() {
+ final String location = getLocation();
+ final String html = getHtmlSource();
+ if (errorOnServer()) {
+ Assert.fail(format(ERROR_ON_SERVER, location, html, ""));
+ }
+ if (location.endsWith(".xhtml") || location.endsWith(".jspx")) {
+ try {
+ if (isErrorOnPage()) {
+ Assert.fail(format(HAS_ERROR_SEVERITY, location, html, getErrors()));
+ }
+ } catch (SeleniumException e) {
+ Assert.fail(format(IS_BROKEN, location, html, "Not a Tobago page? Exception=" + e));
+ }
+ }
+ }
+
+ public String format(String error, String location, String html, String options) {
+ StringBuilder b = new StringBuilder();
+ b.append(error);
+ b.append("\nPage URL: ");
+ b.append(location);
+ b.append("\n");
+ b.append(options);
+ b.append("\n---------------------------------------------------------------------------------------------------\n");
+ b.append(html);
+ b.append("\n---------------------------------------------------------------------------------------------------\n");
+ return b.toString();
+ }
+
+ /**
+ * Happen an exception from MyFaces on the page?
+ */
+ protected boolean errorOnServer() {
+ return getHtmlSource().contains("An Error Occurred");
+ }
+
+ /**
+ * Checks the page for the Tobago JavaScript Logging Framework and tests its severity.
+ *
+ * @return True if the severity level of the page is error
+ * @throws com.thoughtworks.selenium.SeleniumException
+ * If the page is not a Tobago page, or any other problem with JavaScrpt or the page.
+ */
+ protected boolean isErrorOnPage() throws SeleniumException {
+ String errorSeverity = getEval("window.LOG.getMaximumSeverity() >= window.LOG.ERROR");
+ return Boolean.parseBoolean(errorSeverity);
+ }
+
+ protected String getErrors() throws SeleniumException {
+ return getEval("window.LOG.getMessages(window.LOG.INFO)");
+ }
+}