Been digging at this for a while, and I can't seem to find a way to resize a window using scalatest plus.
The only method I've found searching online or the documentation at http://doc.scalatest.org/2.1.5/index.html#org.scalatest.selenium.WebBrowser
is executeScript("window.resizeTo(700,700);")
but that has been unresponsive to me (no errors, no nothing). Is there a method that covers this that I am missing? A brief sample of my code:
import java.util.concurrent.TimeUnit
import org.scalatestplus.play._
import org.openqa.selenium._
import com.sun.xml.internal.bind.v2.TODO
import scala.collection.JavaConverters._
import controllers.Application
import models.{Item, ItemPriorityBucket}
import play.api.test._
import org.scalatest.time._
class WebSpec extends PlaySpec with OneServerPerSuite with AllBrowsersPerTest {
implicit override val patienceConfig =
PatienceConfig(timeout = scaled(Span(5, Seconds)), interval = scaled(Span(20, Millis)))
override lazy val browsers = Vector(
// FirefoxInfo(firefoxProfile),
ChromeInfo
// SafariInfo
)
implicit override lazy val app: FakeApplication =
FakeApplication(additionalConfiguration = TestUtil.inMemoryDatabase("default", Map()))
val base: String = "http://localhost:" + port
def sharedTests(browser: BrowserInfo) = {
"Home page" should {
"render an item" + browser.name in {
executeScript("window.resizeTo(700,700);")
Item.deleteAll()
delete all cookies
val itemId = TestUtil.createRandomItem(Some(ItemPriorityBucket.Low), Some(Application.ENGLISH))
val item = Item.find(itemId).get
go to (base + "/")
eventually { assert(cssSelector(Selectors.all_items).webElement.isDisplayed) }
}
}
}
One of my tests will see different elements based on the window size, so this is something I need to control, but I can't really find any help out there for doing this in Scala.
Thanks for the help,
EDIT: I should also mention that other scripts run using execute script are functioning as expected, just not the resize window script