Created
June 25, 2019 14:58
-
-
Save tamer1an/e37b9bded0ab4dc115f33107cc078bed 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
require(['gremlins'], function(gremlins) { | |
function positionSelector() { | |
const $list = $('.app'); | |
const offset = $list.offset(); | |
return [ | |
parseInt(Math.random() * $list.outerWidth() + offset.left), | |
parseInt(Math.random() * ($list.outerHeight() + $list.outerHeight()) + offset.top) | |
]; | |
} | |
let horde = gremlins.createHorde() | |
.gremlin(gremlins.species.clicker() | |
.positionSelector(positionSelector) | |
) | |
// .gremlin(gremlins.species.formFiller()) | |
.gremlin(function gridSorting() { | |
const $grid = $('.ag-header-cell-text'); | |
const items = $grid.length; | |
$($grid[Math.floor(Math.random()*items)]).trigger('click'); | |
}) | |
.gremlin(gremlins.species.toucher()) | |
.gremlin(gremlins.species.scroller()) | |
.mogwai(gremlins.mogwais.gizmo()) | |
.mogwai(gremlins.mogwais.fps()) | |
// .strategy(gremlins.strategies.distribution() | |
// .delay(500) | |
// .distribution([ | |
// 0.3, // clicker | |
// 0.3, // formFiller | |
// 0.3, // todoCreator | |
// 0.1, // scroller | |
// ]) | |
// ) | |
.before(function() { | |
console.profile('gremlins'); | |
}) | |
.after(function() { | |
console.profileEnd(); | |
}) | |
.unleash({ nb: 10000 }); | |
}); | |
/=====================================/ | |
require.config({ | |
paths: { | |
gremlins: 'gm.js', | |
}, | |
}); | |
require(['gremlins'], function(gremlins) { | |
gremlins.createHorde() | |
.before(function(done) { | |
var horde = this; | |
setTimeout(function(){ | |
horde.log('async'); | |
done(); | |
}, 500); | |
}) | |
.before(function() { | |
this.log('sync'); | |
}) | |
.gremlin(gremlins.species.formFiller()) | |
.gremlin(gremlins.species.clicker().clickTypes(['click'])) | |
.gremlin(gremlins.species.toucher()) | |
.gremlin(gremlins.species.scroller()) | |
.gremlin(function() { | |
alert('here'); | |
}) | |
.after(function() { | |
this.log('finished!'); | |
}) | |
.mogwai(gremlins.mogwais.alert()) | |
.mogwai(gremlins.mogwais.fps()) | |
.mogwai(gremlins.mogwais.gizmo().maxErrors(2)) | |
.unleash(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment