Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Nov 29, 2011
0 parents commit 9b8b6c1
Show file tree
Hide file tree
Showing 13 changed files with 589 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.project
.settings
target
.idea
.classpath
.checkstyle
*.log
*.log.*
*.iml
*.versionsBackup
interpolated-*.xml
*.iws
*.ipr
out
.DS_Store
*.ignore
15 changes: 15 additions & 0 deletions thucydides-showcase-simple-webtests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.project
.settings
target
.idea
.classpath
.checkstyle
*.log
*.log.*
*.iml
*.versionsBackup
interpolated-*.xml
*.iws
*.ipr
out
*.ignore
189 changes: 189 additions & 0 deletions thucydides-showcase-simple-webtests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.thucydides.showcase</groupId>
<artifactId>thucydides-showcase-simple-webtests</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Sample Thucydides project</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<thucydides.version>0.4.30</thucydides.version>
<thucydides.easyb.version>0.4.30</thucydides.easyb.version>
<webdriver.driver>firefox</webdriver.driver>
</properties>

<dependencies>
<dependency>
<groupId>net.thucydides</groupId>
<artifactId>thucydides-core</artifactId>
<version>${thucydides.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>net.thucydides</groupId>
<artifactId>thucydides-junit</artifactId>
<version>${thucydides.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.thucydides.easyb</groupId>
<artifactId>thucydides-easyb-plugin</artifactId>
<version>${thucydides.easyb.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.lambdaj</groupId>
<artifactId>lambdaj</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.10</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
<include>**/When*.java</include>
</includes>
<argLine>-Xmx512m</argLine>
<systemPropertyVariables>
<webdriver.driver>${webdriver.driver}</webdriver.driver>
<thucydides.browser.width>1000</thucydides.browser.width>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.easyb</groupId>
<artifactId>maven-easyb-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<storyType>html</storyType>
<storyReport>target/easyb/easyb.html</storyReport>
<easybTestDirectory>src/test/stories</easybTestDirectory>
<jvmArguments>-Xmx512m -Dwebdriver.driver=${webdriver.driver}</jvmArguments>
</configuration>
</plugin>
<plugin>
<groupId>net.thucydides.maven.plugins</groupId>
<artifactId>maven-thucydides-plugin</artifactId>
<version>${thucydides.version}</version>
<executions>
<execution>
<id>thucydides-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>maven2</id>
<activation>
<file>
<missing>${basedir}</missing>
</file>
</activation>
<reporting>
<plugins>
<plugin>
<groupId>net.thucydides.maven.plugins</groupId>
<artifactId>maven-thucydides-plugin</artifactId>
<version>${thucydides.version}</version>
</plugin>
</plugins>
</reporting>
</profile>
<profile>
<id>maven3</id>
<activation>
<file>
<exists>${basedir}</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>net.thucydides.maven.plugins</groupId>
<artifactId>maven-thucydides-plugin</artifactId>
<version>${thucydides.version}</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package net.thucydides.showcase.simple.pages;

import net.thucydides.core.matchers.PropertyMatcher;
import net.thucydides.core.pages.PageObject;
import net.thucydides.core.pages.WebElementFacade;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import java.util.List;
import java.util.Map;

import static net.thucydides.core.pages.components.HtmlTable.filterRows;
import static net.thucydides.core.pages.components.HtmlTable.rowsFrom;

public class ArtifactDetailsPage extends PageObject {

WebElement groupid;
WebElement artifactid;
WebElement versionid;

public ArtifactDetailsPage(WebDriver driver) {
super(driver);
}

public String getGroupId() {
return element(groupid).getTextValue();
}

public String getArtifactId() {
return element(artifactid).getTextValue();
}

public String getVersionId() {
return element(versionid).getTextValue();
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.thucydides.showcase.simple.pages;

public class ArtifactEntry {
private final String groupId;
private final String artifactId;
private final String latestVersion;

public ArtifactEntry(String groupId, String artifactId, String latestVersion) {
this.groupId = groupId;
this.artifactId = artifactId;
this.latestVersion = latestVersion;
}

public String getGroupId() {
return groupId;
}

public String getArtifactId() {
return artifactId;
}

public String getLatestVersion() {
return latestVersion;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package net.thucydides.showcase.simple.pages;

import net.thucydides.core.annotations.DefaultUrl;
import net.thucydides.core.pages.PageObject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

@DefaultUrl("http://search.maven.org/")
public class SearchPage extends PageObject {


@FindBy(id="query")
private WebElement search;

@FindBy(id="queryButton")
private WebElement searchButton;

public SearchPage(WebDriver driver) {
super(driver);
}

public void enter_search_terms(String searchTerms) {
search.sendKeys(searchTerms);
}

public void starts_search() {
searchButton.click();
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package net.thucydides.showcase.simple.pages;

import net.thucydides.core.matchers.PropertyMatcher;
import net.thucydides.core.pages.PageObject;
import net.thucydides.core.pages.WebElementFacade;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import java.util.List;
import java.util.Map;

import static net.thucydides.core.pages.components.HtmlTable.filterRows;
import static net.thucydides.core.pages.components.HtmlTable.rowsFrom;

public class SearchResultsPage extends PageObject {

WebElement resultTable;

public SearchResultsPage(WebDriver driver) {
super(driver);
}

public List<Map<String, String>> getSearchResults() {
return rowsFrom(resultTable);
}

public WebElementFacade resultTable() {
return element(resultTable);
}

public void clickOnFirstRowMatching(PropertyMatcher... matchers) {
List<WebElement> matchingRows = filterRows(resultTable, matchers);
WebElement targetRow = matchingRows.get(0);
WebElement detailsLink = targetRow.findElement(By.xpath(".//a[contains(@href,'artifactdetails')]"));
detailsLink.click();
}
}


Loading

0 comments on commit 9b8b6c1

Please sign in to comment.