Last active
October 20, 2016 11:53
-
-
Save ToJans/6c8fba980c249084c136d2536c7a1eb8 to your computer and use it in GitHub Desktop.
canopy and fsharp to test the happy path for Virtual Sales Lab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tests | |
open canopy | |
open Utils | |
open System | |
let veranda (rootPath) = (rootPath + ": Veranda") &&& fun () -> | |
let clickNext expected fn = | |
click ".verandawizard.selected input[type=submit]" | |
".verandawizard.selected h1" == expected | |
fn() | |
let uniqueId = Guid.NewGuid().ToString("N") | |
rootPath + "/r/vsl/nl/veranda/" |> url | |
clickNext "Stap 2: Hoe ziet uw huis er uit?" <| fun () -> | |
"#MiddleOut" << "4" | |
"#HeightOut" << "2" | |
check "#leftwallbox" | |
"#Left" == "1" | |
uncheck "#leftwallbox" | |
notDisplayed "#leftwall" | |
check "#rightwallbox" | |
displayed "#rightwall" | |
"#RightOut" << "2" | |
clickNext "Stap 3: Stijl" <| fun () -> | |
nth 1 ".verandawizard.selected input[type=radio]" |> check | |
click "input[value=9010][data-for=ralcolor]" | |
"#ral-info" == "9010 - Pure white" | |
"#ralcolor" == "9010" | |
clickNext "Stap 4: Binnenafmetingen" <| fun () -> | |
"#widthOut" << "5" | |
"#depthOut" << "4" | |
"#heightOut" << "3" | |
click ".middleClicked" | |
"#offset" == "0" | |
clickNext "Stap 5: Oversteek van het dak" <| fun () -> | |
"#frontOut" << "1" | |
"#leftOut" << "2" | |
"#rightOut" << "3" | |
clickNext "Stap 6: Dakkoepel" <| fun () -> | |
click "input[name=type][value=5]" | |
"#depthpctOut" << "50" | |
clickNext "Stap 7: ramen" <| fun () -> | |
click "#windowsHaveT" | |
"#front" << "Vast raam zonder steunbalken" | |
clickNext "Proficiat!" <| fun () -> | |
"#name" << "name " + uniqueId | |
"#street" << "street" | |
"#number" << "nr" | |
"#zip" << "zip" | |
"#city" << "city" | |
"#phonenumber" << "phonenumber" | |
"#email" << testEmail | |
click "#PleaseVisitMe" | |
"textarea" << "remarks" | |
clickNext "Proficiat!" <| fun () -> | |
"h1" == "Deel het via social media" | |
sleep 2 | |
checkEmailReceived uniqueId |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Utils | |
open Pop3 | |
open System | |
type AppConfig = FSharp.Configuration.AppSettings<"app.config"> | |
let testEmail = AppConfig.TestEmail | |
let checkEmailReceived(uniqueId) = | |
let client = new Pop3Client(); | |
client.Connect( | |
AppConfig.TestEmailPop3Server, | |
AppConfig.TestEmail, | |
AppConfig.TestEmailPassword, | |
AppConfig.TestEmailPort, | |
AppConfig.TestEmailUseSsl) | |
let mails = client.ListAndRetrieve(); | |
let targetMails = mails |> Seq.filter(fun x -> x.Body.Contains(uniqueId)) | |
let hasTargetMails = Seq.length targetMails > 0 | |
targetMails |> Seq.iter client.Delete | |
client.Disconnect() | |
if hasTargetMails | |
then "Email verification ok" | |
|> Console.WriteLine | |
else "Unable to find email containing " + uniqueId | |
|> InvalidOperationException | |
|> raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment