diff --git a/src/species/clicker.js b/src/species/clicker.js index bfafa4a..def85c6 100644 --- a/src/species/clicker.js +++ b/src/species/clicker.js @@ -7,7 +7,7 @@ * * By default, the clicker gremlin activity is showed by a red circle. * - * var clickerGremlin = gremlins.gremlins.clicker(); + * var clickerGremlin = gremlins.species.clicker(); * horde.gremlin(clickerGremlin); * * The clicker gremlin can be customized as follows: @@ -22,7 +22,7 @@ * * Example usage: * - * horde.gremlin(gremlins.gremlins.clicker() + * horde.gremlin(gremlins.species.clicker() * .clickTypes(['click']) * .positionSelector(function() { * // only click inside the foo element area diff --git a/src/species/formFiller.js b/src/species/formFiller.js index 090762d..64d53e0 100644 --- a/src/species/formFiller.js +++ b/src/species/formFiller.js @@ -1,3 +1,24 @@ +/** + * The formFiller gremlin fills forms by entering data, selecting options, clicking checkboxes, etc + * + * As much as possible, the form filling is done using mouse and keyboard + * events, to trigger any listener bound to it. + * + * By default, the formFiller gremlin activity is showed by changing the + * element border to solid red. + * + * var formFillerGremlin = gremlins.species.formFiller(); + * horde.gremlin(formFillerGremlin); + * + * The formFiller gremlin can be customized as follows: + * + * formFillerGremlin.elementMapTypes({'select': function selectFiller(element) {} }); // form element filler functions + * formFillerGremlin.showAction(function(element) { // show the gremlin activity on screen }); + * formFillerGremlin.canFillElement(function(element) { return true }); // to limit where the gremlin can fill + * formFillerGremlin.maxNbTries(5); // How many times the gremlin must look for a fillable element before quitting + * formFillerGremlin.logger(loggerObject); // inject a logger + * formFillerGremlin.randomizer(randomizerObject); // inject a randomizer + */ define(function(require) { "use strict"; diff --git a/src/species/scroller.js b/src/species/scroller.js index e36be1c..4225cbd 100644 --- a/src/species/scroller.js +++ b/src/species/scroller.js @@ -1,3 +1,30 @@ +/** + * The scroller gremlin scrolls the viewport to reveal another part of the document + * + * var scrollerGremlin = gremlins.species.scroller(); + * horde.gremlin(scrollerGremlin); + * + * The scrollerGremlin gremlin can be customized as follows: + * + * scrollerGremlin.positionSelector(function() { // return a random position to scroll to }); + * scrollerGremlin.showAction(function(element) { // show the gremlin activity on screen }); + * scrollerGremlin.logger(loggerObject); // inject a logger + * scrollerGremlin.randomizer(randomizerObject); // inject a randomizer + * + * Example usage: + * + * horde.gremlin(gremlins.species.clicker() + * .positionSelector(function() { + * // only click in the app + * var $list = $('#todoapp'); + * var offset = $list.offset(); + * return [ + * parseInt(Math.random() * $list.outerWidth() + offset.left), + * parseInt(Math.random() * ($list.outerHeight() + $('#info').outerHeight()) + offset.top) + * ]; + * }) + * ) + */ define(function(require) { "use strict"; diff --git a/src/species/typer.js b/src/species/typer.js index aeacc05..23fd912 100644 --- a/src/species/typer.js +++ b/src/species/typer.js @@ -1,3 +1,23 @@ +/** + * The typer gremlin types keys on the keyboard + * + * Note that keyboard events must be localized somewhere on screen, so this + * gremlins picks a random screen location first. + * + * By default, the typer gremlin activity is showed by a letter surrounded by + * a red circle. + * + * var typerGremlin = gremlins.species.typer(); + * horde.gremlin(typerGremlin); + * + * The typerGremlin gremlin can be customized as follows: + * + * typerGremlin.eventTypes(['keypress', 'keyup', 'keydown']); // types of events to trigger + * typerGremlin.showAction(function(element) { // show the gremlin activity on screen }); + * typerGremlin.logger(loggerObject); // inject a logger + * typerGremlin.randomizer(randomizerObject); // inject a randomizer + * + */ define(function(require) { "use strict";