Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RepeatedDrone tests and OpenShift container
- Loading branch information
Showing
8 changed files
with
228 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
drone-demo/src/test/java/com/acme/example/test/AjocadoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.acme.example.test; | ||
|
||
import static org.jboss.arquillian.ajocado.Ajocado.guardXhr; | ||
import static org.jboss.arquillian.ajocado.Ajocado.id; | ||
|
||
import java.net.URL; | ||
|
||
import org.jboss.arquillian.ajocado.framework.AjaxSelenium; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.drone.api.annotation.Drone; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.jboss.shrinkwrap.resolver.api.maven.MavenImporter; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Arquillian.class) | ||
public class AjocadoTest { | ||
|
||
@ArquillianResource | ||
URL contextPath; | ||
|
||
@Deployment(testable = false) | ||
public static Archive<?> getApplicationDeployment() { | ||
return ShrinkWrap.create(MavenImporter.class).loadEffectivePom("pom.xml").importBuildOutput().as(WebArchive.class); | ||
} | ||
|
||
@Test | ||
public void xhrAjocadoTest(@Drone AjaxSelenium ajocado) { | ||
ajocado.open(contextPath); | ||
|
||
ajocado.type(id("name"), "Samuel Vimes"); | ||
ajocado.type(id("email"), "samuel@vimes.dw"); | ||
ajocado.type(id("phoneNumber"), "1234567890"); | ||
|
||
// see the guard? we are waiting for an XHR request here | ||
guardXhr(ajocado).click(id("register")); | ||
|
||
Assert.assertTrue("Vimes was registered", ajocado.isTextPresent("Samuel Vimes")); | ||
} | ||
|
||
} |
15 changes: 0 additions & 15 deletions
15
drone-demo/src/test/java/com/acme/example/test/Chrome1.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
drone-demo/src/test/java/com/acme/example/test/Chrome2.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
drone-demo/src/test/java/com/acme/example/test/RepeatedDroneTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.acme.example.test; | ||
|
||
import java.net.URL; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.drone.api.annotation.Drone; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.jboss.shrinkwrap.resolver.api.maven.MavenImporter; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
@RunWith(Arquillian.class) | ||
public class RepeatedDroneTest { | ||
|
||
@ArquillianResource | ||
URL contextPath; | ||
|
||
@Deployment(testable = false) | ||
public static Archive<?> getApplicationDeployment() { | ||
return ShrinkWrap.create(MavenImporter.class).loadEffectivePom("pom.xml").importBuildOutput().as(WebArchive.class); | ||
} | ||
|
||
@Test | ||
public void simpleWebdriverTest(@Drone WebDriver webdriver) { | ||
webdriver.get(contextPath.toString()); | ||
|
||
webdriver.findElement(By.id("name")).sendKeys("Samuel"); | ||
webdriver.findElement(By.id("email")).sendKeys("samuel@vimes.dw"); | ||
webdriver.findElement(By.id("phoneNumber")).sendKeys("1234567890"); | ||
webdriver.findElement(By.id("register")).submit(); | ||
|
||
// FIXME with Ajocado, you can wait for a request | ||
Assert.assertTrue(true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://jboss.org/schema/arquillian | ||
http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> | ||
|
||
<!-- Uncomment to have test archives exported to the file system for inspection --> | ||
<!-- <engine> --> | ||
<!-- <property name="deploymentExportPath">target/</property> --> | ||
<!-- </engine> --> | ||
|
||
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature --> | ||
<defaultProtocol type="Servlet 3.0" /> | ||
|
||
<!-- Example configuration for a remote JBoss AS 7 instance --> | ||
<container qualifier="jboss" default="true"> | ||
<!-- If you want to use the JBOSS_HOME environment variable, just delete the jbossHome property --> | ||
<configuration> | ||
<property name="jbossHome">/home/kpiwko/jboss-as-7.1.0.CR1b</property> | ||
</configuration> | ||
</container> | ||
|
||
<extension qualifier="webdriver"> | ||
<property name="implementationClass">org.openqa.selenium.chrome.ChromeDriver</property> | ||
<property name="chromeBinary">/opt/google/chrome/chrome</property> | ||
<property name="chromeSwitches">--user-data-dir=/tmp --disable-web-security</property> | ||
</extension> | ||
|
||
</arquillian> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://jboss.org/schema/arquillian | ||
http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> | ||
|
||
<!-- Uncomment to have test archives exported to the file system for inspection --> | ||
<!-- <engine> --> | ||
<!-- <property name="deploymentExportPath">target/</property> --> | ||
<!-- </engine> --> | ||
|
||
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature --> | ||
<defaultProtocol type="Servlet 3.0" /> | ||
|
||
<!-- Example configuration for a remote JBoss AS 7 instance --> | ||
<container qualifier="jboss" default="true"> | ||
<!-- If you want to use the JBOSS_HOME environment variable, just delete the jbossHome property --> | ||
<configuration> | ||
<property name="jbossHome">/home/kpiwko/jboss-as-7.1.0.CR1b</property> | ||
</configuration> | ||
</container> | ||
|
||
<extension qualifier="webdriver"> | ||
<property name="implementationClass">org.openqa.selenium.firefox.FirefoxDriver</property> | ||
<property name="firefoxBinary">/opt/firefox-9.0.1/firefox-bin</property> | ||
</extension> | ||
|
||
</arquillian> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters