portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asfgr...@apache.org
Subject [04/22] portals-pluto git commit: PLUTO-733 Add Bean Portlet Demo test
Date Thu, 25 Oct 2018 20:19:36 GMT
PLUTO-733 Add Bean Portlet Demo test


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/970a9fa4
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/970a9fa4
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/970a9fa4

Branch: refs/heads/master
Commit: 970a9fa44bcbb4fe56b5590c5e19e2ff2cc32644
Parents: fb03f2f
Author: Kyle Stiemann <stiemannkj1@gmail.com>
Authored: Thu Oct 11 15:27:13 2018 -0400
Committer: Neil Griffin <neil.griffin.scm@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400

----------------------------------------------------------------------
 .../portals/samples/HelloWorldRender.java       |  7 ++-
 .../integration/test/BeanPortletDemoIT.java     | 51 ++++++++++++++++++++
 .../demo/integration/test/PathInfoDemoIT.java   |  2 +-
 3 files changed, 58 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/970a9fa4/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
index c9615f3..536a01d 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
@@ -21,6 +21,7 @@ package org.apache.portals.samples;
 
 import javax.inject.Inject;
 import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
 import javax.portlet.annotations.RenderMethod;
 
 /**
@@ -53,6 +54,9 @@ public class HelloWorldRender {
    
    @Inject
    private RenderRequest req;
+   
+   @Inject
+   private RenderResponse res;
 
    /**
     * Bean portlet render method for "BeanHelloWorld" portlet.
@@ -74,7 +78,8 @@ public class HelloWorldRender {
       }
       txt.append("!!</h3>\n");
       
-      txt.append("<p><table cellspacing='2' cellpadding='0'><tr><td
align='left'>\n");
+      txt.append("<p><table id=\"").append(res.getNamespace());
+      txt.append("_scope_info\" cellspacing='2' cellpadding='0'><tr><td align='left'>\n");
       txt.append("Application Scoped number:</td><td>").append(apprn.getRandomNumber());
       txt.append("</td></tr><tr><td>\n");
       txt.append("Session scoped number:</td><td>").append(sessrn.getRandomNumber());

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/970a9fa4/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
new file mode 100644
index 0000000..e7842dd
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2000-2018 Liferay, Inc. All rights reserved.
+ *
+ * Licensed 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.
+ */
+package org.apache.portals.pluto.demo.integration.test;
+
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class BeanPortletDemoIT extends DemoTestDriver {
+
+   @Test
+   public void testBeanPortletDemo() {
+      navigateToPage("Bean Portlet Demo");
+      By scopeInfoNumbersByXpath = By.xpath(getXpath("table", "BeanPortlet", "scope_info")
+ "//tr/td[2]");
+      waitingAsserter.waitFor(visibilityOfAllElementsLocatedBy(scopeInfoNumbersByXpath));
+      List<WebElement> scopeInfoNumbers = driver.findElements(scopeInfoNumbersByXpath);
+
+      for (WebElement scopeInfoNumber : scopeInfoNumbers) {
+         Assert.assertTrue(Integer.parseInt(scopeInfoNumber.getText().trim()) > 0);
+      }
+
+      sendKeysToElement(driver, waitingAsserter, "(//input[@name='name'][@type='text'])[1]",
"user");
+      clickElement(driver, waitingAsserter, "(//input[@value='send'][@type='submit'])[1]");
+      waitingAsserter.assertTrue(and(
+            visibilityOfElementLocated(By.xpath("//h3[contains(text(),'Hello')][contains(text(),'user!!')]")),
+            visibilityOfElementLocated(By.xpath(getXpath("div", "BeanPortlet", "putResourceHere")
+ "/img"))));
+   }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/970a9fa4/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
index 146ecda..2edc9ad 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
@@ -43,7 +43,7 @@ public class PathInfoDemoIT extends DemoTestDriver{
    public void testPathInfoDemo() {
       navigateToPage("Async Tests");
       By linksByXpath = By.xpath("//h3[text()='Path Info Portlet']/parent::div[@class='body']//a");
-      waitingAsserter.waitFor(visibilityOfElementLocated(linksByXpath));
+      waitingAsserter.waitFor(visibilityOfAllElementsLocatedBy(linksByXpath));
       List<WebElement> links = driver.findElements(linksByXpath);
       List<String> urls = new ArrayList<>();
 


Mime
View raw message