-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
506 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
webserviceEnvironment=local | ||
baseUrl = 'http://localhost:9001' | ||
baseUrl = http://localhost:9001 | ||
driver=chrome |
9 changes: 9 additions & 0 deletions
9
...tests/src/test/java/flyinghigh/services/acceptancetests/CalculatePointsFromPurchases.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package flyinghigh.services.acceptancetests; | ||
|
||
import net.thucydides.jbehave.ThucydidesJUnitStory; | ||
|
||
/** | ||
* Created by john on 18/09/2014. | ||
*/ | ||
public class CalculatePointsFromPurchases extends ThucydidesJUnitStory { | ||
} |
9 changes: 9 additions & 0 deletions
9
...ce-tests/src/test/java/flyinghigh/services/acceptancetests/CalculatingRequiredPoints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package flyinghigh.services.acceptancetests; | ||
|
||
import net.thucydides.jbehave.ThucydidesJUnitStory; | ||
|
||
/** | ||
* Created by john on 18/09/2014. | ||
*/ | ||
public class CalculatingRequiredPoints extends ThucydidesJUnitStory { | ||
} |
26 changes: 26 additions & 0 deletions
26
acceptance-tests/src/test/java/flyinghigh/services/acceptancetests/pages/MyAccountPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package flyinghigh.services.acceptancetests.pages; | ||
|
||
import flyinghigh.services.acceptancetests.domain.Airport; | ||
import net.thucydides.core.annotations.DefaultUrl; | ||
import net.thucydides.core.pages.PageObject; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@DefaultUrl("http://localhost:9001/#/myaccount") | ||
public class MyAccountPage extends PageObject { | ||
|
||
private int calculatedPoints; | ||
|
||
public void selectDepartureCity(String departure) { | ||
$("#departure").selectByVisibleText(departure); | ||
} | ||
|
||
public void selectDestinationCity(String destination) { | ||
$("#destination").selectByVisibleText(destination); | ||
} | ||
|
||
public int getCalculatedPoints() { | ||
return Integer.valueOf($(".requiredPoints").getText()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...rc/test/java/flyinghigh/services/acceptancetests/stepdefs/MyAccountStepUIDefinitions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package flyinghigh.services.acceptancetests.stepdefs; | ||
|
||
import flyinghigh.services.acceptancetests.domain.Airport; | ||
import flyinghigh.services.acceptancetests.pages.HomePage; | ||
import flyinghigh.services.acceptancetests.pages.MyAccountPage; | ||
import flyinghigh.services.acceptancetests.rest.RestClient; | ||
import flyinghigh.services.acceptancetests.steps.AirportClientSteps; | ||
import flyinghigh.services.acceptancetests.steps.MyAccountUISteps; | ||
import net.thucydides.core.annotations.Steps; | ||
import org.jbehave.core.annotations.Given; | ||
import org.jbehave.core.annotations.Then; | ||
import org.jbehave.core.annotations.When; | ||
|
||
import java.util.List; | ||
|
||
import static org.fest.assertions.api.Assertions.assertThat; | ||
|
||
|
||
/** | ||
* Created by john on 17/09/2014. | ||
*/ | ||
public class MyAccountStepUIDefinitions { | ||
|
||
@Steps | ||
MyAccountUISteps myAccountSteps; | ||
|
||
@Given("I am on the My Account page") | ||
public void openMyAccountPage() { | ||
myAccountSteps.openAccountPage(); | ||
} | ||
|
||
int calculatedPoints; | ||
|
||
@When("I calculate the points needed to go from <departure> to <destination>") | ||
public void calculatePointsNeeded(String departure, String destination) { | ||
calculatedPoints = myAccountSteps.calculatePointsNeededBetween(departure,destination); | ||
} | ||
|
||
@Then("I should see <requiredPoints> points") | ||
public void shouldSeeRequiredPoints(int requiredPoints) { | ||
assertThat(calculatedPoints).isEqualTo(requiredPoints); | ||
} | ||
|
||
|
||
} |
35 changes: 35 additions & 0 deletions
35
...ests/src/test/java/flyinghigh/services/acceptancetests/stepdefs/RouteStepDefinitions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package flyinghigh.services.acceptancetests.stepdefs; | ||
|
||
import flyinghigh.services.acceptancetests.rest.RestClient; | ||
import org.jbehave.core.annotations.Given; | ||
import org.jbehave.core.annotations.Then; | ||
import org.jbehave.core.annotations.When; | ||
|
||
import static org.fest.assertions.api.Assertions.assertThat; | ||
|
||
/** | ||
* Created by john on 27/09/2014. | ||
*/ | ||
public class RouteStepDefinitions { | ||
|
||
RestClient restClient = new RestClient(); | ||
|
||
String departure; | ||
String destination; | ||
int calculatedPoints; | ||
|
||
@Given("I want to go from <departure> to <destination>") | ||
public void setDepartureAndDestination(String departure, String destination) { | ||
this.departure = departure; | ||
this.destination = destination; | ||
} | ||
@When("I calculate the number of required points") | ||
public void calculateRequiredPoints() { | ||
calculatedPoints = restClient.calculateRequiredPoints(departure, destination); | ||
} | ||
|
||
@Then("I should obtain <requiredPoints>") | ||
public void checkCalculatedPoints(int requiredPoints) { | ||
assertThat(calculatedPoints).isEqualTo(requiredPoints); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...tance-tests/src/test/java/flyinghigh/services/acceptancetests/steps/MyAccountUISteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package flyinghigh.services.acceptancetests.steps; | ||
|
||
import flyinghigh.services.acceptancetests.pages.MyAccountPage; | ||
import net.thucydides.core.annotations.Step; | ||
|
||
public class MyAccountUISteps { | ||
|
||
MyAccountPage myAccountPage; | ||
|
||
@Step | ||
public void openAccountPage() { | ||
myAccountPage.open(); | ||
} | ||
|
||
@Step | ||
public int calculatePointsNeededBetween(String departure, String destination) { | ||
myAccountPage.selectDepartureCity(departure); | ||
myAccountPage.selectDestinationCity(destination); | ||
return myAccountPage.getCalculatedPoints(); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
acceptance-tests/src/test/resources/stories/earning_points/narrative.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Earning Points | ||
In order to encourage clients to book flights more often | ||
We want clients to be able to book flights using points they earn through flights or partner purchases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
acceptance-tests/src/test/resources/stories/managing_airports/narrative.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Airports | ||
In order to encourage clients to book flights more often | ||
We want to make clients aware of all the possible destinations they can fly to with Flying High Airlines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
acceptance-tests/src/test/resources/stories/partners/narrative.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Frequent Flyer Partners | ||
In order to attract more clients | ||
We want members to be able to earn points by spending with partner organizations |
34 changes: 34 additions & 0 deletions
34
...ptance-tests/src/test/resources/stories/spending_points/calculating_required_points.story
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Meta: | ||
@Versions Release 1, Iteration 1.1 | ||
|
||
Narrative: | ||
As a traveller | ||
I want to know how many points I need to go to a given destination | ||
So that I can plan my next trip with Flying High Airlines | ||
|
||
Notes: 2 points required per km | ||
|
||
Scenario: Calculate required points | ||
Given I am a frequent flyer | ||
And I am on the My Account page | ||
When I calculate the points needed to go from <departure> to <destination> | ||
Then I should see <requiredPoints> points | ||
Examples: | ||
|departure |destination |requiredPoints| | ||
|Sydney |Melbourne |1700 | | ||
|Melbourne |Wellington |4400 | | ||
|
||
Scenario: Required points between different destinations | ||
Given I want to go from <departure> to <destination> | ||
When I calculate the number of required points | ||
Then I should obtain <requiredPoints> | ||
Examples: | ||
|departure |destination |requiredPoints| | ||
|SYD |MEL |1700 | | ||
|MEL |SYD |1700 | | ||
|SYD |SFO |13000 | | ||
|MEL |WLG |4400 | | ||
|MEL |LAX |12400 | | ||
|BNE |SYD |1700 | | ||
|BNE |LAX |12400 | | ||
|LAX |BNE |12400 | |
3 changes: 3 additions & 0 deletions
3
acceptance-tests/src/test/resources/stories/spending_points/narrative.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Spending Frequent Flyer points | ||
In order to encourage clients to book flights more often | ||
We want to let clients spend the points they earn when booking flights |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...services/accounts/services/Bootstrap.java → ...accounts/services/database/Bootstrap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ices/accounts/services/DatabaseSetup.java → ...unts/services/database/DatabaseSetup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ava/flyinghigh/services/accounts/services/destinations/DestinationsCalculatorService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package flyinghigh.services.accounts.services.destinations; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import flyinghigh.services.flights.domain.Route; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
|
||
@Component | ||
public class DestinationsCalculatorService { | ||
public List<String> findPossibleDestinations(String homeAirportCode, int statusPoints) { | ||
return ImmutableList.of("Melbourne", "Brisbane"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.