incubator-photark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r942775 - /incubator/photark/trunk/photark-ui-test/src/test/java/org/apache/photark/ui/IE8BrowserTestCase.java
Date Mon, 10 May 2010 15:01:16 GMT
Author: lresende
Date: Mon May 10 15:01:15 2010
New Revision: 942775

URL: http://svn.apache.org/viewvc?rev=942775&view=rev
Log:
Formatting...

Modified:
    incubator/photark/trunk/photark-ui-test/src/test/java/org/apache/photark/ui/IE8BrowserTestCase.java

Modified: incubator/photark/trunk/photark-ui-test/src/test/java/org/apache/photark/ui/IE8BrowserTestCase.java
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-ui-test/src/test/java/org/apache/photark/ui/IE8BrowserTestCase.java?rev=942775&r1=942774&r2=942775&view=diff
==============================================================================
--- incubator/photark/trunk/photark-ui-test/src/test/java/org/apache/photark/ui/IE8BrowserTestCase.java
(original)
+++ incubator/photark/trunk/photark-ui-test/src/test/java/org/apache/photark/ui/IE8BrowserTestCase.java
Mon May 10 15:01:15 2010
@@ -46,96 +46,96 @@ import com.gargoylesoftware.htmlunit.htm
 
 public class IE8BrowserTestCase {
 
-	public static WebClient webClient;
+    public static WebClient webClient;
 
-	@BeforeClass
-	public static void setUp(){
-		webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
-	}
-
-	@Test
-	public void testGallery() throws FailingHttpStatusCodeException, MalformedURLException,
IOException, InterruptedException {
-		final HtmlPage page = webClient.getPage("http://localhost:8080/photark/");
-		final HtmlTable table = page.getHtmlElementById("tableGallery");
-		
-		//testing the static part of the gallery
-		final String pageAsXml = page.asXml();
-		assertTrue(pageAsXml.contains("<a href=\"javascript:displayGallery()\" onmouseover=\"document.index.src=index_on.src\"
onmouseout=\"document.index.src=index_off.src\" onmousedown=\"beforeClick();\">"));
-		assertTrue(pageAsXml.contains("<body onload=\"initGallery()\">"));
-		final String pageAsText = page.asText();
-		assertTrue(pageAsText.contains("Apache PhotArk Gallery"));
-		
-		Thread.sleep(3000);
-		//testing the dynamic part of the gallery
-		
-		//albums loaded
-		assertTrue( table.getRow(1).getCell(0).asText().contains("boston"));
-		//Gallery pictures loaded
-		assertTrue( table.getRow(3).getCell(0).asXml().contains("http://localhost:8080/photark/gallery/vegas/dsc00"));
//Don't use a specific image
-                                                                                        
                                      //as we can get <> order in <> OS 
-		
-		//clicking on an image
-		assertTrue(page.getElementById("albumImage").getAttribute("src").contains("space.gif"));
-		DomNodeList<HtmlElement> ele= table.getRow(3).getCell(0).getElementsByTagName("a");
-		final HtmlAnchor anchor =(HtmlAnchor) ele.get(0);
-		final HtmlPage page2= anchor.click(); 
-		Thread.sleep(3000);
-		//checking whether there are images in the album
-		assertTrue( page2.getElementById("albumImage").getAttribute("src").contains("/photark/gallery/vegas/dsc00"));
//Don't use a specific image
-                                                                                        
                                     //as we can get <> order in <> OS
-
-	}
-
-	@Test
-	public void testAdmin() throws FailingHttpStatusCodeException, MalformedURLException, IOException,
InterruptedException {
-		//passing credentials
-		final List collectedAlerts = new ArrayList();
-		webClient.setAlertHandler(new CollectingAlertHandler(collectedAlerts));
-		((DefaultCredentialsProvider) webClient.getCredentialsProvider()).addCredentials("photark-admin",
"password"); 
-
-		final HtmlPage page = webClient.getPage("http://localhost:8080/photark/admin/upload.html");
-		Thread.sleep(3000);
-		
-		//testing the loaded page
-		HtmlSelect select = page.getHtmlElementById("selectAlbum"); 
-		assertTrue(select.asText().contains("New Album"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("deleteAlbum").getAttribute("style").contains("display:
none;"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("btnAlbumDesc").getAttribute("style").contains("display:
none;"));
-
-		assertFalse(page.<HtmlElement>getHtmlElementById("albumCover").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("newAlbumLabel").getAttribute("style").contains("display:
none;"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("newAlbumName").getAttribute("style").contains("display:
none;"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00368.jpg"));
-
-		//selecting an album from drop down
-		HtmlOption option = select.getOption(1);
-		option.click();
-		Thread.sleep(3000);
-		//testing whether the expected changes has happened
-		assertTrue(select.asText().contains("boston"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("albumCover").asXml().contains("photark/gallery/boston/dsc"));
-		
-		assertTrue(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00368.jpg"));
-		
-		assertTrue(page.<HtmlElement>getHtmlElementById("newAlbumLabel").getAttribute("style").contains("display:
none;"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("newAlbumName").getAttribute("style").contains("display:
none;"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("deleteAlbum").getAttribute("style").contains("display:
none;"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("btnAlbumDesc").getAttribute("style").contains("display:
none;"));
-
-		//checking the changes by clicking the edit album description button
-		assertTrue(page.<HtmlElement>getHtmlElementById("albumDescription").getAttribute("readonly").contains("readonly"));
-		page.<HtmlElement>getHtmlElementById("btnAlbumDesc").click();
-		assertTrue(page.getFocusedElement().getAttribute("id").contains("albumDescription"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
-		assertFalse(page.<HtmlElement>getHtmlElementById("albumDescription").getAttribute("readonly").contains("readonly"));
-		page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").click();
-		assertTrue(page.<HtmlElement>getHtmlElementById("albumDescription").getAttribute("readonly").contains("readonly"));
-		assertTrue(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
+    @BeforeClass
+    public static void setUp(){
+        webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
+    }
+
+    @Test
+    public void testGallery() throws FailingHttpStatusCodeException, MalformedURLException,
IOException, InterruptedException {
+        final HtmlPage page = webClient.getPage("http://localhost:8080/photark/");
+        final HtmlTable table = page.getHtmlElementById("tableGallery");
+
+        //testing the static part of the gallery
+        final String pageAsXml = page.asXml();
+        assertTrue(pageAsXml.contains("<a href=\"javascript:displayGallery()\" onmouseover=\"document.index.src=index_on.src\"
onmouseout=\"document.index.src=index_off.src\" onmousedown=\"beforeClick();\">"));
+        assertTrue(pageAsXml.contains("<body onload=\"initGallery()\">"));
+        final String pageAsText = page.asText();
+        assertTrue(pageAsText.contains("Apache PhotArk Gallery"));
+
+        Thread.sleep(3000);
+        //testing the dynamic part of the gallery
+
+        //albums loaded
+        assertTrue( table.getRow(1).getCell(0).asText().contains("boston"));
+        //Gallery pictures loaded
+        assertTrue( table.getRow(3).getCell(0).asXml().contains("http://localhost:8080/photark/gallery/vegas/dsc00"));
//Don't use a specific image
+        //as we can get <> order in <> OS 
+
+        //clicking on an image
+        assertTrue(page.getElementById("albumImage").getAttribute("src").contains("space.gif"));
+        DomNodeList<HtmlElement> ele= table.getRow(3).getCell(0).getElementsByTagName("a");
+        final HtmlAnchor anchor =(HtmlAnchor) ele.get(0);
+        final HtmlPage page2= anchor.click(); 
+        Thread.sleep(3000);
+        //checking whether there are images in the album
+        assertTrue( page2.getElementById("albumImage").getAttribute("src").contains("/photark/gallery/vegas/dsc00"));
//Don't use a specific image
+        //as we can get <> order in <> OS
+
+    }
+
+    @Test
+    public void testAdmin() throws FailingHttpStatusCodeException, MalformedURLException,
IOException, InterruptedException {
+        //passing credentials
+        final List collectedAlerts = new ArrayList();
+        webClient.setAlertHandler(new CollectingAlertHandler(collectedAlerts));
+        ((DefaultCredentialsProvider) webClient.getCredentialsProvider()).addCredentials("photark-admin",
"password"); 
+
+        final HtmlPage page = webClient.getPage("http://localhost:8080/photark/admin/upload.html");
+        Thread.sleep(3000);
+
+        //testing the loaded page
+        HtmlSelect select = page.getHtmlElementById("selectAlbum"); 
+        assertTrue(select.asText().contains("New Album"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("deleteAlbum").getAttribute("style").contains("display:
none;"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("btnAlbumDesc").getAttribute("style").contains("display:
none;"));
+
+        assertFalse(page.<HtmlElement>getHtmlElementById("albumCover").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("newAlbumLabel").getAttribute("style").contains("display:
none;"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("newAlbumName").getAttribute("style").contains("display:
none;"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00368.jpg"));
+
+        //selecting an album from drop down
+        HtmlOption option = select.getOption(1);
+        option.click();
+        Thread.sleep(3000);
+        //testing whether the expected changes has happened
+        assertTrue(select.asText().contains("boston"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("albumCover").asXml().contains("photark/gallery/boston/dsc"));
+
+        assertTrue(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00376.jpg"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("adminTableGallery").asXml().contains("photark/gallery/boston/dsc00368.jpg"));
+
+        assertTrue(page.<HtmlElement>getHtmlElementById("newAlbumLabel").getAttribute("style").contains("display:
none;"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("newAlbumName").getAttribute("style").contains("display:
none;"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("deleteAlbum").getAttribute("style").contains("display:
none;"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("btnAlbumDesc").getAttribute("style").contains("display:
none;"));
+
+        //checking the changes by clicking the edit album description button
+        assertTrue(page.<HtmlElement>getHtmlElementById("albumDescription").getAttribute("readonly").contains("readonly"));
+        page.<HtmlElement>getHtmlElementById("btnAlbumDesc").click();
+        assertTrue(page.getFocusedElement().getAttribute("id").contains("albumDescription"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
+        assertFalse(page.<HtmlElement>getHtmlElementById("albumDescription").getAttribute("readonly").contains("readonly"));
+        page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").click();
+        assertTrue(page.<HtmlElement>getHtmlElementById("albumDescription").getAttribute("readonly").contains("readonly"));
+        assertTrue(page.<HtmlElement>getHtmlElementById("cancelBtnAlbumDesc").getAttribute("style").contains("display:
none;"));
 
-	}
+    }
 
 }
\ No newline at end of file



Mime
View raw message