Commit Graph

3 Commits

Author SHA1 Message Date
Jesse Gibson
c5e8625acc Full configuration, automatic browser tab manipulation, statistics, progress events, completion event, de-duplication of acknowledgments, accurate recursive test runners, prep for selenium instantiation, included polyfills and extensions.
New barrage of options now accepted (providing defaults in absence), such as a progress callback, a done callback and timeout configuration, a data generation function, etc...

Browser constructor meant to open new tabs, run the test (using the given options), and close the tab when finished. There is no loss of options by doing this (although it has had a notable effect on performance when the tab is not in focus).

Each progress event and the done event recieve the options object with statistics embeded in the "stats" property. It has details like the average latency, the total elapsed time, the acknowledged packets, the fastest/slowest times, etc...

Acknowledgments can fire more than once, and for now it dedupes those and only fires once. In the future I may change this to include every acknowledgment. For data!

The recursive test runner wasn't running the correct number of times (due to confusion and off-by-1 errors)... that has been fixed.

The test file checks to see if there were options globally declared. If so, run the test using those. In the future we may use selenium to boot up the browsers, and we'll need some way to kick off the test and provide options. That was a nice compromise.

I've included some useful polyfills (like interfacing with console.log so it can be passed naked to other functions, Object.keys polyfill for counting confirmed objects) and some extensions (like valMapDone).

Next steps include adding the gun instance to the options object, statistics for errors, node compatibility and the such.
2015-12-22 13:36:50 -07:00
Jesse Gibson
a601ec9da9 Implemented interval option, better defaults and a bug fix.
Interval option built with a recursive setTimeout (not setInterval) that tracks it's invoked number.

Patch function now determines it's own ID if it isn't provided, meaning that the opts-must-be-object requirement isn't needed. In other words, all options are optional (wow).

Bug fix: minor thing where I was using gun before it was defined. This was due to minor tweaking just before a commit and not having unit tests to shout at me :(
2015-12-17 23:50:59 -07:00
Jesse Gibson
d38154cb6f Test gun by passing options, Browser constructor automatically begins a test on a new window, added package.json, patch function for options (validation/default values).
Exposed a function named "test" that takes an options object, with things like how many gun requests to fire in total, what data to send, where to put it, what peers to connect to, etc...

Exposed a Browser constructor that opens up a new window and runs the test function with the options provided, returning an interface to the window.

Added a patch function to validate the option input and provide defaults where there aren't any values.
2015-12-17 23:20:57 -07:00