Skip to content

Instantly share code, notes, and snippets.

@caindy
Created September 8, 2014 13:12
Show Gist options
  • Save caindy/43c68e75d45d26e81c1f to your computer and use it in GitHub Desktop.
Save caindy/43c68e75d45d26e81c1f to your computer and use it in GitHub Desktop.
bash script to bootstrap canopy on OSX
#! /bin/bash
if hash brew 2>/dev/null; then
echo "Found Homebrew"
else
echo >&2 "Please install Homebrew"
exit 1
fi
if hash fsharpi 2>/dev/null; then
echo "Found F#"
else
echo "Installing F#..."
brew update
brew install fsharp
fi
export MONO_GAC_PREFIX="/usr/local"
if [ -e nuget.exe ]; then
echo "Found NuGet package manager"
else
echo "Downloading nuget package manager"
curl -L http://nuget.org/nuget.exe > nuget.exe
fi
mono nuget.exe install canopy -OutputDirectory packages -ExcludeVersion
if [ ! -e chromedriver.exe ]; then
curl http://chromedriver.storage.googleapis.com/2.10/chromedriver_mac32.zip -o chromedriver.zip
unzip chromedriver.zip
mv chromedriver chromedriver.exe
fi
if [ ! -e example.fsx ]; then
find packages -iname lib | xargs -I lib echo '#I "'lib'";;' > example.fsx
find packages -iname net40 | xargs -I lib echo '#I "'lib'";;' >> example.fsx
echo '
#r "canopy.dll";;
open canopy
open runner
open System
configuration.chromeDir <- "."
start chrome
//this is how you define a test
"taking canopy for a spin" &&& fun _ ->
//go to a url
url "http://lefthandedgoat.github.io/canopy/testpages/"
//assert that the element with an id of 'welcome' has
//the text 'Welcome'
"#welcome" == "Welcome"
//assert that the element with an id of 'firstName' has the value 'John'
"#firstName" == "John"
//change the value of element with
//an id of 'firstName' to 'Something Else'
"#firstName" << "Something Else"
//verify another element value, click a button
//verify the element is updated
"#button_clicked" == "button not clicked"
click "#button"
"#button_clicked" == "button clicked"
//run all tests
run()
printfn "press [enter] to exit"
System.Console.ReadLine() |> ignore' >> example.fsx
fi
fsharpi example.fsx
@caindy
Copy link
Author

caindy commented Sep 8, 2014

Unfortunately bugs in mono prevented me from continuing, but I didn't want the effort to be completely wasted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment