Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added new tests

  • Loading branch information...
commit ba9dd4dac5160ed2e8894c6b201bad11c5521b6a 1 parent 39c96bf
John Ferguson Smart wakaleo authored
49 ...ides-showcase-simple-webtests/src/main/java/net/thucydides/showcase/simple/pages/AdvancedSearchPage.java
View
@@ -0,0 +1,49 @@
+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 AdvancedSearchPage extends PageObject {
+
+ private WebElement groupId;
+ private WebElement artifactId;
+ private String value;
+ private WebElement version;
+ private WebElement packaging;
+ private WebElement classifier;
+
+ private WebElement gavSearchButton;
+
+ public AdvancedSearchPage(WebDriver driver) {
+ super(driver);
+ }
+
+ public void setGroupId(String value) {
+ element(groupId).type(value);
+ }
+
+ public void setArtifactId(String value) {
+ element(artifactId).type(value);
+ }
+
+ public void setVersion(String value) {
+ element(version).type(value);
+ }
+
+ public void setPackaging(String value) {
+ element(packaging).type(value);
+ }
+
+ public void setClassifier(String value) {
+ element(classifier).type(value);
+ }
+
+
+ public void startSearch() {
+ element(gavSearchButton).click();
+ }
+}
53 ...imple-webtests/src/test/java/net/thucydides/showcase/simple/WhenSearchingForArtifactsUsingAWildCard.java
View
@@ -0,0 +1,53 @@
+package net.thucydides.showcase.simple;
+
+import net.thucydides.core.annotations.Managed;
+import net.thucydides.core.annotations.ManagedPages;
+import net.thucydides.core.annotations.Steps;
+import net.thucydides.core.annotations.Story;
+import net.thucydides.core.pages.Pages;
+import net.thucydides.junit.runners.ThucydidesRunner;
+import net.thucydides.showcase.simple.requirements.Application;
+import net.thucydides.showcase.simple.steps.DeveloperSteps;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import static net.thucydides.core.matchers.BeanMatchers.each;
+import static net.thucydides.core.matchers.BeanMatchers.the;
+import static net.thucydides.core.matchers.BeanMatchers.the_count;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.startsWith;
+
+@RunWith(ThucydidesRunner.class)
+@Story(Application.Search.SearchForArtifactsByName.class)
+public class WhenSearchingForArtifactsUsingAWildCard {
+
+ @Managed
+ WebDriver driver;
+
+ @ManagedPages(defaultUrl = "http://search.maven.org")
+ public Pages pages;
+
+ @Steps
+ public DeveloperSteps developer;
+
+ @Test
+ public void should_search_for_artifacts_by_name_containing_a_wildcard() {
+ developer.opens_the_search_page();
+ developer.searches_for("thucydides*");
+ developer.should_see_artifacts_where(the("ArtifactId", is("thucydides")),
+ the("GroupId", is("net.thucydides")));
+
+ }
+
+ @Test
+ public void should_find_the_right_number_of_artifacts_when_using_a_wildcard() {
+ developer.opens_the_search_page();
+ developer.searches_for("thucydides*");
+ developer.should_see_artifacts_where(the("GroupId", startsWith("net.thucydides")),
+ each("ArtifactId").isDifferent(),
+ the_count(is(greaterThanOrEqualTo(16))));
+
+ }
+}
44 ...va/net/thucydides/showcase/simple/WhenSearchingForArtifactsUsingMultipleCriteriaInTheAdvancedSearch.java
View
@@ -0,0 +1,44 @@
+package net.thucydides.showcase.simple;
+
+import net.thucydides.core.annotations.Managed;
+import net.thucydides.core.annotations.ManagedPages;
+import net.thucydides.core.annotations.Steps;
+import net.thucydides.core.annotations.Story;
+import net.thucydides.core.pages.Pages;
+import net.thucydides.junit.runners.ThucydidesRunner;
+import net.thucydides.showcase.simple.requirements.Application;
+import net.thucydides.showcase.simple.steps.DeveloperSteps;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import static net.thucydides.core.matchers.BeanMatchers.each;
+import static net.thucydides.core.matchers.BeanMatchers.the;
+import static net.thucydides.core.matchers.BeanMatchers.the_count;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.startsWith;
+
+@RunWith(ThucydidesRunner.class)
+@Story(Application.Search.SearchForArtifactsByName.class)
+public class WhenSearchingForArtifactsUsingMultipleCriteriaInTheAdvancedSearch {
+
+ @Managed
+ WebDriver driver;
+
+ @ManagedPages(defaultUrl = "http://search.maven.org")
+ public Pages pages;
+
+ @Steps
+ public DeveloperSteps developer;
+
+ @Test
+ public void should_search_for_artifacts_by_group_id_and_version() {
+ developer.opens_the_advanced_search_page();
+ developer.searches_by_group_and_version("net.thucydides","0.6.0");
+ developer.should_see_artifacts_where(the("GroupId", is("net.thucydides")),
+ the("Version", is("0.6.0")));
+
+ }
+
+}
53 ...btests/src/test/java/net/thucydides/showcase/simple/WhenSearchingForArtifactsUsingTheAdvancedSearch.java
View
@@ -0,0 +1,53 @@
+package net.thucydides.showcase.simple;
+
+import net.thucydides.core.annotations.Managed;
+import net.thucydides.core.annotations.ManagedPages;
+import net.thucydides.core.annotations.Steps;
+import net.thucydides.core.annotations.Story;
+import net.thucydides.core.pages.Pages;
+import net.thucydides.junit.runners.ThucydidesRunner;
+import net.thucydides.showcase.simple.requirements.Application;
+import net.thucydides.showcase.simple.steps.DeveloperSteps;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import static net.thucydides.core.matchers.BeanMatchers.each;
+import static net.thucydides.core.matchers.BeanMatchers.the;
+import static net.thucydides.core.matchers.BeanMatchers.the_count;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.startsWith;
+
+@RunWith(ThucydidesRunner.class)
+@Story(Application.Search.SearchForArtifactsByName.class)
+public class WhenSearchingForArtifactsUsingTheAdvancedSearch {
+
+ @Managed
+ WebDriver driver;
+
+ @ManagedPages(defaultUrl = "http://search.maven.org")
+ public Pages pages;
+
+ @Steps
+ public DeveloperSteps developer;
+
+ @Test
+ public void should_search_for_artifacts_by_group_id() {
+ developer.opens_the_advanced_search_page();
+ developer.searches_by_group("net.thucydides");
+ developer.should_see_artifacts_where(the("GroupId", is("net.thucydides")),
+ the_count(greaterThanOrEqualTo(10)));
+
+ }
+
+ @Test
+ public void should_search_for_artifacts_by_artifact_id() {
+ developer.opens_the_advanced_search_page();
+ developer.searches_by_artifact("thucydides-core");
+ developer.should_see_artifacts_where(the("ArtifactId", is("thucydides-core")),
+ the_count(is(1)));
+
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.