From 7974322366574a349c389fbe816d0058d8ec962e Mon Sep 17 00:00:00 2001 From: Tjeerd Verhagen Date: Tue, 6 Oct 2015 19:38:18 +0200 Subject: [PATCH 1/7] fix: Brings package name in class inline with the package directory structure --- .../java/net/serenity_bdd/demo/pages/GoogleHomePage.java | 2 +- .../java/net/serenity_bdd/demo/pages/GoogleResultsPage.java | 2 +- .../java/net/serenity_bdd/demo/steps/GoogleSearchSteps.java | 6 +++--- .../java/net/serenity_bdd/demo/SearchingOnGoogleStory.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java index 50dd36a581..9c9d0f20c7 100644 --- a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java +++ b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java @@ -1,4 +1,4 @@ -package net.thucydides.demo.pages; +package net.serenity_bdd.demo.pages; import net.thucydides.core.annotations.At; import net.thucydides.core.pages.PageObject; diff --git a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java index 46d977f7e6..53006e7b76 100644 --- a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java +++ b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java @@ -1,4 +1,4 @@ -package net.thucydides.demo.pages; +package net.serenity_bdd.demo.pages; import net.thucydides.core.annotations.At; import net.thucydides.core.pages.PageObject; diff --git a/serenity-demo/src/main/java/net/serenity_bdd/demo/steps/GoogleSearchSteps.java b/serenity-demo/src/main/java/net/serenity_bdd/demo/steps/GoogleSearchSteps.java index ed407c56ef..7b9e1c7f2b 100644 --- a/serenity-demo/src/main/java/net/serenity_bdd/demo/steps/GoogleSearchSteps.java +++ b/serenity-demo/src/main/java/net/serenity_bdd/demo/steps/GoogleSearchSteps.java @@ -1,11 +1,11 @@ -package net.thucydides.demo.steps; +package net.serenity_bdd.demo.steps; import net.thucydides.core.annotations.Step; import net.thucydides.core.annotations.StepGroup; import net.thucydides.core.pages.Pages; import net.thucydides.core.steps.ScenarioSteps; -import net.thucydides.demo.pages.GoogleHomePage; -import net.thucydides.demo.pages.GoogleResultsPage; +import net.serenity_bdd.demo.pages.GoogleHomePage; +import net.serenity_bdd.demo.pages.GoogleResultsPage; import java.util.List; diff --git a/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java b/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java index a2354c0ac4..5e725e1bba 100644 --- a/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java +++ b/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java @@ -1,10 +1,10 @@ -package net.thucydides.demo; +package net.serenity_bdd.demo; import net.thucydides.core.annotations.Managed; import net.thucydides.core.annotations.ManagedPages; import net.thucydides.core.annotations.Steps; import net.thucydides.core.pages.Pages; -import net.thucydides.demo.steps.GoogleSearchSteps; +import net.serenity_bdd.demo.steps.GoogleSearchSteps; import net.thucydides.junit.runners.ThucydidesRunner; import org.junit.Test; import org.junit.runner.RunWith; From 476a18322150cbba6439a96ee9492243434ad476 Mon Sep 17 00:00:00 2001 From: Tjeerd Verhagen Date: Wed, 7 Oct 2015 09:40:32 +0200 Subject: [PATCH 2/7] fix: Updates dependencies to latest stable release 0.8 thucydides-junit 0.8.31 (was 0.8.1-SNAPSHTOT) thucydides-core 0.8.31 (was 0.8.1-SNAPSHTOT) Adds dependency slf4j-simple 1.6.4 --- serenity-demo/pom.xml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/serenity-demo/pom.xml b/serenity-demo/pom.xml index 5c3f2253ed..d95fc9128c 100644 --- a/serenity-demo/pom.xml +++ b/serenity-demo/pom.xml @@ -24,13 +24,21 @@ net.thucydides thucydides-junit - 0.8.1-SNAPSHOT + 0.8.31 + test net.thucydides thucydides-core - 0.8.1-SNAPSHOT + 0.8.31 + + + org.slf4j + slf4j-simple + 1.6.4 + test + From 7d21048e9a2b3b0d000f82adba06c7c3e7e33dc7 Mon Sep 17 00:00:00 2001 From: Tjeerd Verhagen Date: Wed, 7 Oct 2015 10:07:57 +0200 Subject: [PATCH 3/7] fix: Corrects issue auto forwarding from google.com to google.xxx the country specific search page. --- .../java/net/serenity_bdd/demo/SearchingOnGoogleStory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java b/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java index 5e725e1bba..7277d9f5b9 100644 --- a/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java +++ b/serenity-demo/src/test/java/net/serenity_bdd/demo/SearchingOnGoogleStory.java @@ -16,7 +16,9 @@ public class SearchingOnGoogleStory { @Managed public WebDriver webdriver; - @ManagedPages(defaultUrl = "http://www.google.com") + // Using 'http://www.google.com/ncr' prevents redirects from 'google.com' + // to country specific google search pages. For example in Germany 'google.de'. + @ManagedPages(defaultUrl = "http://www.google.com/ncr") public Pages pages; @Steps From a860b0bb5f3b58f5d66f89e49fbc64df9dc3402e Mon Sep 17 00:00:00 2001 From: Tjeerd Verhagen Date: Wed, 7 Oct 2015 10:09:31 +0200 Subject: [PATCH 4/7] fix: Corrects issue with auto redirect to secure connection (https instead of http) --- .../java/net/serenity_bdd/demo/pages/GoogleHomePage.java | 9 +++++---- .../net/serenity_bdd/demo/pages/GoogleResultsPage.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java index 9c9d0f20c7..534c3d1fe5 100644 --- a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java +++ b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleHomePage.java @@ -7,14 +7,14 @@ import org.openqa.selenium.support.FindBy; -@At("http://www.google\\..*") +@At("https://www.google\\..*") public class GoogleHomePage extends PageObject { @FindBy(name="q") WebElement query; - @FindBy(name="btnG") - WebElement searchButton; +// @FindBy(name="btnK") +// WebElement searchButton; public GoogleHomePage(WebDriver driver) { super(driver); @@ -22,7 +22,8 @@ public GoogleHomePage(WebDriver driver) { public void searchFor(String term) { query.sendKeys(term); - searchButton.click(); + query.submit(); +// searchButton.click(); waitABit(200); } } diff --git a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java index 53006e7b76..e44e862b8d 100644 --- a/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java +++ b/serenity-demo/src/main/java/net/serenity_bdd/demo/pages/GoogleResultsPage.java @@ -11,7 +11,7 @@ import java.util.List; -@At("http://www.google\\..*") +@At("https://www.google\\..*") public class GoogleResultsPage extends PageObject { @FindBy(name="btnG") From 5556ddae9469a43e829046a999ed505ac9a0a2a1 Mon Sep 17 00:00:00 2001 From: Tjeerd Verhagen Date: Wed, 7 Oct 2015 11:00:51 +0200 Subject: [PATCH 5/7] chore: Adds profiles 'firefox' and 'chrome', for easier running the tests with different browsers. --- serenity-demo/pom.xml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/serenity-demo/pom.xml b/serenity-demo/pom.xml index d95fc9128c..023fb4b80f 100644 --- a/serenity-demo/pom.xml +++ b/serenity-demo/pom.xml @@ -4,7 +4,7 @@ net.thucydides thucydides-demo - 0.0.1-SNAPSHOT + 0.8.0-SNAPSHOT jar thucydides-demo @@ -56,6 +56,10 @@ **/Abstract*.java + + ${webdriver.driver} + ${webdriver.chrome.driver} + @@ -88,4 +92,23 @@ + + + + firefox + + true + + + firefox + + + + chrome + + chrome + /path-to/chromedriver + + + From 365388539e0dfc3cb9f9a98a4616a4ab98997156 Mon Sep 17 00:00:00 2001 From: Tjeerd Verhagen Date: Wed, 7 Oct 2015 11:32:29 +0200 Subject: [PATCH 6/7] docs: Adds description about the Serenity Demo --- serenity-demo/README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 serenity-demo/README.md diff --git a/serenity-demo/README.md b/serenity-demo/README.md new file mode 100644 index 0000000000..d0b4a7c6e6 --- /dev/null +++ b/serenity-demo/README.md @@ -0,0 +1,40 @@ +# Serenity Demo + + +__WARNING:__ Works with Serenity v0.8.31, Selenium v2.23.1 + + +## Execute the Demo + + +### Run Serenity with Maven, using FireFox + + mvn verify + +Does not run on Mac OS-X v10.10.5 with FireFox v41.0.1 +Probably the `serenity-firefox-driver v2.23.1` is to old. + + +### Run Serenity with Maven, using Chrome + +__WARNING:__ Before running the Maven command below, make sure the property `webdriver.chrome.driver` has the +correct value. Open the `pom.xml` and search for the profile _chrome_. Correct the path for _webdriver.chrome.driver_. + + mvn -Pchrome verify + +Runs on Mac OS-X v10.10.5 with Chrome v45.0.2454.93 (64-bit) + + +## Using Maven settings, for system specific properties + +The Chrome Web-Driver path can be set in the Maven `pom.xml`. But it can also be added in the `settings.xml`. This +makes it easier, as no system / user specific settings are needed in the project configuration (`pom.xml`). + +Add the following lines to the `settings.xml`, in the section for `profiles`. + + + chrome + + /Users/tjeerd/applications-dev/chromedriver + + From 6148fe2833f5e7fb6d4de327ae27447538a07661 Mon Sep 17 00:00:00 2001 From: Tjeerd Verhagen Date: Wed, 7 Oct 2015 11:37:33 +0200 Subject: [PATCH 7/7] docs: Adds description how to correct add chrome-web-driver --- serenity-demo/pom.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/serenity-demo/pom.xml b/serenity-demo/pom.xml index 023fb4b80f..85f8b79d46 100644 --- a/serenity-demo/pom.xml +++ b/serenity-demo/pom.xml @@ -96,9 +96,6 @@ firefox - - true - firefox @@ -107,7 +104,13 @@ chrome chrome + + + + +