diff --git a/pom.xml b/pom.xml index 478a63903..275221ddf 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 1.6 true lines,vars,source - false + true @@ -206,7 +206,7 @@ meta META-INF - + @@ -315,8 +315,9 @@ + - glassfish-managed + wildfly-managed htmlUnit + false + 8.2.0.Final + - org.jboss.arquillian.container - arquillian-glassfish-managed-3.1 - 1.0.0.CR4 - test + org.wildfly + wildfly-arquillian-container-managed + 8.2.0.Final + test - + javax javaee-api - 6.0 + 7.0 provided - @@ -373,101 +376,38 @@ + bootsfaces-test + org.apache.maven.plugins - maven-failsafe-plugin - 2.18.1 + maven-dependency-plugin + 2.8 + unpack + process-test-classes - integration-test - verify + unpack + + + + org.wildfly + wildfly-dist + ${bootsfaces.arquillian.jboss.version} + zip + false + ${project.build.directory} + + + - - - - - src/test/resources/webapp - - **/* - - - - src/test/resources-arquillian - true - - - - - - - - - wildfly-managed - - - htmlUnit - - - - - - org.wildfly - wildfly-arquillian-container-managed - 8.2.0.Final - test - - - - javax - javaee-api - 6.0 - provided - - - - - com.google.guava - guava - 18.0 - test - - - - org.apache.httpcomponents - httpcore - 4.4.1 - test - - - - - net.sourceforge.htmlunit - htmlunit - 2.16 - test - - - - - - bootsfaces-test - + org.apache.maven.plugins maven-failsafe-plugin @@ -481,14 +421,13 @@ - always org.jboss.logmanager.LogManager - /Users/ysantana/DEVELOPMENT/SERVERS/wildfly-8.2.0.Final - /Users/ysantana/DEVELOPMENT/SERVERS/wildfly-8.2.0.Final/modules + ${project.build.directory}/wildfly-${bootsfaces.arquillian.jboss.version} + ${project.build.directory}/wildfly-${bootsfaces.arquillian.jboss.version}/modules false @@ -496,6 +435,7 @@ + src/test/resources/webapp @@ -504,7 +444,7 @@ - src/test/resources-glassfish-embedded + src/test/resources-arquillian true @@ -514,6 +454,7 @@ + ossrh diff --git a/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxITCase.java b/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxITCase.java index 772243d58..5c673e5d2 100644 --- a/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxITCase.java +++ b/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxITCase.java @@ -5,22 +5,22 @@ */ package net.boostfaces.component; -import net.bootsfaces.layout.*; import java.io.IOException; import javax.inject.Inject; +import javax.persistence.SequenceGenerator; import net.bootsfaces.IntegrationTestsBase; import org.jboss.arquillian.container.test.api.Deployment; +import static org.jboss.arquillian.graphene.Graphene.guardAjax; import org.jboss.arquillian.graphene.GrapheneElement; +import org.jboss.arquillian.graphene.findby.FindByJQuery; import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.Filters; -import org.jboss.shrinkwrap.api.GenericArchive; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.importer.ExplodedImporter; +import org.jboss.arquillian.junit.InSequence; import org.jboss.shrinkwrap.api.spec.WebArchive; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.openqa.selenium.support.FindBy; /** * Simple test which validates the rendered information for b:selectbooleancheckbox tag. @@ -51,14 +51,87 @@ public void setup() throws IOException { browser.get(context + "/faces/SelectBooleanCheckBox.xhtml"); } - @Inject - SelectBooleanCheckBoxSessionBean selectBooleanCheckBoxSessionBean; + @FindBy(id = "chk_1") + private GrapheneElement chk_1; + + @FindBy(id = "chk_2") + private GrapheneElement chk_2; + + @FindBy(id = "chk_3") + private GrapheneElement chk_3; + + @FindBy(id = "cmd") + private GrapheneElement cmd; + + @FindBy(id = "msg") + private GrapheneElement msg; + + @FindByJQuery("#msg li") + private GrapheneElement facesMessage; + + @FindBy(id = "chk_1_label") + private GrapheneElement chk_1_label; + + + @Test - public void renderSelectBooleanCheckBox() { + @InSequence(1) + public void testSelectBooleanCheckBoxRender() { String pageTitle = browser.getTitle(); + //assert page title assertEquals("SelectBooleanCheckBox IT", pageTitle); + + assertTrue("chk_1 rendered failed", chk_1.getAttribute("onchange").equals("var dummy=0;")); + assertTrue("chk_1 rendered failed", chk_1.getAttribute("onselect").equals("var dummy=0;")); } + + @Test + @InSequence(10) + public void testSelectBooleanCheckBoxValidator() { + + //assert that there is no message + assertFalse(facesMessage.isPresent()); + + //unselect the checkBox + chk_2.click(); + + //submit + guardAjax(cmd).click(); + + //assert that there is no message + assertTrue(facesMessage.getText().contains("chk_2 CheckBox value required")); + + } + + @Test + @InSequence(20) + public void testSelectBooleanCheckBoxBinding() { + + //binding value was set in backed bean, must be checked + assertTrue("chk_3 binding failed", chk_3.getAttribute("checked").equals("true")); + } + + + @Test + @InSequence(30) + public void testSelectBooleanCheckBoxValuechangeListener() { + //change listener count is 0 ? + assertTrue(chk_1_label.getText().contains("0")); + + chk_1.click(); + + //submit + guardAjax(cmd).click(); + + //binding value was set in backed bean, must be checked + //change listener count is 0 ? + assertTrue(chk_1_label.getText().contains("1")); + } + + + + } diff --git a/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxSessionBean.java b/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxSessionBean.java index cee3e2fcb..86afda470 100644 --- a/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxSessionBean.java +++ b/src/test/java/net/boostfaces/component/SelectBooleanCheckBoxSessionBean.java @@ -7,7 +7,6 @@ import java.io.Serializable; import javax.enterprise.context.SessionScoped; -import javax.faces.event.AjaxBehaviorEvent; import javax.faces.event.ValueChangeEvent; import javax.inject.Named; import net.bootsfaces.component.SelectBooleanCheckbox; @@ -25,9 +24,8 @@ public class SelectBooleanCheckBoxSessionBean implements Serializable { private int valueChangeCount; private SelectBooleanCheckbox booleanCheckbox; - + public void ajaxAction(){ - boolValue1 = !boolValue1; } public void valueChangeMethod(ValueChangeEvent e){ diff --git a/src/test/java/net/bootsfaces/IntegrationTestsBase.java b/src/test/java/net/bootsfaces/IntegrationTestsBase.java index 8e0ef2e4a..1e04a7259 100644 --- a/src/test/java/net/bootsfaces/IntegrationTestsBase.java +++ b/src/test/java/net/bootsfaces/IntegrationTestsBase.java @@ -41,7 +41,7 @@ public static WebArchive createBaseDeployment() { BeansDescriptor beans = Descriptors.importAs(BeansDescriptor.class) .fromFile(WEBAPP_SRC+"/WEB-INF/beans.xml"); - WebAppDescriptor webDescriptor = Descriptors.importAs(WebAppDescriptor.class) + WebAppDescriptor webDescriptor = Descriptors.importAs(WebAppDescriptor.class) .fromFile(WEBAPP_SRC+"/WEB-INF/web.xml"); diff --git a/src/test/resources-arquillian/arquillian.xml b/src/test/resources-arquillian/arquillian.xml index af755ec8d..dc03a8673 100644 --- a/src/test/resources-arquillian/arquillian.xml +++ b/src/test/resources-arquillian/arquillian.xml @@ -10,11 +10,9 @@ - + - /Users/ysantana/DEVELOPMENT/SERVERS/glassfish4 - localhost - 4848 + diff --git a/src/test/resources/webapp/SelectBooleanCheckBox.xhtml b/src/test/resources/webapp/SelectBooleanCheckBox.xhtml index c929b7a8a..a5de893aa 100644 --- a/src/test/resources/webapp/SelectBooleanCheckBox.xhtml +++ b/src/test/resources/webapp/SelectBooleanCheckBox.xhtml @@ -12,24 +12,25 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/test/resources/webapp/WEB-INF/beans.xml b/src/test/resources/webapp/WEB-INF/beans.xml index 4ca8195be..e4400c1bb 100644 --- a/src/test/resources/webapp/WEB-INF/beans.xml +++ b/src/test/resources/webapp/WEB-INF/beans.xml @@ -1,5 +1,7 @@ + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd" + bean-discovery-mode="all"> +