net.serenitybdd.screenplay.actors.OnStage Java Examples

The following examples show how to use net.serenitybdd.screenplay.actors.OnStage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@Given("(\\w+) (\\w+) is a registered trader$")
public void a_registered_trader(String firstName, String lastName) {

    Actor trader = OnStage.theActorCalled(firstName);

    trader.attemptsTo(
            RegisterWithBDDTrader.asANewClient(Client.withFirstName(firstName)
                                                     .andLastName(lastName)
                                                     .andEmail(firstName + "@" + lastName + ".com"))
    );
}
 
Example #2
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@When("^(.*) (?:purchases|has purchased) (\\d+) (.*) shares at \\$(.*) each$")
public void purchases_shares(String traderName, int amount, String securityCode, double marketPrice) {

    Actor trader = OnStage.theActorCalled(traderName);

    Client registeredClient = trader.recall("registeredClient");

    trader.attemptsTo(
            PlaceOrder.to(Buy, amount)
                      .sharesOf(securityCode)
                      .atPriceOf(marketPrice)
                      .forClient(registeredClient)
    );
}
 
Example #3
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@When("^(.*) sells (\\d+) (.*) shares for \\$(.*) each$")
public void sells_shares(String traderName, int amount, String securityCode, double marketPrice) {

    Actor trader = OnStage.theActorCalled(traderName);

    Client registeredClient = trader.recall("registeredClient");

    trader.attemptsTo(
            PlaceOrder.to(Sell, amount)
                    .sharesOf(securityCode)
                    .atPriceOf(marketPrice)
                    .forClient(registeredClient)
    );
}
 
Example #4
Source File: BuyingAndSellingSharesStepDefinitions.java    From bdd-trader with Apache License 2.0 5 votes vote down vote up
@Then("^(.*) should have the following positions:$")
public void should_have_the_following_positions(String traderName, DataTable expectedPositionTable) {

    String[] relevantFields = relevantFieldsInTable(expectedPositionTable);
    List<Position> expectedPositions = expectedPositionTable.asList(Position.class);
    Actor trader = OnStage.theActorCalled(traderName);

    Client registeredClient = trader.recall("registeredClient");

    List<Position> clientPositons = trader.asksFor(ThePortfolio.positionsForClient(registeredClient));

    assertThat(clientPositons)
            .usingElementComparatorOnFields(relevantFields)
            .containsAll(expectedPositions);
}
 
Example #5
Source File: InicioSesionStepDefinition.java    From screenplay-dojo with MIT License 4 votes vote down vote up
@Before
public void setTheStage() {
    OnStage.setTheStage(new OnlineCast());
}
 
Example #6
Source File: SetupSteps.java    From bdd-trader with Apache License 2.0 4 votes vote down vote up
@Before({"@web"})
public void setStage() {
    OnStage.setTheStage(new OnlineCast());
}
 
Example #7
Source File: ClientStepDefinitions.java    From bdd-trader with Apache License 2.0 4 votes vote down vote up
@Given("^a trader with the following details:$")
public void a_trader_with_the_following_details(List<Client> clients) {
    tim = OnStage.theActorCalled("Tim the trader");
    client = clients.get(0); // We are only interested in a single client
}
 
Example #8
Source File: SearchItemsSD.java    From serenity-cucumber-bdd-screenplay with Apache License 2.0 4 votes vote down vote up
@Before
public void set_the_stage(){
    OnStage.setTheStage(new OnlineCast());
}
 
Example #9
Source File: UserLoginStepDef.java    From serenity-cucumber-bdd-screenplay with Apache License 2.0 4 votes vote down vote up
@Before
public void set_the_stage(){
    OnStage.setTheStage(new OnlineCast());
}
 
Example #10
Source File: ShoppingCartSteps.java    From serenity-cucumber-bdd-screenplay with Apache License 2.0 4 votes vote down vote up
@Before
public void set_the_stage(){
    OnStage.setTheStage(new OnlineCast());
}
 
Example #11
Source File: CreateRepositoryInGitHubStepDefinition.java    From base_project_for_web_automation_projects with MIT License 4 votes vote down vote up
@Before
public void setTheStage() {
    OnStage.setTheStage(new OnlineCast());
    verifyIfDriverIsOpera();
}
 
Example #12
Source File: ParameterDefinitions.java    From serenity-cucumber-starter with Apache License 2.0 4 votes vote down vote up
@ParameterType(".*")
public Actor actor(String actorName) {
    return OnStage.theActorCalled(actorName);
}
 
Example #13
Source File: SearchStepDefinitions.java    From serenity-cucumber-starter with Apache License 2.0 4 votes vote down vote up
@Before
public void setTheStage() {
    OnStage.setTheStage(new OnlineCast());
}