-
Notifications
You must be signed in to change notification settings - Fork 0
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
30 changed files
with
727 additions
and
62 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
20 changes: 20 additions & 0 deletions
20
pogen4selenium-api/src/main/java/io/toolisticon/pogen4selenium/api/Action.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,20 @@ | ||
package io.toolisticon.pogen4selenium.api; | ||
|
||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Meta-Annotation to allow custom annotations. | ||
* | ||
*/ | ||
|
||
@Documented | ||
@Retention(RUNTIME) | ||
@Target(ANNOTATION_TYPE) | ||
public @interface Action { | ||
|
||
} |
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
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
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
53 changes: 53 additions & 0 deletions
53
...ain/java/io/toolisticon/pogen4selenium/example/withoutpagefactory/TestPagePageObject.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,53 @@ | ||
package io.toolisticon.pogen4selenium.example.withoutpagefactory; | ||
|
||
import java.util.List; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
|
||
import io.toolisticon.pogen4selenium.api.ActionMoveToAndClick; | ||
import io.toolisticon.pogen4selenium.api.ActionWrite; | ||
import io.toolisticon.pogen4selenium.api._By; | ||
import io.toolisticon.pogen4selenium.api.ExtractData; | ||
import io.toolisticon.pogen4selenium.api.ExtractDataValue; | ||
import io.toolisticon.pogen4selenium.api.ExtractDataValue.Kind; | ||
import io.toolisticon.pogen4selenium.api.PageObject; | ||
import io.toolisticon.pogen4selenium.api.PageObjectElement; | ||
import io.toolisticon.pogen4selenium.api.PageObjectParent; | ||
import io.toolisticon.pogen4selenium.api.Pause; | ||
|
||
@PageObject | ||
public interface TestPagePageObject extends PageObjectParent<TestPagePageObject>{ | ||
|
||
static final String DATA_EXTRACTION_FROM_TABLE_XPATH = "//table//tr[contains(@class,'data')]"; | ||
|
||
|
||
TestPagePageObject writeToInputField(@ActionWrite(by=_By.ID, value="input_field") String value); | ||
|
||
@ExtractDataValue(by=_By.ID, value = "input_field", kind=Kind.ATTRIBUTE, name="value") | ||
String readInputFieldValue(); | ||
|
||
@ActionMoveToAndClick(by=_By.XPATH, value = "//fieldset[@name='counter']/input[@type='button']") | ||
@Pause(value = 500L) | ||
TestPagePageObject clickCounterIncrementButton(); | ||
|
||
@ExtractData(by = io.toolisticon.pogen4selenium.api._By.XPATH, value = DATA_EXTRACTION_FROM_TABLE_XPATH) | ||
List<TestPageTableEntry> getTableEntries(); | ||
|
||
@ExtractData(by = io.toolisticon.pogen4selenium.api._By.XPATH, value = DATA_EXTRACTION_FROM_TABLE_XPATH) | ||
TestPageTableEntry getFirstTableEntry(); | ||
|
||
@ExtractDataValue(by = _By.XPATH, value="//fieldset[@name='counter']/span[@id='counter']") | ||
String getCounter(); | ||
|
||
// you can always provide your own methods and logic | ||
default String providedGetCounter() { | ||
return getDriver().findElement(org.openqa.selenium.By.xpath("//fieldset[@name='counter']/span[@id='counter']")).getText(); | ||
} | ||
|
||
// Custom entry point for starting your tests | ||
public static TestPagePageObject init(WebDriver driver) { | ||
driver.get("http://localhost:9090/start"); | ||
return new TestPagePageObjectImpl(driver); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...ain/java/io/toolisticon/pogen4selenium/example/withoutpagefactory/TestPageTableEntry.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,23 @@ | ||
package io.toolisticon.pogen4selenium.example.withoutpagefactory; | ||
|
||
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 TestPageTableEntry { | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[1]") | ||
String name(); | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[2]") | ||
String age(); | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[3]/a", kind = Kind.ATTRIBUTE, name = "href") | ||
String link(); | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[3]/a", kind = Kind.TEXT) | ||
String linkText(); | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
...c/main/java/io/toolisticon/pogen4selenium/example/withpagefactory/TestPagePageObject.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,62 @@ | ||
package io.toolisticon.pogen4selenium.example.withpagefactory; | ||
|
||
import java.util.List; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
|
||
import io.toolisticon.pogen4selenium.api.ActionMoveToAndClick; | ||
import io.toolisticon.pogen4selenium.api.ActionWrite; | ||
import io.toolisticon.pogen4selenium.api._By; | ||
import io.toolisticon.pogen4selenium.api.ExtractData; | ||
import io.toolisticon.pogen4selenium.api.ExtractDataValue; | ||
import io.toolisticon.pogen4selenium.api.ExtractDataValue.Kind; | ||
import io.toolisticon.pogen4selenium.api.PageObject; | ||
import io.toolisticon.pogen4selenium.api.PageObjectElement; | ||
import io.toolisticon.pogen4selenium.api.PageObjectParent; | ||
import io.toolisticon.pogen4selenium.api.Pause; | ||
|
||
@PageObject | ||
public interface TestPagePageObject extends PageObjectParent<TestPagePageObject>{ | ||
|
||
static final String DATA_EXTRACTION_FROM_TABLE_XPATH = "//table//tr[contains(@class,'data')]"; | ||
|
||
@PageObjectElement(elementVariableName=TestPagePageObject.INPUT_FIELD_ID, by = _By.ID, value="input_field" ) | ||
static final String INPUT_FIELD_ID = "inputField"; | ||
|
||
@PageObjectElement(elementVariableName=TestPagePageObject.COUNTER_INCREMENT_BUTTON_ID, by = _By.XPATH, value="//fieldset[@name='counter']/input[@type='button']" ) | ||
static final String COUNTER_INCREMENT_BUTTON_ID = "counterIncrementButton"; | ||
|
||
@PageObjectElement(elementVariableName=TestPagePageObject.DATA_EXTRACTION_FROM_TABLE_ID, by = _By.XPATH, value=DATA_EXTRACTION_FROM_TABLE_XPATH ) | ||
static final String DATA_EXTRACTION_FROM_TABLE_ID= "dataExtractionFromTable"; | ||
|
||
TestPagePageObject writeToInputField(@ActionWrite(INPUT_FIELD_ID) String value); | ||
|
||
@ExtractDataValue(by=_By.ELEMENT, value = INPUT_FIELD_ID, kind=Kind.ATTRIBUTE, name="value") | ||
String readInputFieldValue(); | ||
|
||
@ActionMoveToAndClick(COUNTER_INCREMENT_BUTTON_ID) | ||
@Pause(value = 500L) | ||
TestPagePageObject clickCounterIncrementButton(); | ||
|
||
@ExtractData(by = io.toolisticon.pogen4selenium.api._By.ELEMENT, value = DATA_EXTRACTION_FROM_TABLE_ID) | ||
List<TestPageTableEntry> getTableEntries(); | ||
|
||
@ExtractData(by = io.toolisticon.pogen4selenium.api._By.ELEMENT, value = DATA_EXTRACTION_FROM_TABLE_ID) | ||
TestPageTableEntry getFirstTableEntry(); | ||
|
||
|
||
@ExtractDataValue(by = _By.XPATH, value="//fieldset[@name='counter']/span[@id='counter']") | ||
String getCounter(); | ||
|
||
// you can always provide your own methods and logic | ||
default String providedGetCounter() { | ||
return getDriver().findElement(org.openqa.selenium.By.xpath("//fieldset[@name='counter']/span[@id='counter']")).getText(); | ||
} | ||
|
||
// Custom entry point for starting your tests | ||
public static TestPagePageObject init(WebDriver driver) { | ||
driver.get("http://localhost:9090/start"); | ||
return new TestPagePageObjectImpl(driver); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...c/main/java/io/toolisticon/pogen4selenium/example/withpagefactory/TestPageTableEntry.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,23 @@ | ||
package io.toolisticon.pogen4selenium.example.withpagefactory; | ||
|
||
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 TestPageTableEntry { | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[1]") | ||
String name(); | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[2]") | ||
String age(); | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[3]/a", kind = Kind.ATTRIBUTE, name = "href") | ||
String link(); | ||
|
||
@ExtractDataValue(by = _By.XPATH, value = "./td[3]/a", kind = Kind.TEXT) | ||
String linkText(); | ||
|
||
} |
Oops, something went wrong.