im.yagni.driveby.conditions.ElementCountEquals.scala Maven / Gradle / Ivy
The newest version!
package im.yagni.driveby.conditions
import im.yagni.driveby.browser.UnSafeBrowser
import im.yagni.driveby.{By, Condition, Describer}
object ElementCountEquals {
import Describer._
def apply(by: By, expected: Int) = new Condition {
def expectation = expect("ElementCountEquals", List(by.toString, expected.toString))
def isSatisfied(browser: UnSafeBrowser) = { browser.findElements(by).size == expected }
def describeFailure(browser: UnSafeBrowser) = { expectation + butWas(() => browser.findElements(by).size.toString) }
}
}