-
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.
[#5] Added possibility to use actions in DataObjects - warning: must …
…add validations and decide how to handle return types
- Loading branch information
1 parent
b30459a
commit c27a6e7
Showing
22 changed files
with
179 additions
and
90 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
pogen4selenium-api/src/main/java/io/toolisticon/pogen4selenium/runtime/CommonByLocators.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,15 @@ | ||
package io.toolisticon.pogen4selenium.runtime; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
|
||
/** | ||
* These are the locators which should be used by actions, that are both available in {@link DataObjectParentImpl} and {@link PageObjectParentImpl}. | ||
*/ | ||
public interface CommonByLocators { | ||
|
||
WebElement waitForElementToBeInteractable(By by); | ||
|
||
WebElement waitForElementToBePresent(By by); | ||
|
||
} |
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
9 changes: 9 additions & 0 deletions
9
...example/src/main/java/io/toolisticon/pogen4selenium/example/googleseach/ExternalPage.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 io.toolisticon.pogen4selenium.example.googleseach; | ||
|
||
import io.toolisticon.pogen4selenium.api.PageObject; | ||
import io.toolisticon.pogen4selenium.api.PageObjectParent; | ||
|
||
@PageObject | ||
public interface ExternalPage extends PageObjectParent<ExternalPage>{ | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
...ageobject/actions/ActionClickHandler.java → ...or/common/actions/ActionClickHandler.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
...sor/pageobject/actions/ActionHandler.java → ...ocessor/common/actions/ActionHandler.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
49 changes: 49 additions & 0 deletions
49
...or/src/main/java/io/toolisticon/pogen4selenium/processor/common/actions/ActionHelper.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,49 @@ | ||
package io.toolisticon.pogen4selenium.processor.common.actions; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.lang.model.element.Element; | ||
import javax.lang.model.element.TypeElement; | ||
|
||
import io.toolisticon.aptk.tools.wrapper.ElementWrapper; | ||
import io.toolisticon.aptk.tools.wrapper.ExecutableElementWrapper; | ||
import io.toolisticon.aptk.tools.wrapper.TypeElementWrapper; | ||
import io.toolisticon.aptk.tools.wrapper.VariableElementWrapper; | ||
import io.toolisticon.pogen4selenium.api.Action; | ||
|
||
public class ActionHelper { | ||
|
||
private ActionHelper() { | ||
|
||
} | ||
|
||
public static boolean hasActions(ExecutableElementWrapper executableElementWrapper) { | ||
return !getActions(executableElementWrapper).isEmpty(); | ||
} | ||
|
||
public static List<ActionWrapper> getActions(ExecutableElementWrapper executableElementWrapper) { | ||
|
||
// Must get annotations by Meta annotation Action | ||
List<ActionWrapper> actions = getActionsForElement(executableElementWrapper); | ||
|
||
List<VariableElementWrapper> annotatedParameters = executableElementWrapper.getParameters(); | ||
|
||
for (VariableElementWrapper annotatedParameter : annotatedParameters) { | ||
actions.addAll(getActionsForElement(annotatedParameter)); | ||
} | ||
|
||
return actions; | ||
} | ||
|
||
private static List<ActionWrapper> getActionsForElement(ElementWrapper<? extends Element> element) { | ||
return element.getAnnotations().stream() | ||
.filter(e -> e.asElement().hasAnnotation(Action.class)) | ||
.<ActionWrapper>map(e -> { | ||
|
||
return new ActionWrapper(TypeElementWrapper.wrap((TypeElement)(e.getAnnotationType().asElement())).getQualifiedName(), element.unwrap()); | ||
}) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
} |
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
...sor/pageobject/actions/ActionWrapper.java → ...ocessor/common/actions/ActionWrapper.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
...ageobject/actions/ActionWriteHandler.java → ...or/common/actions/ActionWriteHandler.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
...eobject/actions/DefaultActionHandler.java → .../common/actions/DefaultActionHandler.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
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 |
---|---|---|
|
@@ -19,4 +19,6 @@ public static List<ExtractDataValueWrapper> value(DataObjectWrapper dataObjectWr | |
|
||
} | ||
|
||
|
||
|
||
} |
42 changes: 0 additions & 42 deletions
42
.../java/io/toolisticon/pogen4selenium/processor/datatoextract/MethodsToImplementHelper.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.