You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2019/01/23 14:21:04 UTC

[myfaces] branch master updated: MYFACES-4265: adding next test

This is an automated email from the ASF dual-hosted git repository.

werpu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c0f6c5  MYFACES-4265: adding next test
8c0f6c5 is described below

commit 8c0f6c556ce47598d04b10a3d11ec69eeabde89d
Author: Werner Punz <we...@gmail.com>
AuthorDate: Wed Jan 23 15:20:56 2019 +0100

    MYFACES-4265: adding next test
---
 .../ajax/test1Protocol/ResponseMockup.java         |  2 +-
 .../ajax/src/main/webapp/test4-tablebasic.xhtml    | 96 ++++++++++++++++++++++
 .../integrationtests/ajax/IntegrationTest.java     | 15 ++++
 3 files changed, 112 insertions(+), 1 deletion(-)

diff --git a/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/ResponseMockup.java b/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/ResponseMockup.java
index bb70ebe..349b5b4 100644
--- a/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/ResponseMockup.java
+++ b/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/ResponseMockup.java
@@ -100,7 +100,7 @@ public class ResponseMockup extends HttpServlet
             } else if (op.trim().toLowerCase().equals("updateinsert2"))
             {
                 Changes changes = new Changes(root);
-                changes.addChild(new Update(changes, "changesArea", "<div id='changesArea'>update succeeded " + (cnt++) + "</div><script type='text/javascript'>document.getElementById('evalarea2').innerHTML='embedded script at update succeed';</script>"));
+                changes.addChild(new Update(changes, "changesArea", "<div id='changesArea'>update succeeded 1</div><script type='text/javascript'>document.getElementById('evalarea2').innerHTML='embedded script at update succeed';</script>"));
                 changes.addChild(new Insert2(changes, "inserted1", "<div id='insertbefore'>insert2 before succeeded " +
                         "should display before test1</div><script type='text/javascript'>document.getElementById('evalarea3').innerHTML='embedded script at insert succeed';</script>", "changesArea", null));
                 changes.addChild(new Insert2(changes, "inserted2", "<div  id='insertafter'>insert2 after succeeded " +
diff --git a/integration-tests/ajax/src/main/webapp/test4-tablebasic.xhtml b/integration-tests/ajax/src/main/webapp/test4-tablebasic.xhtml
new file mode 100644
index 0000000..28134ae
--- /dev/null
+++ b/integration-tests/ajax/src/main/webapp/test4-tablebasic.xhtml
@@ -0,0 +1,96 @@
+<!--
+    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.
+-->
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:h="http://xmlns.jcp.org/jsf/html"
+>
+
+<h:head>
+    <title>test</title>
+    <h:outputScript library="javax.faces" name="jsf.js"/>
+    <script type="text/javascript" src="./scripts/testhelpers.js"></script>
+
+</h:head>
+
+<h:body>
+    <h1>Table Tests</h1>
+
+    <h2>Table tests for the basic protocol operations. Due to the different
+        handling of table elements in the dom operations (especially in legacy browsers), t
+        his separate test is was written. It probably will be obsolete with JSF 3.0 because
+        most of the legacy support except for IE11 will be cut off by then.
+
+    </h2>
+
+
+    <div id="testTable">
+
+
+        <table id="table1">
+            <thead id="head1">
+            <tr id="head_row1">
+                <td id="head_col1">column1 in line1</td>
+                <td id="head_col2">colum2 in line2</td>
+            </tr>
+            </thead>
+            <tbody id="tbody1">
+            <tr id="body_row1">
+                <td id="body_row1_col1">column1 in line1 body</td>
+                <td id="body_row1_col2">column2 in line1
+                    body
+                </td>
+            </tr>
+            </tbody>
+
+        </table>
+
+    </div>
+
+
+    <form id="form2" action="boog.html">
+        <input type="button" id="replace_head" value="replace head" onclick="emitPPR(this,
+        ('undefined' == typeof event)? null:
+        event,
+    'table_replace_head','form2');"></input>
+        <input type="button" id="replace_body" value="replace body" onclick="emitPPR(this,
+        ('undefined' == typeof event)? null:
+        event,
+        'table_replace_body','form2');"></input>
+        <input type="button" id="insert_row_head" value="insert row in head" onclick="emitPPR(this,
+        ('undefined' == typeof event)? null: event,
+        'table_insert_row_head','form2');"></input>
+        <input type="button" id="insert_row_body" value="insert insert row in body" onclick="emitPPR(this,
+        ('undefined' == typeof event)? null: event,
+        'table_insert_row_body','form2');"></input>
+        <input type="button" id="insert_column_head" value="insert column in head" onclick="emitPPR(this,
+        ('undefined' == typeof event)? null: event,
+        'table_insert_column_head','form2');"></input>
+        <input type="button" id="insert_column_body" value="insert column in body" onclick="emitPPR(this,
+        ('undefined' == typeof event)? null: event,
+        'table_insert_column_body','form2');"></input>
+        <input type="button" value="insert footer" onclick="emitPPR(this, ('undefined' == typeof event)? null: event,
+        'table_insert_footer',
+        'form2');"></input>
+        <input type="button" id="insert_body" value="insert body" onclick="emitPPR(this,
+        ('undefined' == typeof event)? null:
+            event,
+        'table_insert_body','form2');"></input>
+    </form>
+</h:body>
+</html>
\ No newline at end of file
diff --git a/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java b/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
index bcb97eb..fd368a0 100644
--- a/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
+++ b/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
@@ -31,8 +31,10 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
 import org.openqa.selenium.JavascriptExecutor;
 import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
 import org.openqa.selenium.support.ByIdOrName;
 
 import java.io.File;
@@ -185,6 +187,19 @@ public class IntegrationTest {
     }
 
 
+    @Test
+    public void testBasicTable() {
+        webDriver.get(contextPath + "test4-tablebasic.jsf");
+
+        trigger("replace_head", webDriver -> {
+            final WebElement testTable = webDriver.findElement(new By.ById("testTable"));
+            System.out.println(testTable.getText());
+            return testTable.getText().contains("column1 in line1 replaced") &&
+                    testTable.getText().contains("script evaled0");
+        });
+    }
+
+
     /**
      * recurring trigger, wait until ajax processing is done function
      *