diff --git a/pogen4selenium-example/src/main/java/io/toolisticon/pogen4selenium/example/GoogleHomepage.java b/pogen4selenium-example/src/main/java/io/toolisticon/pogen4selenium/example/GoogleHomepage.java deleted file mode 100644 index 9fcc832..0000000 --- a/pogen4selenium-example/src/main/java/io/toolisticon/pogen4selenium/example/GoogleHomepage.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.toolisticon.pogen4selenium.example; - -import java.util.List; - -import org.openqa.selenium.WebDriver; - -import io.toolisticon.pogen4selenium.api.ActionClick; -import io.toolisticon.pogen4selenium.api.ActionMoveToAndClick; -import io.toolisticon.pogen4selenium.api.ActionWrite; -import io.toolisticon.pogen4selenium.api.ExtractData; -import io.toolisticon.pogen4selenium.api.PageObject; -import io.toolisticon.pogen4selenium.api.PageObjectElement; -import io.toolisticon.pogen4selenium.api.PageObjectParent; - -@PageObject -public interface GoogleHomepage extends PageObjectParent{ - - static final String RESULTS_XPATH = "//div[@id='search']//div[@class='MjjYud']/div"; - - @PageObjectElement(elementVariableName=GoogleHomepage.SEARCH_FIELD_ID, value="//textarea[@name='q']" ) - static final String SEARCH_FIELD_ID = "searchField"; - - @PageObjectElement(elementVariableName=GoogleHomepage.SEARCH_BUTTON_ID, value="//input[@name='btnK']" ) - static final String SEARCH_BUTTON_ID = "searchButton"; - - @PageObjectElement(elementVariableName=GoogleHomepage.ACCEPT_L2AGL_BUTTON_ID, value="//button[@id='L2AGLb']" ) - static final String ACCEPT_L2AGL_BUTTON_ID = "acceptL2aglButton"; - - - - @ActionMoveToAndClick(ACCEPT_L2AGL_BUTTON_ID) - GoogleHomepage acceptL2Agl(); - - GoogleHomepage enterSearchString(@ActionWrite(SEARCH_FIELD_ID) String searchString); - - @ActionClick(SEARCH_BUTTON_ID) - GoogleHomepage clickSearchButton(); - - @ExtractData(by = io.toolisticon.pogen4selenium.api.By.XPATH, value = RESULTS_XPATH) - List getResults(); - - @ExtractData(by = io.toolisticon.pogen4selenium.api.By.XPATH, value = RESULTS_XPATH) - GoogleSearchResult getFirstResult(); - - - public static GoogleHomepage init(WebDriver driver) { - driver.get("https://www.google.de"); - return new GoogleHomepageImpl(driver); - } - - -} diff --git a/pogen4selenium-example/src/main/java/io/toolisticon/pogen4selenium/example/GoogleSearchResult.java b/pogen4selenium-example/src/main/java/io/toolisticon/pogen4selenium/example/GoogleSearchResult.java deleted file mode 100644 index 04489ef..0000000 --- a/pogen4selenium-example/src/main/java/io/toolisticon/pogen4selenium/example/GoogleSearchResult.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.toolisticon.pogen4selenium.example; - -import io.toolisticon.pogen4selenium.api.By; -import io.toolisticon.pogen4selenium.api.DataObject; -import io.toolisticon.pogen4selenium.api.ExtractDataValue; -import io.toolisticon.pogen4selenium.api.ExtractDataValue.Kind; - -@DataObject -public interface GoogleSearchResult { - - @ExtractDataValue(by = By.XPATH, value = "./div//a//h3") - String title(); - - @ExtractDataValue(by = By.XPATH, value = "./div//a", kind=Kind.ATTRIBUTE, name="href") - String href(); - -} diff --git a/pogen4selenium-example/src/test/java/io/toolisticon/pogen4selenium/example/GoogleSearchTest.java b/pogen4selenium-example/src/test/java/io/toolisticon/pogen4selenium/example/GoogleSearchTest.java deleted file mode 100644 index 4b073a5..0000000 --- a/pogen4selenium-example/src/test/java/io/toolisticon/pogen4selenium/example/GoogleSearchTest.java +++ /dev/null @@ -1,74 +0,0 @@ -package io.toolisticon.pogen4selenium.example; - -import java.time.Duration; -import java.util.List; - -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.edge.EdgeDriver; - -public class GoogleSearchTest { - - - private WebDriver webDriver; - private JettyServer jettyServer; - - @Before - public void init() throws Exception{ - - jettyServer = new JettyServer(); - jettyServer.start(); - - webDriver = new EdgeDriver(); - webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10)); - } - - @After - public void cleanup() throws Exception{ - webDriver.quit(); - jettyServer.stop(); - } - - @Test - //@Ignore - public void testGoogleSearch() { - GoogleHomepage.init(webDriver) - .acceptL2Agl() - .enterSearchString("aptk toolisticon \n") - //.clickSearchButton() - .doAssertions(e -> { - - // Do assertions here - List results = e.getResults(); - - MatcherAssert.assertThat(results.getFirst().title(), Matchers.containsString("toolisticon/aptk")); - MatcherAssert.assertThat(results.getFirst().href(), Matchers.is("https://github.com/toolisticon/aptk")); - - }) - ; - } - - @Test - //@Ignore - public void testGoogleSearch_firstMatch() { - GoogleHomepage.init(webDriver) - .acceptL2Agl() - .enterSearchString("aptk toolisticon \n") - //.clickSearchButton() - .doAssertions(e -> { - - // Do assertions here - GoogleSearchResult results = e.getFirstResult(); - - MatcherAssert.assertThat(results.title(), Matchers.containsString("toolisticon/aptk")); - MatcherAssert.assertThat(results.href(), Matchers.is("https://github.com/toolisticon/aptk")); - - }) - ; - } - -} diff --git a/pom.xml b/pom.xml index 3e7737a..273ecfa 100644 --- a/pom.xml +++ b/pom.xml @@ -139,11 +139,7 @@ ${toolisticon.deployment.skip} - - com.spotify - dockerfile-maven - ${maven-docker-plugin.version} - + maven-enforcer-plugin