scala - Error using Specs2 with FluentLenium Api -
i utilize scala 2.10, specs2 13.1-snapshot , fluentlenium api provided play2 framework 2.1.
i have line of code in integrationspec
file, finding kid element (according fluentlenium spec):
browser.find(".myclass").find("#mysubelement") must havesize(1)
that line leads next compilation error:
error: type mismatch; found : org.fluentlenium.core.domain.fluentlist[_ <: org.fluentlenium.core.domain.fluentwebelement] required: org.fluentlenium.core.domain.fluentlist[?0(in value $anonfun)] type ?0(in value $anonfun) <: org.fluentlenium.core.domain.fluentwebelement note: org.fluentlenium.core.domain.fluentwebelement >: ?0, java-defined class fluentlist invariant in type e. may wish investigate wildcard type such `_ >: ?0`. (sls 3.2.10)
is kind of...incompatibilty scala/java due generics?? or normal behaviour didn't figure out?
this line (omitting matcher), compiles:
browser.find(".myclass").find("#mysubelement")
the havesize
matcher require element beingness matched have org.specs2.data.sized
typeclass in scope. corresponding typeclass java collections is:
implicit def javacollectionissized[t <: java.util.collection[_]]: sized[t] = new sized[t] { def size(t: t) = t.size() }
i suspect type inference here issue , seek tame next ugly code:
browser.find(".myclass"). find("#mysubelement"). asinstanceof[fluentlist[fluentwebelement]] must havesize(1)
or maybe
browser.find(".myclass"). find("#mysubelement"). asinstanceof[collection[_]] must havesize(1)
or
import scala.collection.convert.javaconverters._ browser.find(".myclass"). find("#mysubelement"). asscala must havesize(1)
scala webdriver playframework-2.0 specs2
No comments:
Post a Comment