Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigate back & forward #169

Merged
merged 1 commit into from
Oct 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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