Author: gmazza
Date: Sun Aug 4 03:30:02 2013
New Revision: 1510094
URL: http://svn.apache.org/r1510094
Log:
Switch to Page Object Design Pattern
(http://docs.seleniumhq.org/docs/06_test_design_considerations.jsp#page-object-design-pattern)
for Selenium tests.
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/CreateWeblogPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/LoginPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/MainMenuPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/RegisterPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/SetupPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/WelcomePage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/AbstractEntryPage.java
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryAddPage.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/
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java
Modified:
roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/Setup.jsp
roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEdit.jsp
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/Setup.jsp
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/Setup.jsp?rev=1510094&r1=1510093&r2=1510094&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/Setup.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/core/Setup.jsp Sun Aug 4
03:30:02 2013
@@ -21,9 +21,9 @@
<div style="width:75%">
<ul>
<%--
- Tell the user how to complete their Roller install, with
helpful
- notes and links to the appropriate places in the Roller UI.
- --%>
+ Index page on Roller startup; tell the user how to complete
their Roller install,
+ with helpful notes and links to the appropriate places in the
Roller UI.
+ --%>
<%-- STEP 1: Create a user if you don't already have one --%>
<li><b><s:text name="index.createUser" />
@@ -36,8 +36,7 @@
<s:text name="index.createUserHelp" /><br /><br />
<s:text name="index.createUserBy" />
<a href='<s:url action="register"/>'>
- <s:text name="index.createUserPage" />
- </a>.
+ <s:text name="index.createUserPage" /></a>.
<br /><br /><br />
</li>
@@ -52,12 +51,11 @@
<s:text name="index.createWeblogHelp" /><br /><br />
<s:text name="index.createWeblogBy" />
<a href='<s:url action="createWeblog"/>'>
- <s:text name="index.createWeblogPage" />
- </a>
+ <s:text name="index.createWeblogPage" /></a>.
<br /><br /><br />
</li>
- <%-- STEP 3: Designate a weblog to be the frontpage weblot --%>
+ <%-- STEP 3: Designate a weblog to be the frontpage weblog --%>
<li><b><s:text name="index.setFrontpage" /></b><br />
<br />
<s:text name="index.setFrontpageHelp" /><br />
Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEdit.jsp
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEdit.jsp?rev=1510094&r1=1510093&r2=1510094&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEdit.jsp
(original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEdit.jsp Sun Aug
4 03:30:02 2013
@@ -122,7 +122,7 @@ function fullPreviewMode() {
</td>
<td>
<s:if test="bean.published">
- <a href='<s:property value="entry.permalink"
/>'><s:property value="entry.permalink" /></a>
+ <a id="entry_bean_permalink" href='<s:property
value="entry.permalink" />'><s:property value="entry.permalink" /></a>
<img src='<s:url value="/images/launch-link.png"/>' />
</s:if>
<s:else>
Added:
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=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.By;
+
+/**
+ * Abstract class holding functionality common to Selenium Page Objects
+ * used in Roller.
+ */
+public abstract class AbstractRollerPage {
+
+ protected WebDriver driver;
+ protected String pageName;
+
+ protected void verifyPageTitle(String pageTitle) {
+ if(!driver.getTitle().equals(pageTitle)) {
+ throw new IllegalStateException("This is not the " + pageName + ",
current page is: "
+ + driver.getTitle());
+ }
+ }
+
+ protected void setFieldValue(String fieldId, String value) {
+ driver.findElement(By.id(fieldId)).clear();
+ driver.findElement(By.id(fieldId)).sendKeys(value);
+ }
+
+ protected void clickById(String buttonId) {
+ driver.findElement(By.id(buttonId)).click();
+ }
+
+ protected void clickByLinkText(String buttonText) {
+ driver.findElement(By.linkText(buttonText)).click();
+ }
+
+}
\ 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=1510094&r1=1510093&r2=1510094&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
Sun Aug 4 03:30:02 2013
@@ -25,99 +25,91 @@ import static org.hamcrest.CoreMatchers.
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
+import org.apache.roller.selenium.core.CreateWeblogPage;
+import org.apache.roller.selenium.core.LoginPage;
+import org.apache.roller.selenium.core.MainMenuPage;
+import org.apache.roller.selenium.core.RegisterPage;
+import org.apache.roller.selenium.core.SetupPage;
+import org.apache.roller.selenium.core.WelcomePage;
+import org.apache.roller.selenium.editor.EntryAddPage;
+import org.apache.roller.selenium.editor.EntryEditPage;
+
public class InitialLoginTestIT {
- private WebDriver driver;
- private String baseUrl;
- private boolean acceptNextAlert = true;
- private StringBuffer verificationErrors = new StringBuffer();
-
- @Before
- public void setUp() throws Exception {
- driver = new FirefoxDriver();
- baseUrl = "http://localhost:8080/roller/";
- driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
- }
-
- @Test
- public void testInitialLogin() throws Exception {
- driver.get(baseUrl);
- driver.findElement(By.linkText("New User Registration Page")).click();
- driver.findElement(By.id("register_bean_userName")).clear();
- driver.findElement(By.id("register_bean_userName")).sendKeys("bsmith");
- driver.findElement(By.id("register_bean_screenName")).clear();
- driver.findElement(By.id("register_bean_screenName")).sendKeys("bsmith");
- driver.findElement(By.id("register_bean_fullName")).clear();
- driver.findElement(By.id("register_bean_fullName")).sendKeys("Bob Smith");
- driver.findElement(By.id("register_bean_emailAddress")).clear();
-
driver.findElement(By.id("register_bean_emailAddress")).sendKeys("[email protected]");
- driver.findElement(By.id("register_bean_passwordText")).clear();
-
driver.findElement(By.id("register_bean_passwordText")).sendKeys("roller123");
- driver.findElement(By.id("register_bean_passwordConfirm")).clear();
-
driver.findElement(By.id("register_bean_passwordConfirm")).sendKeys("roller123");
- driver.findElement(By.id("submit")).click();
- driver.findElement(By.linkText("Click here")).click();
- driver.findElement(By.id("j_username")).clear();
- driver.findElement(By.id("j_username")).sendKeys("bsmith");
- driver.findElement(By.id("j_password")).clear();
- driver.findElement(By.id("j_password")).sendKeys("roller123");
- driver.findElement(By.id("login")).click();
- driver.findElement(By.linkText("create one?")).click();
- driver.findElement(By.id("createWeblog_bean_name")).clear();
- driver.findElement(By.id("createWeblog_bean_name")).sendKeys("Bob's Blog");
- driver.findElement(By.id("createWeblog_bean_description")).clear();
- driver.findElement(By.id("createWeblog_bean_description")).sendKeys("A
blog suitable for Selenium Testing");
- driver.findElement(By.id("createWeblog_bean_handle")).clear();
- driver.findElement(By.id("createWeblog_bean_handle")).sendKeys("bobsblog");
- driver.findElement(By.id("createWeblog_0")).click();
- driver.findElement(By.linkText("New Entry")).click();
- driver.findElement(By.id("entry_bean_title")).clear();
- driver.findElement(By.id("entry_bean_title")).sendKeys("My First Blog
Entry");
- driver.findElement(By.id("entry_bean_text")).clear();
- driver.findElement(By.id("entry_bean_text")).sendKeys("<p>Hello! I'm
looking forward to blogging lots of entries!</p>");
- driver.findElement(By.id("entry_2")).click();
-
driver.findElement(By.linkText("http://localhost:8080/roller/bobsblog/entry/my_first_blog_entry")).click();
- }
-
- @After
- public void tearDown() throws Exception {
- driver.quit();
- String verificationErrorString = verificationErrors.toString();
- if (!"".equals(verificationErrorString)) {
- fail(verificationErrorString);
- }
- }
-
- private boolean isElementPresent(By by) {
- try {
- driver.findElement(by);
- return true;
- } catch (NoSuchElementException e) {
- return false;
- }
- }
-
- private boolean isAlertPresent() {
- try {
- driver.switchTo().alert();
- return true;
- } catch (NoAlertPresentException e) {
- return false;
- }
- }
-
- private String closeAlertAndGetItsText() {
- try {
- Alert alert = driver.switchTo().alert();
- String alertText = alert.getText();
- if (acceptNextAlert) {
- alert.accept();
- } else {
- alert.dismiss();
- }
- return alertText;
- } finally {
- acceptNextAlert = true;
+ private WebDriver driver;
+ private String baseUrl;
+ private boolean acceptNextAlert = true;
+ private StringBuffer verificationErrors = new StringBuffer();
+
+ @Before
+ public void setUp() throws Exception {
+ driver = new FirefoxDriver();
+ baseUrl = "http://localhost:8080/roller/";
+ driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+ }
+
+ @Test
+ public void testInitialLogin() throws Exception {
+ String blogEntryTitle = "My First Blog Entry";
+ String blogEntryContent = "Welcome to my blog!";
+
+ driver.get(baseUrl);
+ SetupPage sp = new SetupPage(driver);
+ RegisterPage rp = sp.createNewUser();
+ WelcomePage wp = rp.submitUserRegistration("bsmith", "Bob Smith",
"[email protected]", "roller123");
+ LoginPage lp = wp.doRollerLogin();
+ MainMenuPage mmp = lp.loginToRoller("bsmith", "roller123");
+ CreateWeblogPage cwp = mmp.createWeblog();
+ mmp = cwp.createWeblog("Bob's Blog", "bobsblog", "[email protected]");
+ 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());
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+ driver.quit();
+ String verificationErrorString = verificationErrors.toString();
+ if (!"".equals(verificationErrorString)) {
+ fail(verificationErrorString);
+ }
+ }
+
+ private boolean isElementPresent(By by) {
+ try {
+ driver.findElement(by);
+ return true;
+ } catch (NoSuchElementException e) {
+ return false;
+ }
+ }
+
+ private boolean isAlertPresent() {
+ try {
+ driver.switchTo().alert();
+ return true;
+ } catch (NoAlertPresentException e) {
+ return false;
+ }
+ }
+
+ private String closeAlertAndGetItsText() {
+ try {
+ Alert alert = driver.switchTo().alert();
+ String alertText = alert.getText();
+ if (acceptNextAlert) {
+ alert.accept();
+ } else {
+ alert.dismiss();
+ }
+ return alertText;
+ } finally {
+ acceptNextAlert = true;
+ }
}
- }
}
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/CreateWeblogPage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/CreateWeblogPage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/CreateWeblogPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/CreateWeblogPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.core;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents core/CreateWeblog.jsp
+ */
+public class CreateWeblogPage extends AbstractRollerPage {
+
+ // additional properties needed: locale, timezone, theme
+
+ public CreateWeblogPage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "Create Weblog Page";
+ verifyPageTitle("Front Page: Create Weblog");
+ }
+
+ public MainMenuPage createWeblog() {
+ clickById("createWeblog_0");
+ return new MainMenuPage(driver);
+ }
+
+ public MainMenuPage createWeblog(String name, String handle, String email)
{
+ setName(name);
+ setHandle(handle);
+ setEmail(email);
+ return createWeblog();
+ }
+
+ public void setName(String value) {
+ setFieldValue("createWeblog_bean_name", value);
+ }
+
+ public void setDescription(String value) {
+ setFieldValue("createWeblog_bean_description", value);
+ }
+
+ public void setHandle(String value) {
+ setFieldValue("createWeblog_bean_handle", value);
+ }
+
+ public void setEmail(String value) {
+ setFieldValue("createWeblog_bean_emailAddress", value);
+ }
+
+}
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/LoginPage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/LoginPage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/LoginPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/LoginPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.core;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents core/login.jsp
+ * Page Object that handles user login to Roller
+ */
+public class LoginPage extends AbstractRollerPage {
+
+ public LoginPage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "Roller Login Page";
+ verifyPageTitle("Front Page: Welcome to Roller");
+ }
+
+ public MainMenuPage loginToRoller() {
+ clickById("login");
+ return new MainMenuPage(driver);
+ }
+
+ public MainMenuPage loginToRoller(String username, String password) {
+ setUsername(username);
+ setPassword(password);
+ return loginToRoller();
+ }
+
+ public void setUsername(String username) {
+ setFieldValue("j_username", username);
+ }
+
+ public void setPassword(String password) {
+ setFieldValue("j_password", password);
+ }
+
+}
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/MainMenuPage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/MainMenuPage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/MainMenuPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/MainMenuPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.core;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.apache.roller.selenium.editor.EntryAddPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents core/MainMenu.jsp
+ * Post-login page object to create, choose, configure blogs.
+ */
+public class MainMenuPage extends AbstractRollerPage {
+
+ public MainMenuPage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "Main Menu Page";
+ verifyPageTitle("Front Page: Main Menu");
+ }
+
+ public CreateWeblogPage createWeblog() {
+ clickByLinkText("create one?");
+ return new CreateWeblogPage(driver);
+ }
+
+ public EntryAddPage createNewBlogEntry() {
+ clickByLinkText("New Entry");
+ return new EntryAddPage(driver);
+ }
+
+}
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/RegisterPage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/RegisterPage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/RegisterPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/RegisterPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.core;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents core/Register.jsp
+ * index page that does step #1 of setup.jsp, the adding of a new user
+ */
+public class RegisterPage extends AbstractRollerPage {
+
+ public RegisterPage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "New User Registration Page";
+ verifyPageTitle("Front Page: New User Registration");
+ }
+
+ public WelcomePage submitUserRegistration() {
+ clickById("submit");
+ return new WelcomePage(driver);
+ }
+
+ public WelcomePage submitUserRegistration(String userAndScreenName, String
fullName, String email,
+ String password) {
+ setUserName(userAndScreenName);
+ setScreenName(userAndScreenName);
+ setFullName(fullName);
+ setEmail(email);
+ setPassword(password);
+ setPasswordConfirm(password);
+ return submitUserRegistration();
+ }
+
+ public void setUserName(String value) {
+ setFieldValue("register_bean_userName", value);
+ }
+
+ public void setScreenName(String value) {
+ setFieldValue("register_bean_screenName", value);
+ }
+
+ public void setFullName(String value) {
+ setFieldValue("register_bean_fullName", value);
+ }
+
+ public void setEmail(String value) {
+ setFieldValue("register_bean_emailAddress", value);
+ }
+
+ public void setPassword(String value) {
+ setFieldValue("register_bean_passwordText", value);
+ }
+
+ public void setPasswordConfirm(String value) {
+ setFieldValue("register_bean_passwordConfirm", value);
+ }
+}
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/SetupPage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/SetupPage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/SetupPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/SetupPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.core;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * represents core/Setup.jsp
+ * Page Object encapsulates the Setup.jsp index page
+ * that appears on initial startup of Roller, after
+ * the database tables were created but before the
+ * first user account and blog made.
+ */
+public class SetupPage extends AbstractRollerPage {
+
+ public SetupPage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "Initial Setup Page";
+ verifyPageTitle("Front Page: Welcome to Roller!");
+ }
+
+ public RegisterPage createNewUser() {
+ clickByLinkText("New User Registration Page");
+ return new RegisterPage(driver);
+ }
+
+}
\ No newline at end of file
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/WelcomePage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/WelcomePage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/WelcomePage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/core/WelcomePage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.core;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents core/Welcome.jsp
+ * Page Object after creation of a new user account (RegisterPage)
+ * Provides a button to proceed to the login page or notification that new
+ * account must be confirmed via email first.
+ */
+public class WelcomePage extends AbstractRollerPage {
+
+ public WelcomePage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "New User Registration Welcome Page";
+ verifyPageTitle("Front Page: New User Registration");
+ }
+
+ public LoginPage doRollerLogin() {
+ clickByLinkText("Click here");
+ return new LoginPage(driver);
+ }
+
+}
+
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/AbstractEntryPage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/AbstractEntryPage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/AbstractEntryPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/AbstractEntryPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.editor;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * Base class for the new/edit entry pages
+ */
+public abstract class AbstractEntryPage extends AbstractRollerPage {
+
+ public void setTitle(String value) {
+ setFieldValue("entry_bean_title", value);
+ }
+
+ public void setText(String value) {
+ setFieldValue("entry_bean_text", value);
+ }
+
+ public void setSummary(String value) {
+ setFieldValue("entry_bean_summary", value);
+ }
+
+ public EntryEditPage postBlogEntry() {
+ clickById("entry_2");
+ return new EntryEditPage(driver);
+ }
+}
Added:
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryAddPage.java
URL:
http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryAddPage.java?rev=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryAddPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryAddPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.editor;
+
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents editor/EntryAddPage.jsp
+ * Page for adding a new blog entry
+ */
+public class EntryAddPage extends AbstractEntryPage {
+
+ public EntryAddPage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "New Blog Entry Page";
+ verifyPageTitle("Front Page: New Entry");
+ }
+
+}
Added:
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=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryEditPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/editor/EntryEditPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.editor;
+
+import org.apache.roller.selenium.view.SingleBlogEntryPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents editor/EntryEditPage.jsp
+ * Page for editing an already saved (draft or posted) blog entry
+ */
+public class EntryEditPage extends AbstractEntryPage {
+
+ public EntryEditPage(WebDriver driver) {
+ this.driver = driver;
+ this.pageName = "blog entry edit page";
+ verifyPageTitle("Front Page: Edit Entry");
+ }
+
+ // need to read fields on screen.
+
+}
Added:
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=1510094&view=auto
==============================================================================
---
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java
(added)
+++
roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/view/SingleBlogEntryPage.java
Sun Aug 4 03:30:02 2013
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium.view;
+
+import org.apache.roller.selenium.AbstractRollerPage;
+import org.openqa.selenium.WebDriver;
+
+import java.lang.String;
+
+/**
+ * represents a URL that displays a single blog entry
+ * (URL similar to http://localhost:8080/roller/myblog/entry/my_blog_entry)
+ */
+public class SingleBlogEntryPage extends AbstractRollerPage {
+
+ public SingleBlogEntryPage(WebDriver driver, String blogTitle, String
entryTitle) {
+ this.driver = driver;
+ this.pageName = "Single blog entry page";
+ verifyPageTitle(entryTitle + " : " + blogTitle);
+ }
+
+}