11//Imports
22require ( 'cypress-plugin-tab' ) ;
3- var fs = require ( 'fs' ) ;
43var faker = require ( 'faker' ) ;
54
65const url = Cypress . config ( 'baseUrl' ) || "https://uniandes.edu.co/" ;
76const appName = Cypress . env ( 'appName' ) || "your app" ;
87const events = Cypress . env ( 'events' ) || 100 ;
98const delay = Cypress . env ( 'delay' ) || 100 ;
9+ const seed = Cypress . env ( 'seed' ) || 12 ;
1010
1111const pct_clicks = Cypress . env ( 'pctClicks' ) || 12 ;
1212const pct_scrolls = Cypress . env ( 'pctScroll' ) || 12 ;
@@ -17,12 +17,29 @@ const pct_pgnav = Cypress.env('pctPgNav') || 12;
1717const pct_browserChaos = Cypress . env ( 'pctBwChaos' ) || 12 ;
1818const pct_actions = Cypress . env ( 'pctActions' ) || 16 ;
1919
20+ /*
21+ Bob Jenkins Small Fast, aka smallprng pseudo random number generator is the chosen selection for introducing seeding in the tester
22+ Credits of the implementation to bryc's answer in this stackoverflow post: https://stackoverflow.com/a/47593316
23+ */
24+ function jsf32 ( a , b , c , d ) {
25+ return function ( ) {
26+ a |= 0 ; b |= 0 ; c |= 0 ; d |= 0 ;
27+ var t = a - ( b << 27 | b >>> 5 ) | 0 ;
28+ a = b ^ ( c << 17 | c >>> 15 ) ;
29+ b = c + d | 0 ;
30+ c = d + t | 0 ;
31+ d = a + t | 0 ;
32+ return ( d >>> 0 ) / 4294967296 ;
33+ }
34+ }
35+
36+ var random = jsf32 ( 0xF1AE533D , seed , seed , seed ) ;
2037
2138function getRandomInt ( min , max ) {
2239 min = Math . ceil ( min ) ;
2340 max = Math . floor ( max ) ;
24- return Math . floor ( Math . random ( ) * ( max - min ) ) + min ;
25- } ;
41+ return Math . floor ( random ( ) * ( max - min ) ) + min ;
42+ }
2643
2744function fullPath ( el ) {
2845 var names = [ ] ;
@@ -438,7 +455,7 @@ const functions = [
438455 [ spkeypress , enter ] ,
439456 [ reload , navBack , navForward ] ,
440457 [ changeViewport , clearCookies , clearLocalStorage ] ,
441- [ fillInput , clearInput , clickRandAnchor , clickRandButton ]
458+ [ clickRandAnchor , clickRandButton ]
442459] ;
443460
444461describe ( `${ appName } under smarter monkeys` , function ( ) {
@@ -458,7 +475,7 @@ describe( `${appName} under smarter monkeys`, function() {
458475 cy . wait ( 1000 ) ;
459476 //Add an event for each type of event in order to enter the else statement of randomEvent method
460477 for ( let i = 0 ; i < events + 7 ; i ++ ) {
461- fillInput ( ) ;
478+ randomEvent ( ) ;
462479 }
463480 }
464481 } )
0 commit comments