Skip to content

Instantly share code, notes, and snippets.

View lefthandedgoat's full-sized avatar

Chris Holt lefthandedgoat

View GitHub Profile
Sign up for a GitHub Account Sign in
Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository.
language: F# ACE Editor indent mode: Spaces indent size: 2
230
231
232
233
// Learn more about F# at http://fsharp.net
open System
let mutable tests = []
let test f = tests <- List.append tests [f]
let xtest f = ()
let mutable before = fun () -> ()
let run _ = List.map (fun f -> (before ()
f ())) tests
let describe description = Console.WriteLine(description.ToString())
open canopy
open runner
start chrome
"#lastName should have Doe" &&& (fun _ ->
url "http://lefthandedgoat.github.io/canopy/testpages/"
let jsResult = js "return $('#testfield1');"
let jsResult2 = js "return document.getElementById('testfield1');"
let i = 0
@lefthandedgoat
lefthandedgoat / gist:6381478
Created August 29, 2013 18:13
overriding canopy assertion
module canopyExtensions
open canopy
//this one lets the exception bubble up on failure
let count cssSelector count =
canopy.core.count cssSelector count
true
//or
@lefthandedgoat
lefthandedgoat / gist:6384097
Created August 29, 2013 22:18
shared data between before and lastly
//safe to run this code, it works
open canopy
open runner
type Person() = class
member val FirstName : string = null with get, set
member val LastName : string = null with get, set
end
@lefthandedgoat
lefthandedgoat / gist:6554142
Created September 13, 2013 18:14
override on
let on (u: string) =
try
wait pageTimeout (fun _ -> browser.Url = u)
with
| ex -> raise (CanopyOnException(sprintf "on check failed, expected %s got %s" u browser.Url));
let skipTo stepName client =
let wizardSteps = [
(20, 1, "Company Info");
(48, 1, "Login");
(49, 1, "Password Rules");
... lots more
(66, 13, "Publish Rules");]
if not (wizardSteps |> List.exists(fun (id, groupid, name) -> name = stepName)) then failwith (sprintf "Step %s does not exist" stepName)
@lefthandedgoat
lefthandedgoat / gist:8140847
Created December 27, 2013 00:41
gemini speed test
using System;
using System.Collections.Generic;
using System.Linq;
using Massive;
using Oak;
namespace ConsoleApplication1
{
public class DynamicPerson : DynamicModel
{
@lefthandedgoat
lefthandedgoat / gist:9126142
Last active September 4, 2019 13:20
How to embed images for failed tests in Team City (using canopy)
//first read about how to do something similar here:
http://atombrenner.blogspot.com/2012/09/embed-url-links-in-teamcity-build-logs.html
//plugin location
http://confluence.jetbrains.com/display/TW/StaticUIExtensions
//download at:
http://teamcity.jetbrains.com/repository/download/TeamCityPluginsByJetBrains_StaticUiExtensionsAgainstTeamCity8/latest.lastSuccessful/static-ui-extensions.zip
//after downloading you can go to you team city administrator, go to plugins, and upload the one you just downloaded
//restart TC web server so that it registers the plugin, once you go back you should have 1 more
@lefthandedgoat
lefthandedgoat / gist:9138759
Created February 21, 2014 17:20
A way to get selenium tests to run at higher res
Running selenium tests via Team City as a windows service has a resolution of 1024x768. I tryed adding/changing DefaultSettings.XResolution and YResolution in the registry with no luck. What did work was running TC agent in the console as a logged in user.
Use these instructions to setup a user to automatically log in when your box starts up
http://www.win2008workstation.com/configure-auto-logon/
Add shortcut to the startup forlder on start menu:
C:\Users\YOUUSER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
that points to your team city agent's start.bat with 'start' parameter