Open PeterWippermann opened 9 years ago
Good catch. Do consider as a workaround (and also the difference in size/readability/intent) changing
Tree componentTree = leftTabPanel.find(Tree.class).withElement(treeElement).done();
to
Tree componentTree = new Tree(leftTabPanel.getDriver(), treeElement);
or just
Tree componentTree = new Tree(driver, treeElement);
If you already have the root element, calling leftTabPanel.find
doesn't make a ton of sense, you aren't going to use that parent except to share its driver anyway.
Additionally, be very careful about using IDs in your gwt code - the entire purpose of this tool is to avoid the development/testing hazards that can come from doing that. If the tree is the primary content of that tab, find the tree as the first Tree inside the tab content.
Hi @niloc132 , thanks for your advise. But does your answer mean that you don't want to get Tree.find() fixed? :-/
This will be fixed, it is definitely a bug. I've heard reports of that generics manipulation failing in other ways, but this is the first time I've seen a reproducible case.
:+1: :smiley:
I noticed that no Finder had been implemented for
org.senchalabs.gwt.gwtdriver.gxt.models.Tree
. With no specific with-methods, I decided to provide theWebElement
:. However, this fails early since the generic find-method throws a ClassCastException from GwtWidget.class; line 155:
Class<T> finderType = (Class<T>) t.getActualTypeArguments()[0];
This in turn is caused by the abscence of a specific finder. Compare
public class Tree extends GwtWidget<GwtWidgetFinder<Tree>>
topublic class Button extends GwtWidget<ButtonFinder>
I understand to a certain degree that you didn't want to implement the model to full extend, but I think at least the basic methods like find() should work.