Skip to content

Instantly share code, notes, and snippets.

View lefthandedgoat's full-sized avatar

Chris Holt lefthandedgoat

View GitHub Profile
#r "../packages/Selenium.WebDriver.2.42.0/lib/net40/WebDriver.dll"
#r "../packages/Selenium.Support.2.42.0/lib/net40/WebDriver.Support.dll"
#r "../packages/Newtonsoft.Json.6.0.1/lib/net40/Newtonsoft.Json.dll"
#r "../packages/SizSelCsZzz.0.3.36.0/lib/SizSelCsZzz.dll"
#r "../packages/canopy.0.9.11/lib/canopy.dll"
open canopy
start firefox
@lefthandedgoat
lefthandedgoat / gist:ef20c7843e021a4f93c4
Last active August 29, 2015 14:02
ntlm auth workaround for selenium using mike rodger's package

This works and I hope thats its good enough. I couldn't figure out how to just type in the boxes.

https://github.com/lefthandedgoat/ntlmAuthMVC

MVC App setup as an intranet app, with anonymous turned off, and windows auth turned on. I am not sure how comperable that is to azure auth, sorry.

Slightly modifed version of this https://github.com/mike-rogers/NtlmProxy (setup to allow for giving username and password, and added try/catch/swallow

Change authorize attributes to be whatever test account you setup locally https://github.com/lefthandedgoat/ntlmAuthMVC/blob/master/MvcApplication/Controllers/HomeController.cs#L7

open System.Net
open Microsoft.FSharp.Control.WebExtensions
open System.Diagnostics
open System
let fetch name (url:string) =
printfn "fetching %s" name
let uri = new System.Uri(url)
use webClient = new WebClient()
let stopwatch = Stopwatch()
@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
@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: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
{
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: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));
@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: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