Load condition annotations do not work with Lists of elements
Closed this issue · 4 comments
alechenninger commented
Given a view...
class MyView extends AbstractView {
@Require
List<Element> elements = elements(By.css(".yep"));
}
This will throw MissingLoadConditionException
.
Considerations:
- Require non empty?
- Add ability to a certain number in the list? At least a certain number? At most a certain number?
alechenninger commented
@Require(5)
@Require(atLeast = 5)
@Require(atLeast = 1, atMost = 5)
Maybe?
alechenninger commented
Other challenge: after looking into the elements within the list, the list of elements will not be repopulated again. So if we check, there are none, that's it. More that show up won't be refound.
If the proxies implement "Caching" then we can invalidate this cached list with every load condition evaluation.
alechenninger commented
Just formalizing our in person discussion:
- Going with
@Require
and addingexactly
,atLeast
, andatMost
parameters. The defaults should be -1, 1, and -1, respectively, where anything < 0 is ignored, and the logical default is at least 1 (so omitting all of the parameters with a list is equivalent to@Require(atLeast = 1)
- In order to get a fresh list of elements any time the load condition is evaluated, the List proxy should implement
Caching
, and when the load condition with the list is checked, it should callinvalidateCache
before anything else.
Let me know if you have any questions!
alechenninger commented
You could probably actually just default atMost
to Integer.MAX_VALUE
and then you wouldn't have to worry about a special case for -1
.