-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 13 additions & 3 deletions
16
src/test/scala/im/mange/acceptance/driveby/scalatest/condition/ElementVisibleSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
package im.mange.acceptance.driveby.scalatest.condition | ||
|
||
import im.mange.acceptance.driveby.scalatest.WebSpecification | ||
import im.mange.common.ConditionNotMetException | ||
import im.mange.driveby.Id | ||
import im.mange.driveby.conditions._ | ||
import org.scalatest.Matchers | ||
|
||
class ElementVisibleSpec extends WebSpecification with Matchers { | ||
def `work for id` { | ||
val id = Id("visible") | ||
given.page(<b id={id.id} style="display:block">visible</b>) | ||
.assert(ElementVisible(id)) | ||
val id = "ElementVisible" | ||
given.page(<b id={id} style="display:block">{id}</b>) | ||
.assert(ElementVisible(Id(id))) | ||
} | ||
|
||
def `fail for id not visible` { | ||
val id = "ElementVisibleWhenHidden" | ||
val b = given.page(<b id={id} style="display:none">{id}</b>) | ||
|
||
val thrown = the [ConditionNotMetException] thrownBy { b.assert(ElementVisible(Id(id))) } | ||
thrown.getMessage should equal("""> FAILED: Assert ElementVisible("Id(ElementVisibleWhenHidden)", "true") but was "false" (not met within 2000 millis)""") | ||
} | ||
|
||
} |