Author: gmazza
Date: Tue Aug 13 20:48:06 2013
New Revision: 1513645
URL: http://svn.apache.org/r1513645
Log:
Added an id element to basic's permalink.vm template to help with Selenium
testing.
Modified:
roller/trunk/app/src/main/webapp/themes/basic/permalink.vm
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java
Modified: roller/trunk/app/src/main/webapp/themes/basic/permalink.vm
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/themes/basic/permalink.vm?rev=1513645&r1=1513644&r2=1513645&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/themes/basic/permalink.vm (original)
+++ roller/trunk/app/src/main/webapp/themes/basic/permalink.vm Tue Aug 13
20:48:06 2013
@@ -8,7 +8,7 @@
</head>
<body>
-<div class="content_wrapper">
+<div id="id_permalink" class="content_wrapper">
<div class="content">
<h1 class="weblogName">$utils.escapeHTML($model.weblog.name)</h1>
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=1513645&r1=1513644&r2=1513645&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
Tue Aug 13 20:48:06 2013
@@ -17,9 +17,10 @@
*/
package org.apache.roller.selenium;
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.By;
/**
* Abstract class holding functionality common to Selenium Page Objects
@@ -37,6 +38,20 @@ public abstract class AbstractRollerPage
}
}
+ /*
+ * Alternative method of identifying a page, by an HTML ID uniquely on it.
+ * Use when multiple views share the same page title. This method will
require
+ * adding an id to an element specific to that page if one not already
available.
+ */
+ protected void verifyIdOnPage(String idOnPage) {
+ try {
+ WebElement div = driver.findElement(By.id(idOnPage));
+ } catch (NoSuchElementException e) {
+ throw new IllegalStateException("This is not the " + pageName + ",
HTML ID: "
+ + idOnPage + " not found.");
+ }
+ }
+
protected void setFieldValue(String fieldId, String value) {
WebElement field = driver.findElement(By.id(fieldId));
field.clear();
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=1513645&r1=1513644&r2=1513645&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
Tue Aug 13 20:48:06 2013
@@ -31,7 +31,9 @@ public class SingleBlogEntryPage extends
public SingleBlogEntryPage(WebDriver driver) {
this.driver = driver;
this.pageName = "Single blog entry view";
-// verifyPageTitle("...");
+ /* id_permalink added to basic template's permalink.vm only to
distinguish
+ this page from by-month or by-day views of blog entries */
+ verifyIdOnPage("id_permalink");
}
public String getBlogTitle() {