-
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
1 changed file
with
13 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 13 additions & 3 deletions
16
src/test/scala/im/mange/acceptance/driveby/scalatest/condition/ElementHiddenSpec.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 ElementHiddenSpec extends WebSpecification with Matchers { | ||
def `work for id` { | ||
val id = Id("hidden") | ||
given.page(<b id={id.id} style="display:none">hidden</b>) | ||
.assert(ElementHidden(id)) | ||
val id = "ElementHidden" | ||
given.page(<b id={id} style="display:none">{id}</b>) | ||
.assert(ElementHidden(Id(id))) | ||
} | ||
|
||
def `fail for id not hidden` { | ||
val id = "ElementHiddenWhenNotHidden" | ||
val b = given.page(<b id={id} style="">{id}</b>) | ||
|
||
val thrown = the [ConditionNotMetException] thrownBy { b.assert(ElementHidden(Id(id))) } | ||
thrown.getMessage should equal("""> FAILED: Assert ElementHidden("Id(ElementHiddenWhenNotHidden)", "true") but was "true" (not met within 2000 millis)""") | ||
} | ||
|
||
} |