Skip to content

Instantly share code, notes, and snippets.

David Lai dlai0001

Block or report user

Report or block dlai0001

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Mac SDET machine setup
#!/bin/bash
############################################################
##### Easy setup script for Mac OSX Yosemite or Higher #####
##### Sets up apps and tools useful to SDETs on Mac. #####
##### #####
##### Note: you may be prompted to enter your password #####
##### At certain times during the install #####
############################################################
@dlai0001
dlai0001 / monitorlocust.js
Created Jul 1, 2016
Monitor peak requests per second and average rps in locust.io
View monitorlocust.js
ax_peak = 0;
ax_avg = 0;
ax_count = 0;
setInterval(function() {
rps = parseFloat($("#total_rps").text())
ax_avg = (ax_avg * ax_count + rps) / (++ax_count);
if(rps > ax_peak) {
ax_peak = rps;
@dlai0001
dlai0001 / GridHubInstall.ps1
Last active Mar 22, 2016
Boxstarter formula for settings up Selenium Grid
View GridHubInstall.ps1
##############################################################################################
# Powershell script for installing Selenium Grid Extras in Hub Mode
# Navigate with internet explorer to:
# http://boxstarter.org/package/nr/url? + raw gist url
#
##############################################################################################
# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
@dlai0001
dlai0001 / Tester Setup
Last active Aug 29, 2015
selenium server
View Tester Setup
cinst GoogleChrome
cinst Firefox
cinst SeleniumServer
cinst SeleniumChromeDriver2
cinst SeleniumIEDriver
cinst fiddler4
cinst phantomjs
View gist:7494459
'''
Created on Nov 15, 2013
@author: "David Lai"
'''
import shlex, subprocess
if __name__ == '__main__':
View app.js
# Product model
App.Product = DS.Model.extend(
descripton: DS.attr('string')
expirationDate: DS.attr('date')
imageUrl: DS.attr('string')
location: DS.attr('string')
quantity: DS.attr('number')
quantityUnit: DS.attr('string')
type: DS.attr('string')
profile: DS.belongsTo('profile')
View gist:6167561
YAHOO.util.Connect.asyncRequest("GET",
"/services/library/json/?action=getLibraryFiles&status=P",
{ success: function(o) {
var response = JSON.parse( o.responseText);
var fileList = response.list.filter( function(item) {
return item.batch == "N";
});
var fileEntry = fileList.filter( function(item) {
return item.fileName == "2013-08-06_11.50.39_testfile_vuPk.txt";
})[0];
@dlai0001
dlai0001 / show_clapper.py
Created Jul 18, 2013
Here's a fun script to overlay a clapper board on top of your web page in a selenium test. This is very helpful when you have video recordings of your test and want figure out which tests correspond to which minutes in the recording.
View show_clapper.py
def show_clapper(text, webdriver=None):
"""
Place a visibile line of logging text into the sauce logs.
@param driver: Selenium webdriver (should be a instance of Remote webdriver.
@param text: Text to log.
"""
print "Logging in remote webdriver: ", text
if webdriver is None:
View gist:6022486
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.Store = DS.Store.extend({
adapter: DS.FixtureAdapter.create()
});
@dlai0001
dlai0001 / gist:5880241
Created Jun 27, 2013
Keep pinging current URL in another browser thread to keep a browser alive when you do something more expensive.
View gist:5880241
class BrowserStandBy(object):
"""
This class allows you to put a browser on stand by sending no-op commands to keep
a selenium session from timing out.
"""
def __init__(self, webdriver, max_time=WTF_TIMEOUT_MANAGER.EPIC, sleep=5):
"""
@param webdriver:Webdriver instance to keep alive.
"""
You can’t perform that action at this time.