//these are similar to C# using statements open canopy open runner open System //start an instance of the firefox browser start firefox //this is how you define a test "taking canopy for a spin" &&& fun _ -> //this is an F# function body, it's whitespace enforced //go to url url "http://lefthandedgoat.imtqy.com/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's 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 quit()
"taking canopy for a spin" &&&& fun _ ->
highlight ".btn"
let path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\canopy\" let filename = DateTime.Now.ToString("MMM-d_HH-mm-ss-fff") screenshot path filename
onFail (fun _ -> let pathToReports = __SOURCE_DIRECTORY__ + @"\canopy\" let filename = System.DateTime.Now.ToString("MMM-d_HH-mm-ss-fff") screenshot pathToScreens filename |> ignore )
let liveHtmlReporter = reporter :?> LiveHtmlReporter liveHtmlReporter.reportPath <- Some pathToReports
//give the title a border js "document.querySelector('#title').style.border = 'thick solid #FFF467';"
Source: https://habr.com/ru/post/309240/
All Articles