Skip to content

Commit

Permalink
execute navigateTo automatically for every test #11 -
Browse files Browse the repository at this point in the history
 added test for enforceNavigateTo
  • Loading branch information
Daniel.Rey committed Oct 24, 2016
1 parent 363a618 commit 1ffecbe
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.scalawebtest.integration.extensions.aem

import org.scalatest.time.{Seconds, Span}
import org.scalatest.time.SpanSugar._
import org.scalawebtest.aem.AemTweaks
import org.scalawebtest.aem.WcmMode.DISABLED
import org.scalawebtest.core.gauge.Gauge.fit
Expand All @@ -14,8 +14,8 @@ class AemTweaksSpec extends ScalaWebTestBaseSpec with AemTweaks {
path = "/cookieVisualizing.jsp"

"When wcmmode DISABLED is select webBrowser" should "send the according cookie" in {
implicitlyWait(Span(1, Seconds))
eventually(timeout(Span(1, Seconds))) {
implicitlyWait(1 second)
eventually(timeout(1 second)) {
fit(<li>@contains wcmmode</li>)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package org.scalawebtest.integration.js

import org.scalatest.time.{Seconds, Span}
import org.scalatest.time.SpanSugar._
import org.scalawebtest.core.gauge.Gauge.fits
import org.scalawebtest.integration.ScalaWebTestBaseSpec

Expand All @@ -23,12 +23,12 @@ class AjaxSpec extends ScalaWebTestBaseSpec {
config.enableJavaScript(throwOnError = true)

"A simple webpage loading content with JS" should "be correctly interpreted by HtmlUnit" in {
eventually(timeout(Span(1, Seconds))) {
eventually(timeout(1 second)) {
container.text should include("Text loaded with JavaScript")
}
}
it should "work with CheckingGauge" in {
eventually(timeout(Span(1, Seconds))) {
eventually(timeout(1 second)) {
fits(<div id="container">Text loaded with JavaScript</div>)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.scalawebtest.integration.navigation

import org.scalatest.time.SpanSugar._
import org.scalawebtest.integration.ScalaWebTestBaseSpec

class EnforceNavigateTo extends ScalaWebTestBaseSpec{
path = "/simpleAjax.jsp"
config.enableJavaScript(throwOnError = true)
config.enforceNavigateTo()

"A simple webpage loading content with JS" should "be correctly interpreted by HtmlUnit" in {
eventually(timeout(1 second)) {
container.text should include("Text loaded with JavaScript")
}
}
it should "not be immediately available, if page was reloaded" in {
container.text should not include "Text loaded with JavaScript"
}

def container = {
find(cssSelector("div#container")).get
}
}

0 comments on commit 1ffecbe

Please sign in to comment.