1. Micha Kops
  2. arquillian-tutorial

Commits

Micha Kops  committed 8930f15

Fixed loading of web.xml file for selenium integration test.

  • Participants
  • Parent commits c08614e
  • Branches default

Comments (0)

Files changed (3)

File pom.xml

View file
  • Ignore whitespace
 			<scope>test</scope>
 		</dependency>
 	</dependencies>
+	
+	 <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                    <warSourceDirectory>src/main/webapp</warSourceDirectory>
+                    <webResources>
+                        <resource>
+                            <directory>src/main/webapp</directory>
+                        </resource>
+                    </webResources>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+        <sourceDirectory>src/main/webapp</sourceDirectory>
+    </build>
 </project>

File src/main/java/com/hascode/tutorial/jee/BookControllerBean.java

View file
  • Ignore whitespace
 
 import java.util.List;
 
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
 import javax.inject.Inject;
-import javax.inject.Named;
 
-@Named("bookControllerBean")
-@SessionScoped
+@RequestScoped
+@ManagedBean(name = "bookControllerBean")
 public class BookControllerBean {
 	@Inject
 	private BookEJB bookEJB;

File src/test/java/com/hascode/tutorial/jee/CreateBookSeleniumTest.java

View file
  • Ignore whitespace
 				.addAsResource("META-INF/persistence.xml")
 				.addAsWebResource(new File(WEBAPP_SRC, "books.xhtml"))
 				.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
-				.addAsWebInfResource(EmptyAsset.INSTANCE, "faces-config.xml");
+				.addAsWebInfResource(EmptyAsset.INSTANCE, "faces-config.xml")
+				.setWebXML(new File("src/main/webapp/WEB-INF/web.xml"));
 	}
 
 	@Drone
 	URL deploymentURL;
 
 	@Test
-	public void should_login_successfully() {
+	public void should_create_and_display_book() {
 		// this will be http://localhost:8181/books/books.xhtml
 		browser.open(deploymentURL + "books.xhtml");
-		browser.waitForPageToLoad("20000");
+		// create a screenshot for the tutorial ;)
+		// browser.captureScreenshot("/tmp/screen.png");
 		browser.type("id=createBookForm:title", "My book title");
 		browser.type("id=createBookForm:author", "The author");
 		browser.click("id=createBookForm:saveBook");