Skip to content

Instantly share code, notes, and snippets.

@bootstraponline
Created February 27, 2013 23:09
Show Gist options
  • Save bootstraponline/5052702 to your computer and use it in GitHub Desktop.
Save bootstraponline/5052702 to your computer and use it in GitHub Desktop.
Export devices that pass 100% from AppThwack.
// device name : result
var pairs = $x('//*[@id="by_device"]/div/div/div');
for (var a = 0, len = pairs.length / 2; a < len; a+=2) {
if (all_passed(pairs[a+1])) {
console.log(device_name(pairs[a]));
}
}
// device name. pairs[0]
function device_name( pair_index ) {
var name = pair_index.children[0].children[0].innerText;
var spec = pair_index.children[1].children[0].innerText;
return name + " (" + spec + ")";
}
// result. pairs[1]
function all_passed( pair_index ) {
var result = pair_index.children[1].children[1].children[1].innerText;
return result.indexOf('10 out of 10 scenarios passed') !== -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment