DEVPLAT-440

This commit is contained in:
Martin Bergljung
2016-01-25 14:37:57 +00:00
parent f031c76a41
commit 641aa6bb8e
5 changed files with 126 additions and 136 deletions
@@ -46,12 +46,13 @@
</dependency>
<!--===============================================================
The following dependencies are needed to be able to compile the
custom functional tests that are based on Page Objects (PO)
===============================================================-->
The following dependencies are needed to be able to compile the
custom functional tests that are based on Page Objects (PO)
===============================================================-->
<!-- Bring in the Share Page Objects (PO) used in our functional tests.
It contains page objects such as LoginPage -->
It contains page objects such as LoginPage and it also brings
in selenium-grid and selenium. -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share-po</artifactId>
@@ -67,8 +68,7 @@
<classifier>tests</classifier>
<scope>test</scope>
<!-- Exclude version 2.39.0 of selenium that does not work with latest FF browsers, we include
version 2.45 later on here -->
<!-- Exclude selenium as it is already brought in by share-po dependency above -->
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
@@ -80,13 +80,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- Bring in newer selenium version -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0-alfresco</version>
<scope>test</scope>
</dependency>
<!-- Test NG is defined with test scope in share-po, so need it here too -->
<!-- Alfresco code creates a wrapper around Test NG -->
<dependency>
@@ -101,7 +94,6 @@
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
@@ -18,8 +18,8 @@
package ${package}.demoamp;
import ${package}.demoamp.po.DemoPage;
import org.alfresco.po.share.LoginPage;
import org.alfresco.po.AbstractTest;
//import org.alfresco.po.share.LoginPage;
import org.alfresco.po.share.PeopleFinderPage;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
@@ -41,18 +41,22 @@ public class DemoPageTestIT extends AbstractTest {
@BeforeClass(groups = {"alfresco-one"})
public void prepare() throws Exception {
// Navigate to share
// drone.navigateTo(shareUrl + "/page/hdp/ws/simple-page");
// Reuse Alfresco Share login page object from share-po lib.
// LoginPage loginPage = new LoginPage(drone);
// loginPage.loginAs(username, password);
// Navigate to share, which will redirect to Login page
driver.navigate().to(shareUrl + "/page");
// Resolve/Bind current page to LoginPage object
LoginPage loginPage = resolvePage(driver).render();
loginPage.loginAs(username, password);
}
@BeforeMethod
public void loadPage() {
// Goto demo page
// drone.navigateTo(shareUrl + "/page/hdp/ws/simple-page");
// page = new DemoPage(drone);
driver.navigate().to(shareUrl + "/page/hdp/ws/simple-page");
// We need to instantiate the page like this as it is not yet in
// the factory known list of pages
page = factoryPage.instantiatePage(driver, DemoPage.class);
}
@Test
@@ -63,9 +67,9 @@ public class DemoPageTestIT extends AbstractTest {
@Test
public void messageIsDisplayed() {
page.render();
// String msg = page.getMessage();
// Assert.assertNotNull(msg);
//Assert.assertEquals("Hello from i18n!", msg);
String msg = page.getMessage();
Assert.assertNotNull(msg);
Assert.assertEquals("Hello from i18n!", msg);
}
/**
@@ -86,7 +90,7 @@ public class DemoPageTestIT extends AbstractTest {
@Test
public void navigate() {
Assert.assertNotNull(page.getNav());
PeopleFinderPage peoppleFinderPage = page.getNav().selectPeople().render();
Assert.assertNotNull(peoppleFinderPage);
PeopleFinderPage peopleFinderPage = page.getNav().selectPeople().render();
Assert.assertNotNull(peopleFinderPage);
}
}
@@ -19,9 +19,9 @@ package ${package}.demoamp.po;
import org.alfresco.po.share.SharePage;
import org.alfresco.po.RenderTime;
//import org.alfresco.webdrone.WebDrone;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
/**
* Demo of simple share page object that encapsulates the demo of simple page.
@@ -30,22 +30,17 @@ import org.openqa.selenium.NoSuchElementException;
* @since 2.0.1
*/
public class DemoPage extends SharePage {
private By SIMPLE_DEMO_LOGO = By.id("DEMO_SIMPLE_LOGO");
private By SIMPLE_DEMO_MESSAGE = By.id("DEMO_SIMPLE_MSG");
@FindBy(id="DEMO_SIMPLE_LOGO")
WebElement logo;
// public DemoPage(WebDrone drone) {
// super(drone);
//}
@SuppressWarnings("unchecked")
@Override
public DemoPage render() {
return render(new RenderTime(maxPageLoadingTime));
}
@FindBy(id="DEMO_SIMPLE_MSG")
WebElement msg;
@SuppressWarnings("unchecked")
@Override
public DemoPage render(RenderTime timer) {
// Wait for logo and message to display, then consider page rendered
while (true) {
timer.start();
try {
@@ -57,32 +52,19 @@ public class DemoPage extends SharePage {
timer.end();
}
}
return this;
}
//@Override
//public DemoPage render(long time) {
// return render(new RenderTime(time));
//}
public boolean isSimpleLogoDisplayed() {
try {
// return drone.find(SIMPLE_DEMO_LOGO).isDisplayed();
} catch (NoSuchElementException se) {
}
return false;
return isDisplayed(logo);
}
public boolean isMessageDisplayed() {
try {
// return drone.find(SIMPLE_DEMO_MESSAGE).isDisplayed();
} catch (NoSuchElementException se) {
}
return false;
return isDisplayed(msg);
}
//public String getMessage() {
// return drone.find(SIMPLE_DEMO_MESSAGE).getText();
// }
public String getMessage() {
return msg.getText();
}
}
@@ -12,6 +12,11 @@
<version>${version}</version>
</parent>
<properties>
<!-- Bring in newer Spring with support for annotations, used for Page Object tests -->
<spring.version>4.1.6.RELEASE</spring.version>
</properties>
<profiles>
<profile>
<id>run</id>
@@ -229,28 +234,17 @@
</build>
<dependencies>
<!-- Bring in the Share Page Objects (PO) used in the regression tests -->
<!-- Bring in the Share Page Objects (PO) used in our functional tests.
It contains page objects such as LoginPage and it also brings
in selenium-grid and selenium. -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share-po</artifactId>
<version>${alfresco.version}</version>
<scope>test</scope>
<!-- Exclude version 2.39.0 of selenium that does not work with latest FF browsers, we include
version 2.45 later on here in this profile -->
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Bring in the Share Page Object (PO) regression tests that comes with Alfresco.
These tests cover the Alfresco Share Web Application -->
<!-- Bring in the Share Page Object (PO) Tests that comes with Alfresco. It has
the org.alfresco.po.share.AbstractTest class that our custom tests extend. -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share-po</artifactId>
@@ -258,8 +252,7 @@
<classifier>tests</classifier>
<scope>test</scope>
<!-- Exclude version 2.39.0 of selenium that does not work with latest FF browsers, we include
version 2.45 later on here in this profile -->
<!-- Exclude selenium as it is already brought in by share-po dependency above -->
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
@@ -271,25 +264,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- Make sure we are running with newer selenium that works with newest FF (newer than 2.39.0) -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0-alfresco</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.45.0-alfresco</version>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Test NG is defined with test scope in share-po, so need it here too -->
<!-- Alfresco code creates a wrapper around Test NG -->
<dependency>
@@ -304,6 +278,43 @@
</exclusion>
</exclusions>
</dependency>
<!-- Bring in newer selenium version if required
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.48.0</version>
<scope>test</scope>
</dependency>
-->
<!-- Need to bring in a newer Spring that supports annotations, Alfresco brings in older one -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
</profile>
@@ -360,30 +371,16 @@
<dependencies>
<!-- Bring in the Share Page Objects (PO) used in our functional tests.
Without it TestNG cannot load our test class when it uses page objects such as LoginPage -->
It contains page objects such as LoginPage and it also brings
in selenium-grid and selenium. -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share-po</artifactId>
<version>${alfresco.version}</version>
<scope>test</scope>
<!-- Exclude version 2.39.0 of selenium that does not work with latest FF browsers, we include
version 2.45 later on here in this profile -->
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Bring in the Share Page Object (PO) Tests that comes with Alfresco. It has
the org.alfresco.po.share.AbstractTest class that our custom tests extend.
Without it TestNG cannot load our test class -->
the org.alfresco.po.share.AbstractTest class that our custom tests extend. -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share-po</artifactId>
@@ -391,8 +388,7 @@
<classifier>tests</classifier>
<scope>test</scope>
<!-- Exclude version 2.39.0 of selenium that does not work with latest FF browsers, we include
version 2.45 later on here in this profile -->
<!-- Exclude selenium as it is already brought in by share-po dependency above -->
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
@@ -404,25 +400,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- Make sure we are running with newer selenium that works with newest FF (newer than 2.39.0) -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0-alfresco</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.45.0-alfresco</version>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Test NG is defined with test scope in share-po, so need it here too -->
<!-- Alfresco code creates a wrapper around Test NG -->
<dependency>
@@ -437,6 +414,43 @@
</exclusion>
</exclusions>
</dependency>
<!-- Bring in newer selenium version if required
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.48.0</version>
<scope>test</scope>
</dependency>
-->
<!-- Need to bring in a newer Spring that supports annotations, Alfresco brings in older one -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
</profile>
@@ -38,13 +38,11 @@
<class name="org.alfresco.po.share.site.document.DocumentDetailsPageTest"/>
</classes>
</test>
<!-- TODO: fix this, currently does not work
<test name="DocumentLibraryPageTest">
<classes>
<class name="org.alfresco.po.share.site.document.DocumentLibraryPageTest"/>
</classes>
</test>
-->
<test name="FileDirectoryInfoTest">
<classes>
<class name="org.alfresco.po.share.site.document.FileDirectoryInfoTest">