Skip to content

Commit

Permalink
Navigate back & forward
Browse files Browse the repository at this point in the history
  • Loading branch information
JonCanning committed Oct 8, 2014
1 parent a76d0ab commit b4e223e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,17 @@ let title() = browser.Title

let reload = currentUrl >> url

type Navigate =
| Back
| Forward

let back = Back
let forward = Forward

let navigate = function
| Back -> browser.Navigate().Back()
| Forward -> browser.Navigate().Forward()

let coverage (url : 'a) =
let mutable innerUrl = ""
match box url with
Expand Down
24 changes: 24 additions & 0 deletions tests/basictests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -588,16 +588,22 @@ context "User Agents tests"
start <| ChromeWithUserAgent userAgents.iPad
url "http://whatsmyuseragent.com/"
".info" *~ "iPad"
quit browser
switchTo mainBrowser

"FirefoxDeviceWithUserAgent userAgents.iPhone should show as iPhone" &&& fun _ ->
start <| FirefoxWithUserAgent userAgents.iPhone
url "http://whatsmyuseragent.com/"
".info" *~ "iPhone"
quit browser
switchTo mainBrowser

"FirefoxDeviceWithUserAgent myagent should show as myagent" &&& fun _ ->
start <| FirefoxWithUserAgent "myagent"
url "http://whatsmyuseragent.com/"
".info" *~ "myagent"
quit browser
switchTo mainBrowser

context "Resize tests"

Expand All @@ -607,13 +613,17 @@ context "Resize tests"
resize (400,400)
"#cWidth" == "400"
"#cHeight" == "400"
quit browser
switchTo mainBrowser

"Chrome should be resized to iPhone4" &&& fun _ ->
start chrome
url "http://resizemybrowser.com/"
resize screenSizes.iPhone4
"#cWidth" == "320"
"#cHeight" == "480"
quit browser
switchTo mainBrowser

"Firefox should be resized to 400,500 then rotated to 500,400" &&& fun _ ->
start firefox
Expand All @@ -622,6 +632,8 @@ context "Resize tests"
rotate()
"#cHeight" == "400"
"#cWidth" == "500"
quit browser
switchTo mainBrowser

"Chrome should be resized and rotated to iPhone4" &&& fun _ ->
start chrome
Expand All @@ -630,6 +642,8 @@ context "Resize tests"
rotate()
"#cHeight" == "320"
"#cWidth" == "480"
quit browser
switchTo mainBrowser

context "pluggable finders tests"

Expand All @@ -648,6 +662,16 @@ addFinder findByHref
click "actions.html"
on "http://lefthandedgoat.github.io/canopy/actions.html"

context "Navigate tests"

"Browser should navigate back and forward" &&& fun _ ->
url "http://lefthandedgoat.github.io/canopy/index.html"
click "actions.html"
navigate back
on "http://lefthandedgoat.github.io/canopy/index.html"
navigate forward
on "http://lefthandedgoat.github.io/canopy/actions.html"

context "todo tests"

"write a test that tests the whole internet!" &&& todo
Expand Down

0 comments on commit b4e223e

Please sign in to comment.