Created
September 6, 2014 14:56
-
-
Save hamiltont/7b149024a1a31ee30fa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var fs = require("fs"); | |
var som = fs.readFileSync("./api.js", "utf-8"); | |
var jsdom = require("jsdom"); | |
function onError(error) { | |
console.log("ERROR: " + error.code + ": "+ error.message); | |
} | |
function onComplete(testResult) { | |
console.log('complete'); | |
console.log(testResult); | |
} | |
jsdom.env({ | |
html: '<html><body>test</body></html>', | |
src: [som], | |
done: function (errors, window) { | |
console.log("loaded"); | |
window.console = console; | |
window.location.host = "hamiltont.me"; | |
window.location.hostname = "hamiltont.me"; | |
console.log("Triggering load finished"); | |
console.log("Trying method two..."); | |
var evt = window.document.createEvent ("MessageEvent"); | |
evt["data"] = ""; | |
evt["origin"] = "http://speedof.me"; | |
evt["source"] = window; | |
window.receiveMessage(evt); | |
var SomApi = window.SomApi; | |
var s3H = window.s3H; | |
SomApi.account = "--removed--"; //your API Key here | |
SomApi.domainName = "hamiltont.me"; //your domain or sub-domain here | |
SomApi.config.sustainTime = 4; | |
SomApi.onTestCompleted = onComplete; | |
SomApi.onError = onError; | |
SomApi.config.progress.enabled = false; | |
console.log("Working with..."); | |
console.log(SomApi); | |
SomApi.startTest(); | |
console.log('Done?'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment