roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1510443 - in /roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium: AbstractRollerPage.java InitialLoginTestIT.java editor/EntryEditPage.java view/SingleBlogEntryPage.java
Date Mon, 05 Aug 2013 12:15:36 GMT
Author: gmazza
Date: Mon Aug  5 12:15:36 2013
New Revision: 1510443

URL: http://svn.apache.org/r1510443
Log:
Implemented SingleBlogEntryPage

Modified:
    roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
    roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
    roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryEditPage.java
    roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java

Modified: roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
URL: http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java?rev=1510443&r1=1510442&r2=1510443&view=diff
==============================================================================
--- roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
(original)
+++ roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
Mon Aug  5 12:15:36 2013
@@ -18,6 +18,7 @@
 package org.apache.roller.selenium;
 
 import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
 import org.openqa.selenium.By;
 
 /**
@@ -37,8 +38,9 @@ public abstract class AbstractRollerPage
     }
 
     protected void setFieldValue(String fieldId, String value) {
-        driver.findElement(By.id(fieldId)).clear();
-        driver.findElement(By.id(fieldId)).sendKeys(value);
+        WebElement field = driver.findElement(By.id(fieldId));
+        field.clear();
+        field.sendKeys(value);
     }
 
     protected void clickById(String buttonId) {
@@ -49,4 +51,11 @@ public abstract class AbstractRollerPage
         driver.findElement(By.linkText(buttonText)).click();
     }
 
+    protected String getTextByCSS(String cssSelector) {
+        return driver.findElement(By.cssSelector(cssSelector)).getText();
+    }
+
+    protected String getTextById(String fieldId) {
+        return driver.findElement(By.id(fieldId)).getText();
+    }
 }
\ No newline at end of file

Modified: roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
URL: http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java?rev=1510443&r1=1510442&r2=1510443&view=diff
==============================================================================
--- roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
(original)
+++ roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
Mon Aug  5 12:15:36 2013
@@ -33,7 +33,7 @@ import org.apache.roller.selenium.core.S
 import org.apache.roller.selenium.core.WelcomePage;
 import org.apache.roller.selenium.editor.EntryAddPage;
 import org.apache.roller.selenium.editor.EntryEditPage;
-
+import org.apache.roller.selenium.view.SingleBlogEntryPage;
 
 public class InitialLoginTestIT {
     private WebDriver driver;
@@ -61,13 +61,15 @@ public class InitialLoginTestIT {
         MainMenuPage mmp = lp.loginToRoller("bsmith", "roller123");
         CreateWeblogPage cwp = mmp.createWeblog();
         mmp = cwp.createWeblog("Bob's Blog", "bobsblog", "bsmith@email.com");
+
         EntryAddPage eap = mmp.createNewBlogEntry();
         eap.setTitle(blogEntryTitle);
         eap.setText(blogEntryContent);
         EntryEditPage eep = eap.postBlogEntry();
-        driver.findElement(By.id("entry_bean_permalink")).click();
-        assertEquals(blogEntryTitle, driver.findElement(By.cssSelector("p.entryTitle")).getText());
-        assertEquals(blogEntryContent, driver.findElement(By.cssSelector("p.entryContent")).getText());
+        SingleBlogEntryPage sbep = eep.viewBlogEntry();
+        System.out.println("title/text: " + sbep.getBlogTitle() + " / " + sbep.getBlogText());
+        assertEquals(blogEntryTitle, sbep.getBlogTitle());
+        assertEquals(blogEntryContent, sbep.getBlogText());
     }
 
 

Modified: roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryEditPage.java
URL: http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryEditPage.java?rev=1510443&r1=1510442&r2=1510443&view=diff
==============================================================================
--- roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryEditPage.java
(original)
+++ roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryEditPage.java
Mon Aug  5 12:15:36 2013
@@ -28,12 +28,16 @@ import java.lang.String;
  */
 public class EntryEditPage extends AbstractEntryPage {
 
+    // need to read fields on screen.
+
     public EntryEditPage(WebDriver driver) {
         this.driver = driver;
         this.pageName = "blog entry edit page";
         verifyPageTitle("Front Page: Edit Entry");
     }
 
-    // need to read fields on screen.
-
+    public SingleBlogEntryPage viewBlogEntry() {
+        clickById("entry_bean_permalink");
+        return new SingleBlogEntryPage(driver);
+    }
 }

Modified: roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java
URL: http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java?rev=1510443&r1=1510442&r2=1510443&view=diff
==============================================================================
--- roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java
(original)
+++ roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java
Mon Aug  5 12:15:36 2013
@@ -28,10 +28,18 @@ import java.lang.String;
  */
 public class SingleBlogEntryPage extends AbstractRollerPage {
 
-    public SingleBlogEntryPage(WebDriver driver, String blogTitle, String entryTitle) {
+    public SingleBlogEntryPage(WebDriver driver) {
         this.driver = driver;
-        this.pageName = "Single blog entry page";
-        verifyPageTitle(entryTitle + " : " + blogTitle);
+        this.pageName = "Single blog entry view";
+//      verifyPageTitle("...");
+    }
+
+    public String getBlogTitle() {
+        return getTextByCSS("p.entryTitle");
+    }
+
+    public String getBlogText() {
+        return getTextByCSS("p.entryContent");
     }
 
 }



Mime
View raw message