canopy icon indicating copy to clipboard operation
canopy copied to clipboard

Any instructions on how to setup a .fsx script file

Open rodsantest1 opened this issue 7 years ago • 7 comments

How do I setup imports and references to use .fsx script file?

I'm using VS 2017 FX 4.6.1

See image

rodsantest1 avatar Nov 06 '18 03:11 rodsantest1

This may help you:

https://github.com/lefthandedgoat/canopy/issues/148

lefthandedgoat avatar Nov 06 '18 19:11 lefthandedgoat

And this: https://github.com/lefthandedgoat/canopy/issues/385

amirrajan avatar Nov 07 '18 11:11 amirrajan

How does CanopyRepl work in canopy-lite? I tried fsi CanopyRepl.fsx but nothing happened. I was thinking it would somehow allow me to run a statement line by line like in old Visual Studio version where you can press Alt+Enter on a line to execute that line only.

rodsantest1 avatar Nov 13 '18 04:11 rodsantest1

I setup a script file using the paket generate_load_scripts command. I can just load the generated fsx file in my script file like: #load "./../../../.paket/load/net472/UITests/uitests.group.fsx".

I can start up a browser, create a test and have the test run. However, the only problem is that if I repeat throwing the code to the REPL, the test will be activated twice (because it is again added). So, I would like to clear the list of tests to be run. I tried this:


#load "./../../../.paket/load/net472/UITests/uitests.group.fsx"

open System
open System.IO
open canopy
open canopy.runner.classic
open canopy.configuration
open canopy.classic
open canopy.types

let filepath = __SOURCE_DIRECTORY__
let driverpath =
    @"./../../../packages/uitests/Selenium.WebDriver.ChromeDriver/driver/win32"
let chromepath = Path.Combine(filepath, driverpath)

chromeDir <- chromepath
suites <- [ new suite() ]
start chrome
"check if the app is loaded" &&& fun _ ->
    // go to the url
    url "http://localhost:8080/"
    // check if the elmish-app div is displayed
    displayed "#elmish-app"
run()
quit()

But trying to start with a fresh set of tests by suites <- [ new suite() ] doesn't work.

halcwb avatar Feb 05 '19 11:02 halcwb

@halcwb What you have seems reasonable.

Are you running this twice? #load "./../../../.paket/load/net472/UITests/uitests.group.fsx"

Or running it one time, and then pasting the contents of the fsx the second time?

lefthandedgoat avatar Feb 05 '19 15:02 lefthandedgoat

I run the complete script once, then the lines including and following suites <- [ new suite() ]. This will run one test but will report the result from the previous tests. If I run the complete script, the result is the same, however. So, the previous tests are still cached bij the fsi.

P.s. Besides this, it works like a charm! Great!!!

halcwb avatar Feb 06 '19 09:02 halcwb

P.P.S. Beware of this problem. I.e. incorrect order of reference with first the canop reference and then the selenium webdriver reference instead of vica versa. You need to correct this manually in the group.fsx script generated by Paket.

halcwb avatar Feb 06 '19 14:02 halcwb