Skip to content

Commit f70b8d5

Browse files
authored
Merge pull request #69 from mbien/integration_repairs
Fix for dusty integration tests
2 parents b89e72a + 3b82684 commit f70b8d5

7 files changed

Lines changed: 38 additions & 23 deletions

File tree

it-selenium/pom.xml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<dependency>
4949
<groupId>org.seleniumhq.selenium</groupId>
5050
<artifactId>selenium-java</artifactId>
51-
<version>3.4.0</version>
51+
<version>3.141.59</version>
5252
<exclusions>
5353
<exclusion>
5454
<groupId>org.apache.commons</groupId>
@@ -60,7 +60,7 @@
6060
<dependency>
6161
<groupId>org.seleniumhq.selenium</groupId>
6262
<artifactId>selenium-firefox-driver</artifactId>
63-
<version>3.4.0</version>
63+
<version>3.141.59</version>
6464
</dependency>
6565

6666
<!-- Will bring in once we configure a Chrome option -->
@@ -73,6 +73,7 @@
7373
<dependency>
7474
<groupId>junit</groupId>
7575
<artifactId>junit</artifactId>
76+
<version>4.13</version>
7677
<scope>test</scope>
7778
</dependency>
7879

@@ -88,11 +89,6 @@
8889
<type>war</type>
8990
</dependency>
9091

91-
<dependency>
92-
<groupId>junit</groupId>
93-
<artifactId>junit</artifactId>
94-
</dependency>
95-
9692
</dependencies>
9793

9894
<build>
@@ -102,7 +98,7 @@
10298
-->
10399
<plugin>
104100
<artifactId>maven-failsafe-plugin</artifactId>
105-
<version>2.20</version>
101+
<version>3.0.0-M5</version>
106102
<executions>
107103
<execution>
108104
<goals>
@@ -111,6 +107,13 @@
111107
</goals>
112108
</execution>
113109
</executions>
110+
<dependencies>
111+
<dependency>
112+
<groupId>javax.xml.bind</groupId>
113+
<artifactId>jaxb-api</artifactId>
114+
<version>2.3.1</version>
115+
</dependency>
116+
</dependencies>
114117
</plugin>
115118

116119
<!-- Activates the Derby database during the integration test phase -->
@@ -189,6 +192,12 @@
189192
</execution>
190193
</executions>
191194
<dependencies>
195+
196+
<dependency>
197+
<groupId>commons-dbcp</groupId>
198+
<artifactId>commons-dbcp</artifactId>
199+
<version>1.4</version>
200+
</dependency>
192201

193202
<dependency>
194203
<groupId>org.apache.derby</groupId>

