From 93b3c3a8c308314e6eafbb2ae898387f424bf1f3 Mon Sep 17 00:00:00 2001 From: lefthandedgoat Date: Thu, 29 Aug 2013 20:35:01 -0500 Subject: [PATCH] Added phantomJS, #94 --- basictests/Program.fs | 70 +++++++++--------- canopy/canopy.fs | 7 +- canopy/configuration.fs | 1 + ...ojectstructure.fsproj.FileListAbsolute.txt | 1 - ...cture.fsprojResolveAssemblyReference.cache | Bin 23025 -> 0 bytes 5 files changed, 43 insertions(+), 36 deletions(-) delete mode 100644 sampleprojectstructure/obj/Debug/sampleprojectstructure.fsproj.FileListAbsolute.txt delete mode 100644 sampleprojectstructure/obj/Debug/sampleprojectstructure.fsprojResolveAssemblyReference.cache diff --git a/basictests/Program.fs b/basictests/Program.fs index 8f2aa10e..e79f25a0 100644 --- a/basictests/Program.fs +++ b/basictests/Program.fs @@ -6,7 +6,7 @@ open runner open configuration open reporters -start firefox +start chrome let mainBrowser = browser elementTimeout <- 3.0 compareTimeout <- 3.0 @@ -281,39 +281,6 @@ before (fun _ -> Console.WriteLine "only before set now") url testpage "#firstName" == "John1") -context "alert tests" -before (fun _ -> !^ "http://lefthandedgoat.github.io/canopy/testpages/alert") - -"alert box should have 'Alert Test'" &&& (fun _ -> - click "#alert_test" - alert() == "Alert Test" - acceptAlert()) - -"alert box should have 'Alert Test'" &&& (fun _ -> - click "#alert_test" - alert() == "Alert Test" - dismissAlert()) - -"alert box should fail correctly when expecting wrong message" &&& (fun _ -> - failsWith "equality check failed. expected: Not the message, got: Alert Test" - click "#alert_test" - alert() == "Not the message") - -"confirmation box should have 'Confirmation Test'" &&& (fun _ -> - click "#confirmation_test" - alert() == "Confirmation Test" - acceptAlert()) - -"confirmation box should have 'Confirmation Test'" &&& (fun _ -> - click "#confirmation_test" - alert() == "Confirmation Test" - dismissAlert()) - -"confirmation box should fail correctly when expecting wrong message" &&& (fun _ -> - failsWith "equality check failed. expected: Not the message, got: Confirmation Test" - click "#confirmation_test" - alert() == "Not the message") - context "other tests" "define a custom wait for using any function that takes in unit and returns bool" &&& (fun _ -> @@ -406,6 +373,41 @@ context "dragging" click "#task_editor_buttons .save_button" ".handle" --> ".inprogress") +if not (browser :? OpenQA.Selenium.PhantomJS.PhantomJSDriver) then + context "alert tests" + + before (fun _ -> !^ "http://lefthandedgoat.github.io/canopy/testpages/alert") + + "alert box should have 'Alert Test'" &&& (fun _ -> + click "#alert_test" + alert() == "Alert Test" + acceptAlert()) + + "alert box should have 'Alert Test'" &&& (fun _ -> + click "#alert_test" + alert() == "Alert Test" + dismissAlert()) + + "alert box should fail correctly when expecting wrong message" &&& (fun _ -> + failsWith "equality check failed. expected: Not the message, got: Alert Test" + click "#alert_test" + alert() == "Not the message") + + "confirmation box should have 'Confirmation Test'" &&& (fun _ -> + click "#confirmation_test" + alert() == "Confirmation Test" + acceptAlert()) + + "confirmation box should have 'Confirmation Test'" &&& (fun _ -> + click "#confirmation_test" + alert() == "Confirmation Test" + dismissAlert()) + + "confirmation box should fail correctly when expecting wrong message" &&& (fun _ -> + failsWith "equality check failed. expected: Not the message, got: Confirmation Test" + click "#confirmation_test" + alert() == "Not the message") + context "tiling windows" "start multiple browsers and tile them" &&& (fun _ -> start chrome diff --git a/canopy/canopy.fs b/canopy/canopy.fs index 7a8cbb23..83354b0d 100644 --- a/canopy/canopy.fs +++ b/canopy/canopy.fs @@ -52,11 +52,12 @@ type BrowserStartMode = | Chrome | ChromeWithOptions of Chrome.ChromeOptions | ChromeWithOptionsAndTimeSpan of Chrome.ChromeOptions * TimeSpan + | PhantomJS let firefox = Firefox let ie = IE let chrome = Chrome - +let phantomJS = PhantomJS let mutable browsers = [] @@ -510,6 +511,7 @@ let start b = //for ie you need to set Settings -> Advance -> Security Section -> Check-Allow active content to run files on My Computer* //also download IEDriverServer and place in c:\ or configure with ieDir //firefox just works + //for phantomjs download it and put in c:\ or configure with phantomJSDir browser <- match b with | IE -> @@ -528,6 +530,9 @@ let start b = new OpenQA.Selenium.Firefox.FirefoxDriver() :> IWebDriver | FirefoxWithProfile profile -> new OpenQA.Selenium.Firefox.FirefoxDriver(profile) :> IWebDriver + | PhantomJS -> + new OpenQA.Selenium.PhantomJS.PhantomJSDriver(phantomJSDir) :> IWebDriver + if autoPinBrowserRightOnLaunch = true then pin Right browsers <- browsers @ [browser] diff --git a/canopy/configuration.fs b/canopy/configuration.fs index ba553c30..496b2112 100644 --- a/canopy/configuration.fs +++ b/canopy/configuration.fs @@ -6,6 +6,7 @@ let failFast = ref false let mutable chromeDir = @"c:\" let mutable ieDir = @"c:\" +let mutable phantomJSDir = @"c:\" let mutable elementTimeout = 10.0 let mutable compareTimeout = 10.0 let mutable pageTimeout = 10.0 diff --git a/sampleprojectstructure/obj/Debug/sampleprojectstructure.fsproj.FileListAbsolute.txt b/sampleprojectstructure/obj/Debug/sampleprojectstructure.fsproj.FileListAbsolute.txt deleted file mode 100644 index f477f967..00000000 --- a/sampleprojectstructure/obj/Debug/sampleprojectstructure.fsproj.FileListAbsolute.txt +++ /dev/null @@ -1 +0,0 @@ -C:\projects\canopy\sampleprojectstructure\obj\Debug\sampleprojectstructure.fsprojResolveAssemblyReference.cache diff --git a/sampleprojectstructure/obj/Debug/sampleprojectstructure.fsprojResolveAssemblyReference.cache b/sampleprojectstructure/obj/Debug/sampleprojectstructure.fsprojResolveAssemblyReference.cache deleted file mode 100644 index 0945dd714882f3f5ec0004f6a9adce547e277746..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23025 zcmeHP3zQVa6`h)$ot)Nk7gxQXNbe#oq34WTDj%6s(9+4sGR0V9MAo)N znwuI|sJfx$vK_?WUsGdOA)PPiYDZQrB zr6t+kth6e%C~LfT5k2dTyqf9BD|r=KQc6p!oU0jE{3+6vOQ+RDo@!u3<}1ePywaCe zQE91$NC4ymRqIGWUYJvo-AW>#)9cLF33cT%1B$NdBavxWE~zfjb8EGvs)r!x(Ke_7 zdLtvaLP-}?!{@81@zvH23wf2bz{+c)N1YeA^51{PjM)vSm3%BwDF9MSWF%4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