im.yagni.driveby.conditions.TextEquals.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 TextEquals {
import Describer._
def apply(by: By, expected: String) = new Condition {
def expectation = expect("TextEquals", List(by.toString, expected))
def isSatisfied(browser: UnSafeBrowser) = { browser.text(by) == expected }
def describeFailure(browser: UnSafeBrowser) = { expectation + butWas(() => browser.text(by)) }
}
}