Skip to content

Instantly share code, notes, and snippets.

View jubishop's full-sized avatar
🎼
Making a podcast app.

Justin Bishop jubishop

🎼
Making a podcast app.
View GitHub Profile
Automate Functional Tests of Your Connect Implementation
Here on the Facebook Platform Engineering team we strive to keep Connect fast and stable and to help our developers ensure their implementations are working, bug free.
A while back we began working on a suite of Automated tests for some of our top partners that would confirm Connect was always functioning. Then we decided it'd be great if we could create a library that would help any connect developer easily create automated tests of their own site.
We've written a library on top of Watir (http://wtr.rubyforge.org/), that helps you deal with all the generic issues needed to stress test a Connect site's implementation. In this post we'll be demonstrating how to use our new library to create automated tests for StreamDiff (http://www.streamdiff.com/) a cool Connect site built by a coworker of mine: Naitik Shah.
First, we'll need to install Watir, which is described here: http://wtr.rubyforge.org/install.html . Be sure to get the plugin for Firef
module SlowWatir
IndestructibleMethods = ['__id__', '__send__']
SleepTime = 0.5
def self.await(tries = 20)
begin
result = yield
if not result or (result.respond_to? :exists? and not result.exists?)
raise Exception.new
end
http://www.facebook.com/login.php?api_key=API_KEY_HERE&next=http://www.facebook.com/connect/login_success.html&return_session=true&req_perms=offline_access,publish_stream,read_stream,email,create_event,rsvp_event,sms,status_update,photo_upload,video_upload,create_note,share_item
http://www.jubishop.devrs006.facebook.com/login.php?api_key=API_KEY_HERE&next=http://www.jubishop.devrs006.facebook.com/connect/login_success.html&return_session=true&req_perms=offline_access,publish_stream,read_stream,email,create_event,rsvp_event,sms,status_update,photo_upload,video_upload,create_note,share_item
http://www.jubishop.devrs006.facebook.com/login.php?api_key=API_KEY_HERE&next=http://www.jubishop.devrs006.facebook.com/connect/login_success.html&return_session=true&req_perms=offline_access,publish_stream,read_stream,email,create_event,rsvp_event,sms,status_update,photo_upload,video_upload,create_note,share_item
require 'rubygems'
require 'digest/md5'
require 'json'
require 'net/http'
class Facebook
public
# This is it.
def self.callMethod(methodName, args={})
tell application "iTunes"
copy (convert current track) to newTrack
set newLocation to (location of track 1 of current playlist)
tell application "Finder"
copy (move newLocation to the desktop with replacing) to newFile
end tell
delete (track 1 of current playlist)
do shell script "uptmp " & quote & (POSIX path of newLocation) & quote
end tell
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
applicationComplete="applicationComplete(event)" >
<mx:Script><![CDATA[
import mx.events.FlexEvent;
import mx.controls.Image;
import flash.events.Event;
private var imgURL:String = "http://xerto.free.fr/toad1.jpg";
// Depot, put and get.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
applicationComplete="applicationComplete(event)" >
<mx:Script><![CDATA[
import mx.events.FlexEvent;
import mx.controls.Image;
import flash.events.Event;
private var imgURL:String = "http://xerto.free.fr/toad1.jpg";
private function applicationComplete(event:FlexEvent):void {
require 'net/http'
require 'uri'
require 'digest/md5'
api_key = 'api_key_here'
session_key = 'session_key_here'
session_secret = 'session_secret_here
last_update = 0
prev_items = nil