Skip to content

Instantly share code, notes, and snippets.

@kmcintyre
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmcintyre/43531e5c6bfe04a8391c to your computer and use it in GitHub Desktop.
Save kmcintyre/43531e5c6bfe04a8391c to your computer and use it in GitHub Desktop.
Ask for document or window access post response.
var canada_bcs = [
"CAE-B1N", "CAE-B2N", "CAE-B3N", "CAE-B4N", "CAE-B5N", "CAE-B6N", "CAE-B7N", "CAE-B8N", "CAE-B9N", "CAE-BAN", "CAE-BBN", "CAE-BCN", "CAE-BDN", "CAE-BEN", "CAE-BFN", "CAE-BGN", "CAE-BHN", "CAE-BIN", "CAE-BJN", "CAE-T1N", "CAE-T2N", "CAE-T3N", "CAE-T4N", "CAE-T5N", "CAE-T6N", "CAE-T7N", "CAE-T8N", "CAE-T9N", "CAE-TAN", "CAE-TBN", "CAE-TCN", "CAE-TDN", "CAE-TDN", "CAE-TEN", "CAL-T1N", "CAP-B1N", "CAP-B3N", "CAP-B4N", "CAP-B5N", "CAP-B6N", "CAP-B7N", "CAP-B8N", "CAP-B9N", "CAP-BAN", "CAP-BBN", "CAP-BCN", "CAP-BDN", "CAP-BEN", "CAP-BFN", "CAP-BGN", "CAP-BHN", "CAP-BHN", "CAP-T1N", "CAP-T2N", "CAP-T3N", "CAP-T4N", "CAP-T5N", "CAP-T6N", "CAP-T7N", "CAP-T8N", "CAP-T9N", "CAP-TAN", "CAP-TBN", "CAP-TCN", "CAP-TDN", "CAP-TEN", "CAP-TFN", "CAP-TGN", "CAP-THN", "CAP-TIN", "CAP-TJN", "CAS-B3N", "CAS-B4N", "CAS-B5N", "CAS-B6N", "CAS-B7N", "CAS-B8N", "CAS-B9N", "CAS-BAN", "CAS-BBN", "CAS-BCN", "CAS-FRE", "CAS-T1N", "CAS-T2N", "CAS-T3N", "CAS-T4N", "CAS-T5N", "CAS-T6N", "CAS-T7N", "CAS-T8N", "CAS-TAN", "CAS-TBN", "CAS-TCN", "OBI-LL4", "OBI-LL5", "OBI-LL6"
]
var bcs_response = []
var browserPerf = require('browser-perf');
var options = {
actions: [
// scroll first,
function() {
return function(browser) {
console.log(browser);
}
}()
],
}
function loop() {
var bcs_res = {}
bcs_res.bc = canada_bcs.shift()
if ( bcs_res.bc ) {
try {
bcs_res.url = 'https://quickbooks.intuit.ca/signup/buy?bc=' + bcs_res.bc + '&preview=true'
browserPerf(bcs_res.url, function (err, res) {
console.log(err);
bcs_res.loadTime = res[0].loadTime;
setTimeout(function () {
bcs_response.push(bcs_res)
loop();
console.log('response length:', bcs_response.length, 'remaining:', canada_bcs.length)
}, 500)
}, options)
} catch (err) {
console.log(err, 'response length:', bcs_response.length, 'remaining:', canada_bcs.length)
loop();
}
} else {
console.log(bcs_response)
}
}
loop()
@axemclion
Copy link

You cannot have access to window and document in the result. You would need to create a custom action to access these object.s

@kmcintyre
Copy link
Author

Quick follow up - I like the scroll action and wanted to chain a second action. See comment //scroll first wanted to get load metrics with scroll (it's as good a metric goal as any) then into my url check to verify product info loaded correctly.

@axemclion
Copy link

I think that would be better as 2 different tests. This way, one test will not interfere with the other. You simply need a scroll test, and a page load test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment