Build opt 22 06 (#2132)
* Drools reformat * Further refactor * Further refactor * Refactor
This commit is contained in:
committed by
GitHub
parent
38dc2041a1
commit
87049b63f4
-3
@@ -2,9 +2,6 @@ package com.baeldung.serenity;
|
||||
|
||||
import net.serenitybdd.jbehave.SerenityStory;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class GithubUserProfilePayloadIntegrationTest extends SerenityStory {
|
||||
|
||||
}
|
||||
|
||||
@@ -13,13 +13,11 @@ import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
@RunWith(SerenityRunner.class)
|
||||
public class GoogleSearchLiveTest {
|
||||
|
||||
@Managed(driver = "chrome") private WebDriver browser;
|
||||
@Managed(driver = "chrome")
|
||||
private WebDriver browser;
|
||||
|
||||
@Test
|
||||
public void whenGoogleBaeldungThenShouldSeeEugen() {
|
||||
|
||||
@@ -7,15 +7,13 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
@RunWith(SerenityRunner.class)
|
||||
public class GoogleSearchPageObjectLiveTest {
|
||||
|
||||
@Managed(driver = "chrome") private WebDriver browser;
|
||||
@Managed(driver = "chrome")
|
||||
private WebDriver browser;
|
||||
|
||||
GoogleSearchPageObject googleSearch;
|
||||
private GoogleSearchPageObject googleSearch;
|
||||
|
||||
@Test
|
||||
public void whenGoogleBaeldungThenShouldSeeEugen() {
|
||||
|
||||
@@ -12,19 +12,20 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import static net.serenitybdd.screenplay.GivenWhenThen.*;
|
||||
import static net.serenitybdd.screenplay.GivenWhenThen.givenThat;
|
||||
import static net.serenitybdd.screenplay.GivenWhenThen.seeThat;
|
||||
import static net.serenitybdd.screenplay.GivenWhenThen.then;
|
||||
import static net.serenitybdd.screenplay.GivenWhenThen.when;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
@RunWith(SerenityRunner.class)
|
||||
public class GoogleSearchScreenplayLiveTest {
|
||||
|
||||
@Managed(driver = "chrome") WebDriver browser;
|
||||
@Managed(driver = "chrome")
|
||||
private WebDriver browser;
|
||||
|
||||
Actor kitty = Actor.named("kitty");
|
||||
private Actor kitty = Actor.named("kitty");
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
|
||||
@@ -16,7 +16,8 @@ import static com.baeldung.serenity.membership.MemberGrade.Silver;
|
||||
@RunWith(SerenityRunner.class)
|
||||
public class MemberStatusIntegrationTest {
|
||||
|
||||
@Steps MemberStatusSteps memberSteps;
|
||||
@Steps
|
||||
private MemberStatusSteps memberSteps;
|
||||
|
||||
@Test
|
||||
public void membersShouldStartWithBronzeStatus() {
|
||||
@@ -42,7 +43,7 @@ public class MemberStatusIntegrationTest {
|
||||
|
||||
@Test
|
||||
@Title("Members with 50,000 points can exchange a MacBook Pro")
|
||||
public void memberWith50000PointsCanExchangeAMacbookpro(){
|
||||
public void memberWith50000PointsCanExchangeAMacbookpro() {
|
||||
memberSteps.aMemberHasPointsOf(50_000);
|
||||
memberSteps.aMemberExchangeA(MacBookPro);
|
||||
memberSteps.memberShouldHavePointsLeft();
|
||||
@@ -55,7 +56,7 @@ public class MemberStatusIntegrationTest {
|
||||
@Test
|
||||
@Ignore
|
||||
@Title("Members with 500 points should have a Gold status when added 4,000 points ($40,000)")
|
||||
public void memberWith500PointsEarnsGoldAfterSpends$40000(){
|
||||
public void memberWith500PointsEarnsGoldAfterSpends$40000() {
|
||||
memberSteps.aMemberHasPointsOf(500);
|
||||
memberSteps.theMemberSpends(40_000);
|
||||
memberSteps.theMemberShouldHaveAStatusOf(Gold);
|
||||
@@ -64,7 +65,7 @@ public class MemberStatusIntegrationTest {
|
||||
@Test
|
||||
@Ignore
|
||||
@Title("Members with 100 points would have a Gold status when added 10,000 points ($100,000)")
|
||||
public void memberWith100EarnsGoldAfterSpends$100000(){
|
||||
public void memberWith100EarnsGoldAfterSpends$100000() {
|
||||
memberSteps.aMemberHasPointsOf(100);
|
||||
memberSteps.theMemberSpends(100_000);
|
||||
memberSteps.theMemberShouldHaveAStatusOf(Gold);
|
||||
|
||||
+4
-7
@@ -8,25 +8,22 @@ import java.io.IOException;
|
||||
import static net.serenitybdd.rest.SerenityRest.rest;
|
||||
import static net.serenitybdd.rest.SerenityRest.then;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class GithubRestAssuredUserAPISteps {
|
||||
class GithubRestAssuredUserAPISteps {
|
||||
|
||||
private String api;
|
||||
|
||||
@Step("Given the github REST API for user profile")
|
||||
public void withUserProfileAPIEndpoint() {
|
||||
void withUserProfileAPIEndpoint() {
|
||||
api = "https://api.github.com/users/{username}";
|
||||
}
|
||||
|
||||
@Step("When looking for {0} via the api")
|
||||
public void getProfileOfUser(String username) throws IOException {
|
||||
void getProfileOfUser(String username) throws IOException {
|
||||
rest().get(api, username);
|
||||
}
|
||||
|
||||
@Step("Then there should be a login field with value {0} in payload of user {0}")
|
||||
public void profilePayloadShouldContainLoginValue(String username) {
|
||||
void profilePayloadShouldContainLoginValue(String username) {
|
||||
then().body("login", Matchers.equalTo(username));
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,6 @@ import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class GithubRestUserAPISteps {
|
||||
|
||||
private String api;
|
||||
|
||||
+1
-4
@@ -9,11 +9,8 @@ import java.io.IOException;
|
||||
|
||||
public class GithubUserProfilePayloadStepDefinitions {
|
||||
|
||||
// @Steps
|
||||
// GithubRestUserAPISteps userAPISteps;
|
||||
|
||||
@Steps
|
||||
GithubRestAssuredUserAPISteps userAPISteps;
|
||||
private GithubRestAssuredUserAPISteps userAPISteps;
|
||||
|
||||
@Given("github user profile api")
|
||||
public void givenGithubUserProfileApi() {
|
||||
|
||||
@@ -6,12 +6,9 @@ import net.thucydides.core.annotations.Step;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class MemberStatusSteps {
|
||||
|
||||
Member member;
|
||||
private Member member;
|
||||
|
||||
@Step("Given a member has {0} points")
|
||||
public void aMemberHasPointsOf(int points) {
|
||||
@@ -35,7 +32,7 @@ public class MemberStatusSteps {
|
||||
|
||||
@Pending
|
||||
@Step("When the member exchange {}")
|
||||
public void aMemberExchangeA(Commodity commodity){
|
||||
public void aMemberExchangeA(Commodity commodity) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -10,15 +10,14 @@ import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
@DefaultUrl("https://www.google.com/ncr")
|
||||
public class GoogleSearchPageObject extends PageObject {
|
||||
|
||||
@FindBy(name = "q") private WebElement search;
|
||||
@FindBy(name = "q")
|
||||
private WebElement search;
|
||||
|
||||
@FindBy(css = "._ksh") private WebElement result;
|
||||
@FindBy(css = "._ksh")
|
||||
private WebElement result;
|
||||
|
||||
public void searchFor(String keyword) {
|
||||
search.sendKeys(keyword, Keys.ENTER);
|
||||
|
||||
@@ -8,13 +8,13 @@ import net.thucydides.core.annotations.DefaultUrl;
|
||||
* @author baoqiang
|
||||
*/
|
||||
@DefaultUrl("https://www.google.com/ncr")
|
||||
public class GoogleSearchPage extends PageObject {
|
||||
class GoogleSearchPage extends PageObject {
|
||||
|
||||
public static final Target SEARCH_RESULT_TITLES = Target
|
||||
static final Target SEARCH_RESULT_TITLES = Target
|
||||
.the("search results")
|
||||
.locatedBy("._ksh");
|
||||
|
||||
public static final Target SEARCH_INPUT_BOX = Target
|
||||
static final Target SEARCH_INPUT_BOX = Target
|
||||
.the("search input box")
|
||||
.locatedBy("#lst-ib");
|
||||
|
||||
|
||||
@@ -6,9 +6,6 @@ import net.serenitybdd.screenplay.questions.Text;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author baoqiang
|
||||
*/
|
||||
public class GoogleSearchResults implements Question<List<String>> {
|
||||
|
||||
public static Question<List<String>> displayed() {
|
||||
|
||||
@@ -7,9 +7,6 @@ import net.serenitybdd.screenplay.actions.Enter;
|
||||
import net.thucydides.core.annotations.Step;
|
||||
import org.openqa.selenium.Keys;
|
||||
|
||||
/**
|
||||
* @author baoqiang
|
||||
*/
|
||||
public class SearchForKeyword implements Task {
|
||||
|
||||
@Step("{0} searches for '#keyword'")
|
||||
|
||||
@@ -7,9 +7,6 @@ import net.thucydides.core.annotations.Step;
|
||||
|
||||
import static net.serenitybdd.screenplay.Tasks.instrumented;
|
||||
|
||||
/**
|
||||
* @author baoqiang
|
||||
*/
|
||||
public class StartWith implements Task {
|
||||
|
||||
public static StartWith googleSearchPage() {
|
||||
|
||||
Reference in New Issue
Block a user