it-selenium/src/test/java/org/apache/roller/selenium/AbstractRollerPage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected void verifyPageTitle(String pageTitle) {
5656
*/
5757
protected void verifyIdOnPage(String idOnPage) {
5858
try {
59-
WebElement div = driver.findElement(By.id(idOnPage));
59+
driver.findElement(By.id(idOnPage));
6060
} catch (NoSuchElementException e) {
6161
throw new IllegalStateException("HTML ID: " + idOnPage + " not found.");
6262
}
@@ -70,14 +70,14 @@ protected void setFieldValue(String fieldId, String value) {
7070

7171
protected void clickById(String buttonId) {
7272
WebElement element = driver.findElement(By.id(buttonId));
73+
System.out.println("clicking element " + element.getTagName() + " id:" + element.getAttribute("id"));
7374
element.click();
74-
System.out.println("Element " + element.getTagName() + " id:" + element.getAttribute("id") + " clicked");
7575
}
7676

7777
protected void clickByLinkText(String buttonText) {
7878
WebElement element = driver.findElement(By.linkText(buttonText));
79+
System.out.println("clicking element " + element.getTagName() + " id:" + element.getAttribute("id"));
7980
element.click();
80-
System.out.println("Element " + element.getTagName() + " id:" + element.getAttribute("id") + " clicked");
8181
}
8282

8383
protected String getTextByCSS(String cssSelector) {

it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@
1717
*/
1818
package org.apache.roller.selenium;
1919

20-
import java.util.regex.Pattern;
2120
import java.util.concurrent.TimeUnit;
2221
import org.junit.*;
23-
import static org.junit.Assert.*;
24-
import static org.hamcrest.CoreMatchers.*;
2522
import org.openqa.selenium.*;
2623
import org.openqa.selenium.firefox.FirefoxDriver;
27-
import org.openqa.selenium.support.ui.Select;
2824
import org.apache.roller.selenium.core.CreateWeblogPage;
2925
import org.apache.roller.selenium.core.LoginPage;
3026
import org.apache.roller.selenium.core.MainMenuPage;
@@ -35,8 +31,11 @@
3531
import org.apache.roller.selenium.editor.EntryEditPage;
3632
import org.apache.roller.selenium.view.BlogHomePage;
3733
import org.apache.roller.selenium.view.SingleBlogEntryPage;
34+
import org.openqa.selenium.firefox.FirefoxOptions;
3835
import org.openqa.selenium.firefox.FirefoxProfile;
3936

37+
import static org.junit.Assert.*;
38+
4039
public class InitialLoginTestIT {
4140
private WebDriver driver;
4241
private String baseUrl;
@@ -45,11 +44,19 @@ public class InitialLoginTestIT {
4544

4645
@Before
4746
public void setUp() throws Exception {
47+
4848
FirefoxProfile profile = new FirefoxProfile();
4949
profile.setPreference("intl.accept_languages", "en_US");
50-
driver = new FirefoxDriver(profile);
50+
51+
FirefoxOptions options = new FirefoxOptions();
52+
options.setProfile(profile);
53+
54+
driver = new FirefoxDriver(options);
55+
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS)
56+
.pageLoadTimeout(5, TimeUnit.SECONDS)
57+
.setScriptTimeout(5, TimeUnit.SECONDS);
58+
5159
baseUrl = "http://localhost:8080/roller/";
52-
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
5360
}
5461

5562
@Test
@@ -59,8 +66,10 @@ public void testInitialLogin() throws Exception {
5966
SetupPage sp = new SetupPage(driver);
6067
RegisterPage rp = sp.createNewUser();
6168
WelcomePage wp = rp.submitUserRegistration("bsmith", "Bob Smith", "bsmith@email.com", "roller123");
69+
6270
LoginPage lp = wp.doRollerLogin();
6371
MainMenuPage mmp = lp.loginToRoller("bsmith", "roller123");
72+
6473
CreateWeblogPage cwp = mmp.createWeblog();
6574
cwp.createWeblog("Bob's Blog", "bobsblog", "bsmith@email.com");
6675

@@ -77,6 +86,7 @@ public void testInitialLogin() throws Exception {
7786
eap.setTitle(blogEntryTitle);
7887
eap.setText(blogEntryContent);
7988
EntryEditPage eep = eap.postBlogEntry();
89+
8090
SingleBlogEntryPage sbep = eep.viewBlogEntry();
8191
System.out.println("title/text: " + sbep.getBlogTitle() + " / " + sbep.getBlogText());
8292
assertEquals(blogEntryTitle, sbep.getBlogTitle());

it-selenium/src/test/java/org/apache/roller/selenium/core/LoginPage.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import org.apache.roller.selenium.AbstractRollerPage;
2121
import org.openqa.selenium.WebDriver;
2222

23-
import java.lang.String;
24-
2523
/**
2624
* represents core/login.jsp
2725
* Page Object that handles user login to Roller

it-selenium/src/test/java/org/apache/roller/selenium/core/MainMenuPage.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.roller.selenium.editor.EntryAddPage;
2222
import org.openqa.selenium.WebDriver;
2323

24-
import java.lang.String;
2524

2625
/**
2726
* represents core/MainMenu.jsp
@@ -32,7 +31,7 @@ public class MainMenuPage extends AbstractRollerPage {
3231

3332
public MainMenuPage(WebDriver driver) {
3433
this.driver = driver;
35-
pageTitle = "Front Page: Main Menu";
34+
pageTitle = "Front Page: Your Weblogs";
3635
}
3736

3837
public CreateWeblogPage createWeblog() {

it-selenium/src/test/java/org/apache/roller/selenium/core/RegisterPage.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.openqa.selenium.support.ui.ExpectedConditions;
2424
import org.openqa.selenium.support.ui.WebDriverWait;
2525

26-
import java.lang.String;
2726

2827
/**
2928
* represents core/Register.jsp

it-selenium/src/test/resources/roller-jettyrun.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFac
2323
passwds.encryption.enabled=false
2424

2525
# use src copy of themes for read-only access
26-
themes.dir=target/roller-selenium-tests-6.0.0/themes
26+
themes.dir=target/war/work/org.apache.roller/roller-webapp/themes
2727

2828
# put work in work dir
2929
search.index.dir =target/work/search-index

0 commit comments

Comments
 (0)