Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gwt-driver-7 Add faster child/descendant Widget locator #10

Merged
merged 5 commits into from
Feb 16, 2022
Merged

Conversation

jhickman
Copy link
Member

@jhickman jhickman commented Feb 15, 2022

Updated the unit test to utilize uibinder for easier test UI creation

Added 4 new exported methods:

  • getChildren
    • returns direct children of provided elements widget
  • findDescendantWidgetElementsOfType
    • finds all descendant widget elements of provided element widget of a specified type
  • findDescendantWidgetElements
    • finds all descendant widget elements
  • findFirstDescendantWidgetElementsOfType
    • locates the first descendant widget element of a specific type

Added a new "By" for the descendants search

Added a base GwtBy class with some helpers.

Modified each By implementation that needs a WebDriver to extract from the SearchContext

- Added new exported method "getChildren"
- Modified the existing descendant methods to stop including root widget
removed the need to pass the driver in by getting it from the search context.  pulled up common methods into base class.  Created convenient static methods in the GwtBy
convenience to call the getChildren exported method.
public List<WebElement> findElements(SearchContext context) {
Require.nonNull("Search Context", context);
final WebElement contextElem = toWebElement(context);
ExportedMethods m = ClientMethodsFactory.create(ExportedMethods.class, getDriver(context));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we shouldn't ThreadLocal/WeakRef map these instances to avoid re-creating them each call, and make them easy to look up on the current driver instance...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe. future update. I'll add new ticket

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11

@jhickman jhickman merged commit 1c6006c into main Feb 16, 2022
@jhickman jhickman deleted the gwt-driver-7 branch February 16, 2022 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants