How to use base64StringBuilder method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

interaction15.js

Source:interaction15.js Github

copy

Full Screen

1if (typeof Object.keys === 'undefined') {2 Object.keys = function (obj) {3 var keys = [], k;4 for (k in obj) {5 if (Object.prototype.hasOwnProperty.call(obj, k)) {6 keys.push(k);7 }8 }9 return keys;10 };11}12var runInteractionTracker = function(options) {13 var jQueryLocal;14 var jQueryLoadHandler = function() { jQueryLocal = window.jQuery.noConflict(true); }15 var scriptTag = document.createElement('script');16 scriptTag.setAttribute("type","text/javascript");17 scriptTag.setAttribute("src", location.protocol + "//c2.rfihub.net/static/js/jquery-latest.min.js");18 if (scriptTag.readyState) {19 scriptTag.onreadystatechange = function () { // For old versions of IE20 if (this.readyState == 'complete' || this.readyState == 'loaded') {21 jQueryLoadHandler();22 }23 };24 } else { // Other browsers25 scriptTag.onload = jQueryLoadHandler;26 }27 (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(scriptTag);28 var base64KeyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";29 var CHUNK_SIZE = 6;30 var loadTime = Date.now();31 var numBits = options && options.numBits ? options.numBits : 12;32 var timeToIgnoreAfterClick = options && options.timeToIgnoreAfterClick ? options.timeToIgnoreAfterClick : 1000;33 var maxEventRefires = options && options.maxEventRefires ? options.maxEventRefires : 5000 / 150;34 var maxNumCountsSent = options && options.maxNumCountsSent ? options.maxNumCountsSent : 10;35 var numValueBits = options && options.numValueBits ? options.numValueBits : 4;36 var valueFidelity = (1 << numValueBits);37 var showCanvas = options && options.showCanvas;38 var mouseMovePixel = options && options.mouseMovePixel ? options.mouseMovePixel : 'http://www.test.com/a.gif&t=move';39 var clickPixel = options && options.clickPixel ? options.clickPixel : 'http://www.test.com/a.gif&t=click';40 var viewabilityPixel = options && options.viewabilityPixel ? options.viewabilityPixel : 'http://www.test.com/a.gif&t=view';41 var sendIntervalMillis = options && options.sendIntervalMillis ? options.sendIntervalMillis : 1000;42 var checkViewabilityIntervalMillis = options && options.checkViewabilityIntervalMillis ? options.checkViewabilityIntervalMillis : 100;43 var maxSecondsSinceLoad = options && options.maxSecondsSinceLoad ? options.maxSencondsSinceLoad : 60 * 5; // five minutes44 var maxInitAttempts = options && options.maxInitAttempts ? options.maxInitAttempts : 100;45 var sampleNonViewableProb = options && options.sampleNonViewableProb ? options.sampleNonViewableProb : 1;46 var isSendingOutOfView = Math.random() < sampleNonViewableProb;47 var adInstanceId = options && options.adInstanceId ? options.adInstanceId : "rfi";48 var maxViewabilityResends = options && options.maxViewabilityResends ? options.maxViewabilityResends : 2;49 var initialTimeToResend = options && options.initialTimeToResend ? options.initialTimeToResend : 1000;50 var timeToResendFactor = options && options.timeToResendFactor ? options.timeToResendFactor : 3;51 var maxViewabilitySends = options && options.maxViewabilitySends ? options.maxViewabilitySends : 20;52 var initialTimeToMouseResend = options && options.initialTimeToMouseResend ? options.initialTimeToMouseResend : 1000;53 var timeToMouseResendFactor = options && options.timeToMouseResendFactor ? options.timeToMouseResendFactor : 1.25;54 var fracConsideredInView = options && options.fracConsideredInView ? options.fracConsideredInView : 0.5;55 var recordMouseMovement = options && typeof options.recordMouseMovement !== 'undefined' ? options.recordMouseMovement : true;56 var fidelityAttempts;57 var numBitsX;58 var numBitsY;59 var adWidth;60 var adHeight;61 var rfiTagSpan;62 var jQueryLocal;63 var jQRfiTagSpan;64 var spanOffSet;65 var canvas;66 var findSpan = function() {67 var spans = window.document.getElementsByTagName("span");68 for (var key in spans) {69 if (spans[key] && spans[key].id && spans[key].id.indexOf(adInstanceId) >= 0) {70 return spans[key];71 }72 }73 }74 var tryToCreateCanvas = function(width, height, parentElement) {75 if (showCanvas) {76 canvas = document.createElement('canvas');77 canvas.width = width;78 canvas.height = height;79 canvas.style.zIndex = 100;80 canvas.style.position = "absolute";81 canvas.style.left = "0px";82 canvas.style.top = "0px";83 if(typeof G_vmlCanvasManager != 'undefined' ) {84 canvas = G_vmlCanvasManager.initElement(canvas);85 }86 if (canvas.getContext) {87 parentElement.appendChild(canvas);88 } else {89 showCanvas = false;90 }91 }92 }93 var attemptToSetFidelities = function() {94 rfiTagSpan = findSpan();95 if (typeof rfiTagSpan !== 'undefined'96 && typeof jQueryLocal !== 'undefined') {97 jQRfiTagSpan = jQueryLocal(rfiTagSpan);98 if (jQRfiTagSpan.offset()['left'] >= 0) {99 adWidth = jQRfiTagSpan.width();100 adHeight = jQRfiTagSpan.height();101 tryToCreateCanvas(adWidth, adHeight, rfiTagSpan);102 if (recordMouseMovement) {103 jQRfiTagSpan.mousemove(count);104 jQRfiTagSpan.mouseout(clearTimeout);105 jQRfiTagSpan.mouseup(recordClick);106 }107 var widthFactor = Math.log(adWidth);108 var heightFactor = Math.log(adHeight);109 numBitsX = Math.round(numBits * widthFactor / (widthFactor + heightFactor));110 numBitsY = numBits - numBitsX;111 spanOffset = jQRfiTagSpan.offset();112 window.clearInterval(fidelityInterval);113 }114 } else if (fidelityAttempts && fidelityAttempts > maxInitAttempts) {115 window.clearInterval(fidelityInterval);116 }117 if (typeof fidelityAttempts !== 'undefined') {118 fidelityAttempts++;119 } else {120 fidelityAttempts = 1;121 }122 };123 var fidelityInterval = window.setInterval(attemptToSetFidelities, 100);124 var totalWeight = 0;125 var maxWeight = 0;126 var counts = {};127 var refireTimeout;128 var lastEventX;129 var lastEventY;130 var numFiresOfLastEvent = 0;131 var count = function(e) {132 if (refireTimeout) {133 window.clearTimeout(refireTimeout);134 }135 if (!numBitsX || !numBitsY || !spanOffset) {136 return;137 }138 var elementX = e.pageX - spanOffset.left;139 var elementY = e.pageY - spanOffset.top;140 if (elementX == lastEventX && elementY == lastEventY) {141 numFiresOfLastEvent++;142 } else {143 numFiresOfLastEvent = 0;144 }145 lastEventX = elementX;146 lastEventY = elementY;147 var secondsSinceLoad = Math.round((Date.now() - loadTime) / 1000);148 if (numFiresOfLastEvent > maxEventRefires149 || numMouseEventsSent > maxNumCountsSent150 || (lastClickTime && Date.now() - lastClickTime < timeToIgnoreAfterClick)151 || secondsSinceLoad > maxSecondsSinceLoad) {152 return;153 }154 var xFidelity = (1 << numBitsX);155 var yFidelity = (1 << numBitsY);156 var xFrac = Math.max(0, (elementX - 1) / adWidth);157 var yFrac = Math.max(0, (elementY - 1) / adHeight);158 var key = Math.floor(xFrac * xFidelity) + "_" + Math.floor(yFrac * yFidelity);159 if (counts[key]) {160 counts[key] = Math.min(maxEventRefires, counts[key] + 1);161 } else {162 counts[key] = 1;163 }164 totalWeight++;165 maxWeight = Math.max(maxWeight, counts[key]);166 refireTimeout = window.setTimeout(function() { count(e); }, 150);167 };168 var generatePaddedBitString = function(bitString, numBits) {169 var curBitStringRep = bitString.toString(2);170 while (curBitStringRep.length < numBits) {171 curBitStringRep = "0" + curBitStringRep;172 }173 return curBitStringRep;174 };175 var numMouseEventsSent = 0;176 var lastSentTotalWeight = 0;177 var lastSendTime = 0;178 var lastMouseSendTime = 0;179 var timeTillNextResend = initialTimeToResend;180 var timeTillNextMouseResend = initialTimeToMouseResend;181 var numViewabilityResends = 0;182 var numViewabilitySends = 0;183 var haveSentOutOfView = false;184 var checkAndSendCounts = function() {185 var secondsSinceLoad = Math.round((Date.now() - loadTime) / 1000);186 if (totalWeight != 0 && Date.now() - lastMouseSendTime > timeTillNextMouseResend) {187 var bitStrings = new Array();188 var curIndexOfBitString = 0;189 for (var key in counts) {190 var compressedVal = Math.round((counts[key] / maxWeight) * (valueFidelity - 1));191 var keySplit = key.split("_");192 bitStrings.push(generatePaddedBitString(parseInt(keySplit[0]), numBitsX));193 bitStrings.push(generatePaddedBitString(parseInt(keySplit[1]), numBitsY));194 bitStrings.push(generatePaddedBitString(compressedVal, numValueBits));195 }196 var curBitString = bitStrings.join('');197 var encodedString = encode(secondsSinceLoad, totalWeight, maxWeight, numBitsX, numBitsY, numValueBits, curBitString);198 var decodedMap = decode(encodedString);199 if (showCanvas) {200 renderHeatMap(canvas, decodedMap);201 }202 firePixel(mouseMovePixel, encodedString);203 lastMouseSendTime = Date.now();204 timeTillNextMouseResend *= timeToMouseResendFactor;205 totalWeight = 0;206 counts = {};207 numMouseEventsSent++;208 }209 var isInView = lastViewableFrac >= fracConsideredInView;210 if (typeof lastViewabilityCounts === 'undefined'211 || keyString(viewabilityCounts) != keyString(lastViewabilityCounts)) {212 if (isInView || !haveSentOutOfView) {213 sendViewabilityCounts(viewabilityCounts);214 }215 lastViewabilityCounts = viewabilityCounts;216 viewabilityCounts = {};217 timeTillNextResend = initialTimeToResend;218 lastSendTime = Date.now();219 numViewabilityResends = 0;220 if (isInView) { haveSentOutOfView = false; }221 else { haveSentOutOfView = true; }222 } else if (Object.keys(lastViewabilityCounts).length > 0 && Date.now() - lastSendTime > timeTillNextResend) {223 if (numViewabilityResends < maxViewabilityResends224 && numViewabilitySends < maxViewabilitySends225 && (isInView || !haveSentOutOfView)) {226 sendViewabilityCounts(viewabilityCounts);227 if (!isInView) { haveSentOutOfView = true; }228 }229 numViewabilityResends++;230 timeTillNextResend *= timeToResendFactor;231 lastSendTime = Date.now();232 lastViewabilityCounts = viewabilityCounts;233 viewabilityCounts = {};234 if (isInView) { haveSentOutOfView = false; }235 }236 if (numMouseEventsSent > maxNumCountsSent237 || secondsSinceLoad > maxSecondsSinceLoad) {238 window.clearInterval(checkAndSendInterval);239 window.clearInterval(checkViewabilityInterval);240 }241 };242 var sendViewabilityCounts = function(viewabilityCounts) {243 var sb = new Array();244 var secondsSinceLoad = Math.round((Date.now() - loadTime) / 1000);245 for (v in viewabilityCounts) {246 sb.push("sL:" + secondsSinceLoad + ",oV:" + (isSendingOutOfView ? "1" : "0") + "," + v + ",c:" + viewabilityCounts[v]);247 }248 firePixel(viewabilityPixel, sb.join('='));249 numViewabilitySends++;250 };251 var encodeWithBase64 = function(intVal) {252 var desiredLength = (Math.floor(intVal.toString(2).length / CHUNK_SIZE) + 1) * CHUNK_SIZE;253 var bitString = generatePaddedBitString(intVal, desiredLength);254 var numChars = bitString.length / CHUNK_SIZE;255 var base64StringBuilder = new Array();256 for (var curCharIndex = 0; curCharIndex < numChars; curCharIndex++) {257 var bitChunk = bitString.substring(curCharIndex * CHUNK_SIZE, (curCharIndex + 1) * CHUNK_SIZE);258 base64StringBuilder.push(base64KeyStr.charAt(parseInt(bitChunk, 2)));259 }260 return base64StringBuilder.join('');261 };262 var decodeWithBase64 = function(encodedVal) {263 var bitStringBuilder = new Array();264 for (var curCharIndex = 0; curCharIndex < encodedVal.length; curCharIndex++) {265 var curIntVal = base64KeyStr.indexOf(encodedVal.charAt(curCharIndex));266 bitStringBuilder.push(generatePaddedBitString(curIntVal.toString(2), CHUNK_SIZE));267 }268 return parseInt(bitStringBuilder.join(''), 2);269 };270 var encode = function(secondsSinceLoad, totalWeight, maxWeight, numBitsX, numBitsY, numValueBits, bitString) {271 var encodedStringBuilder = new Array();272 encodedStringBuilder.push(encodeWithBase64(secondsSinceLoad) + "=");273 encodedStringBuilder.push(encodeWithBase64(totalWeight) + "=");274 encodedStringBuilder.push(encodeWithBase64(maxWeight) + "=");275 encodedStringBuilder.push(encodeWithBase64(numBitsX) + "=");276 encodedStringBuilder.push(encodeWithBase64(numBitsY) + "=");277 encodedStringBuilder.push(encodeWithBase64(numValueBits) + "=");278 var numChars = Math.floor(bitString.length / CHUNK_SIZE) + 1;279 for (var i = 0; i < numChars; i++) {280 var start = i * CHUNK_SIZE;281 var end = Math.min(bitString.length, (i + 1) * CHUNK_SIZE);282 var bitStringChunk = bitString.substring(start, end);283 while (bitStringChunk.length < CHUNK_SIZE) {284 bitStringChunk += "0";285 }286 var intVal = parseInt(bitStringChunk, 2);287 encodedStringBuilder.push(base64KeyStr.charAt(intVal));288 }289 return encodedStringBuilder.join('');290 };291 var lastClickTime;292 var recordClick = function(e) {293 clearTimeout(e);294 lastClickTime = Date.now();295 if (!numBitsX || !numBitsY) {296 return;297 }298 var xFidelity = (1 << numBitsX);299 var yFidelity = (1 << numBitsY);300 var elementX = e.pageX - spanOffset.left;301 var elementY = e.pageY - spanOffset.top;302 var xFrac = Math.max(0, (elementX - 1) / adWidth);303 var yFrac = Math.max(0, (elementY - 1) / adHeight);304 var xPos = Math.floor(xFrac * xFidelity);305 var yPos = Math.floor(yFrac * yFidelity);306 var bitString = new Array();307 bitString.push(generatePaddedBitString(xPos, numBitsX));308 bitString.push(generatePaddedBitString(yPos, numBitsY));309 bitString.push(generatePaddedBitString(1, 1));310 var secondsSinceLoad = Math.round((Date.now() - loadTime) / 1000);311 var encodedString = encode(secondsSinceLoad, 1, 1, numBitsX, numBitsY, 1, bitString.join(''));312 var decodedMap = decode(encodedString);313 firePixel(clickPixel, encodedString);314 if (showCanvas) { renderHeatMap(canvas, decodedMap); }315 return true;316 };317 var chompWithBase64 = function(encodedString, separator) {318 var separatorIndex = encodedString.indexOf("=");319 var val = decodeWithBase64(encodedString.substring(0, separatorIndex));320 encodedString = encodedString.substring(separatorIndex + 1);321 return {val: val, chompedString: encodedString};322 };323 var decode = function(encodedString) {324 var retMap = {};325 var chompResult;326 chompResult = chompWithBase64(encodedString, '=');327 var secondsSinceLoad = chompResult['val'];328 chompResult = chompWithBase64(chompResult['chompedString'], '=');329 var totalWeight = chompResult['val'];330 chompResult = chompWithBase64(chompResult['chompedString'], '=');331 var maxWeight = chompResult['val'];332 chompResult = chompWithBase64(chompResult['chompedString'], '=');333 var numBitsX = chompResult['val'];334 chompResult = chompWithBase64(chompResult['chompedString'], '=');335 var numBitsY = chompResult['val'];336 chompResult = chompWithBase64(chompResult['chompedString'], '=');337 var numValueBits = chompResult['val'];338 encodedString = chompResult['chompedString'];339 var bitStrings = new Array();340 for (var curChar = 0; curChar < encodedString.length; curChar++) {341 var intVal = base64KeyStr.indexOf(encodedString.charAt(curChar));342 bitStrings.push(generatePaddedBitString(intVal, CHUNK_SIZE));343 }344 var bitString = bitStrings.join('');345 var curIndex = 0;346 var stringToLog = "[" + totalWeight + ", " + maxWeight +"]";347 while (curIndex + numBitsX + numBitsY + numValueBits <= bitString.length) {348 var xVal = parseInt(bitString.substring(curIndex, curIndex + numBitsX), 2);349 curIndex += numBitsX;350 var yVal = parseInt(bitString.substring(curIndex, curIndex + numBitsY), 2);351 curIndex += numBitsY;352 var val = parseInt(bitString.substring(curIndex, curIndex + numValueBits), 2);353 curIndex += numValueBits;354 retMap[xVal + "x" + yVal] = val;355 stringToLog += (xVal + "x" + yVal + " = " + val + "; ");356 }357 retMap['secondsSinceLoad'] = secondsSinceLoad;358 retMap['totalWeight'] = totalWeight;359 retMap['maxWeight'] = maxWeight;360 return retMap;361 };362 var renderHeatMap = function(canvas, heatMap) {363 var ctx = canvas.getContext("2d");364 ctx.clearRect(0, 0, adWidth, adHeight);365 var xFidelity = ((1 << numBitsX) - 1) + 1;366 var yFidelity = ((1 << numBitsY) - 1) + 1;367 var totalWeight = heatMap['totalWeight'];368 var maxWeight = heatMap['maxWeight'];369 for (var key in heatMap) {370 if (key != 'totalWeight') {371 var val = (heatMap[key] + 1) / valueFidelity;372 var keySplit = key.split('x');373 var xStart = Math.floor((keySplit[0] / xFidelity) * adWidth);374 var xEnd = xStart + Math.floor((1 / xFidelity) * adWidth);375 var yStart = Math.floor((keySplit[1] / yFidelity) * adHeight);376 var yEnd = yStart + Math.floor((1 / yFidelity) * adHeight);377 var colorIntensityVal = val;378 if (!isNaN(xStart)379 && !isNaN(xEnd)380 && !isNaN(yStart)381 && !isNaN(yEnd)382 && !isNaN(colorIntensityVal)) {383 ctx.fillStyle = "rgba(255, 0, 0," + colorIntensityVal +")";384 ctx.fillRect(xStart, yStart, xEnd - xStart, yEnd - yStart);385 }386 }387 }388 };389 function firePixel(src, data) {390 if (src && src != 'undefined' && data && data != 'undefined' && data != '') {391 if (location.protocol === 'https:') {392 src = src.replace('http:', 'https:');393 }394 new Image().src = src + '&d=' + data + '&r=' + Math.random();395 }396 };397 var isInIFrame = window.top !== window.self;398 var checkViewability = function(obj) {399 var ret = {};400 401 if (typeof window.mozInnerScreenY === 'undefined'402 || typeof window.mozInnerScreenX === 'undefined'403 || typeof jQueryLocal === 'undefined') {404 return ret;405 }406 var jQueryObj = jQueryLocal(obj);407 var topPadding = isInIFrame ? 119 : window.mozInnerScreenY - window.screenY;408 var leftPadding = isInIFrame ? 11 : window.mozInnerScreenX - window.screenX;409 var rightPadding = isInIFrame ? 41 : window.outerWidth - jQueryLocal(window).width() - leftPadding;410 var bottomPadding = 41;//isInIFrame ? 41 : window.outerHeight - jQueryLocal(window).height() - topPadding;411 ret['isInIFrame'] = isInIFrame;412 ret['screenWidth'] = window.screen.availWidth;413 ret['screenHeight'] = window.screen.availHeight;414 ret['viewportWidth'] = window.outerWidth - (leftPadding + rightPadding);415 ret['viewportHeight'] = window.outerHeight - (topPadding + bottomPadding);416 ret['objWidth'] = jQueryObj.width();417 ret['objHeight'] = jQueryObj.height();418 ret['viewportScreenX'] = window.screenX + leftPadding;419 ret['viewportScreenY'] = window.screenY + topPadding;420 ret['leftPadding'] = leftPadding;421 ret['topPadding'] = topPadding;422 ret['rightPadding'] = rightPadding;423 ret['bottomPadding'] = bottomPadding;424 ret['mozInnerScreenX'] = window.mozInnerScreenX;425 ret['mozInnerScreenY'] = window.mozInnerScreenY;426 ret['objScreenX'] = jQueryObj.offset()['left'] + window.mozInnerScreenX - jQueryLocal(window).scrollLeft();427 ret['objScreenY'] = jQueryObj.offset()['top'] + window.mozInnerScreenY - jQueryLocal(window).scrollTop();428 ret['objViewableScreenX'] = Math.max(leftPadding,429 Math.max(ret['objScreenX'],430 Math.min(ret['objScreenX'] + ret['objWidth'],431 ret['viewportScreenX'])));432 ret['objViewableScreenY'] = Math.max(topPadding,433 Math.max(ret['objScreenY'],434 Math.min(ret['objScreenY'] + ret['objHeight'],435 ret['viewportScreenY'])));436 ret['objViewableScreenX2'] = Math.max(ret['objViewableScreenX'],437 Math.min(ret['screenWidth'],438 Math.min(ret['viewportScreenX'] + ret['viewportWidth'],439 ret['objScreenX'] + ret['objWidth'])));440 ret['objViewableScreenY2'] = Math.max(ret['objViewableScreenY'],441 Math.min(ret['screenHeight'],442 Math.min(ret['viewportScreenY'] + ret['viewportHeight'],443 ret['objScreenY'] + ret['objHeight'])));444 ret['objViewableWidth'] = ret['objViewableScreenX2'] - ret['objViewableScreenX'];445 ret['objViewableHeight'] = ret['objViewableScreenY2'] - ret['objViewableScreenY'];446 ret['objViewableFrac'] = (ret['objViewableWidth'] * ret['objViewableHeight']) / (ret['objWidth'] * ret['objHeight']);447 ret['objViewableFracX'] = ret['objViewableWidth'] / ret['objWidth'];448 ret['objViewableFracY'] = ret['objViewableHeight'] / ret['objHeight'];449 return ret;450 };451 var keyString = function(viewabilityCounts) {452 var stringBuilder = new Array();453 for (k in viewabilityCounts) { if (k != 'toString' && k != 'keySet') { stringBuilder.push(k); }}454 return stringBuilder.join(',');455 };456 function Payload() {}457 Payload.prototype.toString = function() {458 var stringBuilder = new Array();459 for (k in this) { if (k != 'toString' && k != 'keySet') { stringBuilder.push(k + ":" + this[k]); }}460 return stringBuilder.join(',');461 };462 var viewabilityCounts = {};463 var lastViewableFrac = 0;464 var recordViewability = function() {465 if (typeof rfiTagSpan === 'undefined') {466 return;467 }468 try {469 var vData = checkViewability(rfiTagSpan);470 if (typeof vData === 'undefined'471 || typeof vData['objViewableFrac'] === 'undefined') {472 return;473 }474 if (isSendingOutOfView475 || vData['objViewableFrac'] != lastViewableFrac476 || vData['objViewableFrac'] > 0) {477 var payload = new Payload();478 payload['sW'] = vData['screenWidth'];479 payload['sH'] = vData['screenHeight'];480 payload['iF'] = vData['isInIFrame'];481 payload['tP'] = vData['topPadding'];482 payload['vX'] = vData['viewportScreenX'];483 payload['vY'] = vData['viewportScreenY'];484 payload['vW'] = vData['viewportWidth'];485 payload['vH'] = vData['viewportHeight'];486 payload['aX'] = vData['objScreenX'];487 payload['aY'] = vData['objScreenY'];488 payload['aW'] = vData['objWidth'];489 payload['aH'] = vData['objHeight'];490 payload['vP'] = Math.round(vData['objViewableFrac'] * 100);491 if (payload in viewabilityCounts) {492 viewabilityCounts[payload] += 1;493 } else {494 viewabilityCounts[payload] = 1;495 }496 lastViewableFrac = vData['objViewableFrac'];497 }498 } catch (err) {499 // ignore500 }501 };502 var checkViewabilityInterval = window.setInterval(recordViewability, checkViewabilityIntervalMillis);503 var checkAndSendInterval = window.setInterval(checkAndSendCounts, sendIntervalMillis);504 var clearTimeout = function(e) { if (refireTimeout) { window.clearTimeout(refireTimeout); }};...

Full Screen

Full Screen

base64String.spec.ts

Source:base64String.spec.ts Github

copy

Full Screen

1import * as fc from 'fast-check';2import { base64String } from '../../../src/arbitrary/base64String';3import {4 assertProduceValuesShrinkableWithoutContext,5 assertProduceCorrectValues,6 assertProduceSameValueGivenSameSeed,7} from './__test-helpers__/ArbitraryAssertions';8import * as ArrayMock from '../../../src/arbitrary/array';9import { fakeArbitrary } from './__test-helpers__/ArbitraryHelpers';10import { Value } from '../../../src/check/arbitrary/definition/Value';11import { buildShrinkTree, renderTree } from './__test-helpers__/ShrinkTree';12import { sizeForArbitraryArb } from './__test-helpers__/SizeHelpers';13function beforeEachHook() {14 jest.resetModules();15 jest.restoreAllMocks();16 fc.configureGlobal({ beforeEach: beforeEachHook });17}18beforeEach(beforeEachHook);19describe('base64String', () => {20 it('should accept any constraints accepting at least one length multiple of 4', () =>21 fc.assert(22 fc.property(23 fc.nat({ max: 5 }),24 fc.integer({ min: 3, max: 30 }),25 fc.boolean(),26 fc.boolean(),27 (min, gap, withMin, withMax) => {28 // Arrange29 const constraints = { minLength: withMin ? min : undefined, maxLength: withMax ? min + gap : undefined };30 // Act / Assert31 expect(() => base64String(constraints)).not.toThrowError();32 }33 )34 ));35 it('should reject any constraints not accepting at least one length multiple of 4', () =>36 fc.assert(37 fc.property(fc.nat({ max: 30 }), fc.nat({ max: 2 }), (min, gap) => {38 // Arrange39 const constraints = { minLength: min, maxLength: min + gap };40 let includesMultipleOf4 = false;41 for (let acceptedLength = constraints.minLength; acceptedLength <= constraints.maxLength; ++acceptedLength) {42 includesMultipleOf4 = includesMultipleOf4 || acceptedLength % 4 === 0;43 }44 fc.pre(!includesMultipleOf4);45 // Act / Assert46 expect(() => base64String(constraints)).toThrowError();47 })48 ));49 it('should always query for arrays that will produce length fitting the requested range', () =>50 fc.assert(51 fc.property(52 fc.nat({ max: 30 }),53 fc.integer({ min: 3, max: 30 }),54 fc.boolean(),55 fc.boolean(),56 (min, gap, withMin, withMax) => {57 // Arrange58 const constraints = { minLength: withMin ? min : undefined, maxLength: withMax ? min + gap : undefined };59 const array = jest.spyOn(ArrayMock, 'array');60 const { instance: arrayInstance, map } = fakeArbitrary();61 array.mockReturnValue(arrayInstance);62 map.mockReturnValue(arrayInstance); // fake map63 // Act64 base64String(constraints);65 // Assert66 expect(array).toHaveBeenCalledTimes(1);67 const constraintsOnArray = array.mock.calls[0][1]!;68 const rounded4 = (value: number) => {69 switch (value % 4) {70 case 0:71 return value;72 case 1:73 return value;74 case 2:75 return value + 2;76 case 3:77 return value + 1;78 }79 };80 if (constraints.minLength !== undefined) {81 expect(constraintsOnArray.minLength).toBeDefined();82 expect(rounded4(constraintsOnArray.minLength!)).toBeGreaterThanOrEqual(constraints.minLength);83 }84 if (constraints.maxLength !== undefined) {85 expect(constraintsOnArray.maxLength).toBeDefined();86 expect(rounded4(constraintsOnArray.maxLength!)).toBeLessThanOrEqual(constraints.maxLength);87 }88 if (constraintsOnArray.minLength !== undefined && constraintsOnArray.maxLength !== undefined) {89 expect(constraintsOnArray.maxLength).toBeGreaterThanOrEqual(constraintsOnArray.minLength);90 }91 }92 )93 ));94 it('should always forward constraints on size to the underlying arbitrary when provided', () =>95 fc.assert(96 fc.property(97 fc.nat({ max: 5 }),98 fc.integer({ min: 3, max: 30 }),99 fc.boolean(),100 fc.boolean(),101 sizeForArbitraryArb,102 (min, gap, withMin, withMax, size) => {103 // Arrange104 const constraints = {105 minLength: withMin ? min : undefined,106 maxLength: withMax ? min + gap : undefined,107 size,108 };109 const array = jest.spyOn(ArrayMock, 'array');110 const { instance: arrayInstance, map } = fakeArbitrary();111 array.mockReturnValue(arrayInstance);112 map.mockReturnValue(arrayInstance); // fake map113 // Act114 base64String(constraints);115 // Assert116 expect(array).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ size }));117 }118 )119 ));120});121describe('base64String (integration)', () => {122 type Extra = { minLength?: number; maxLength?: number };123 const extraParameters: fc.Arbitrary<Extra> = fc124 .tuple(fc.nat({ max: 30 }), fc.integer({ min: 3, max: 30 }), fc.boolean(), fc.boolean())125 .map(([min, gap, withMin, withMax]) => ({126 minLength: withMin ? min : undefined,127 // Minimal gap=3 to ensure we have at least one possible multiple of 4 between min and max128 maxLength: withMax ? min + gap : undefined,129 }));130 const isCorrect = (value: string, extra: Extra) => {131 if (extra.minLength !== undefined) {132 expect(value.length).toBeGreaterThanOrEqual(extra.minLength);133 }134 if (extra.maxLength !== undefined) {135 expect(value.length).toBeLessThanOrEqual(extra.maxLength);136 }137 const padStart = value.indexOf('=');138 const beforeEqualValue = value.substr(0, padStart === -1 ? value.length : padStart);139 const afterEqualValue = value.substr(padStart === -1 ? value.length : padStart);140 for (const c of beforeEqualValue.split('')) {141 expect('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/'.split('')).toContainEqual(c);142 }143 expect(['', '=', '==']).toContainEqual(afterEqualValue);144 };145 const base64StringBuilder = (extra: Extra) => base64String(extra);146 it('should produce the same values given the same seed', () => {147 assertProduceSameValueGivenSameSeed(base64StringBuilder, { extraParameters });148 });149 it('should only produce correct values', () => {150 assertProduceCorrectValues(base64StringBuilder, isCorrect, { extraParameters });151 });152 it('should produce values seen as shrinkable without any context', () => {153 assertProduceValuesShrinkableWithoutContext(base64StringBuilder, { extraParameters });154 });155 // assertShrinkProducesSameValueWithoutInitialContext is not applicable for base64String has some values will not shrink exactly the same way.156 // For instance: 'abcde' will be mapped to 'abcd', with default shrink it will try to shrink from 'abcde'. With context-less one it will start from 'abcd'.157 it.each`158 source | constraints159 ${'0123ABC==' /* invalid base 64 */} | ${{}}160 ${'AB==' /* not large enough */} | ${{ minLength: 5 }}161 ${'0123AB==' /* too large */} | ${{ maxLength: 7 }}162 `('should not be able to generate $source with fc.base64String($constraints)', ({ source, constraints }) => {163 // Arrange / Act164 const arb = base64String(constraints);165 const out = arb.canShrinkWithoutContext(source);166 // Assert167 expect(out).toBe(false);168 });169 it.each`170 rawValue171 ${'ABCD'}172 ${'0123AB=='}173 ${'01230123012301230123AB=='}174 ${'ABCD'.repeat(50)}175 `('should be able to shrink $rawValue', ({ rawValue }) => {176 // Arrange177 const arb = base64String();178 const value = new Value(rawValue, undefined);179 // Act180 const renderedTree = renderTree(buildShrinkTree(arb, value, { numItems: 100 })).join('\n');181 // Assert182 expect(arb.canShrinkWithoutContext(rawValue)).toBe(true);183 expect(renderedTree).toMatchSnapshot();184 });...

Full Screen

Full Screen

credential.ts

Source:credential.ts Github

copy

Full Screen

1import * as CBOR from 'cbor-js';2export class RandomChallengeGenerator {3 generate() {4 //return Uint8Array.from(randomStringFromServer, c => c.charCodeAt(0)),5 let challenge = new Uint8Array(32);6 window.crypto.getRandomValues(challenge);7 return challenge;8 }9}10class CredentialIdLengthProvider {11 private _dataView: DataView;12 constructor(private _authData) {13 this._dataView = new DataView(new ArrayBuffer(2));14 const idLenBytes = this._authData.slice(53, 55);15 idLenBytes.forEach((value, index) => this._dataView.setUint8(index, value));16 }17 idLength() {18 return this._dataView.getUint16(0); // typescript complains but this works19 }20}21class CredentialAttestationAuthData {22 private _credentialIdLength: number;23 constructor(private _authData) {24 const idLengthProvider = new CredentialIdLengthProvider(_authData);25 this._credentialIdLength = idLengthProvider.idLength();26 }27 credentialId() {28 return this._authData.slice(55, this._credentialIdLength);29 }30 publicKey() {31 const publicKeyBytes = this._authData.slice(55 + this._credentialIdLength);32 return CBOR.decode(publicKeyBytes.buffer);33 }34}35class CredentialAttestation {36 attestation;37 authData: CredentialAttestationAuthData;38 constructor(private _rawAttestationObject) {39 this.attestation = CBOR.decode(_rawAttestationObject);40 this.authData = new CredentialAttestationAuthData(this.attestation.authData);41 }42 publicKey() {43 return this.authData.publicKey();44 }45}46class CredentialClientDataJson {47 private _decoded;48 constructor(private _clientDataJSON, private _decoder = new TextDecoder()) {49 this._decoded = JSON.parse(this._decoder.decode(_clientDataJSON));50 }51 challenge() {52 return this._decoded.challenge;53 }54 origin() {55 return this._decoded.origin;56 }57 authType() {58 return this._decoded.type;59 }60}61export class CredentialInfo {62 id: Base64UrlEncodedString;63 attestation: CredentialAttestation;64 clientDataJson: CredentialClientDataJson;65 //constructor(private _credential: PublicKeyCredential) {}66 constructor(private _credential) {67 this.id = new Base64UrlEncodedString(_credential.id);68 this.attestation = new CredentialAttestation(_credential.response.attestationObject);69 this.clientDataJson = new CredentialClientDataJson(_credential.response.clientDataJSON);70 }71}72export class Base64StringBuilder {73 static BASE64_URL_ENCODED_REGEX = /(\-|_)+/g;74 //static BASE64_NONURL_ENCODED_REGEX = /(\+|\=|\/)+/g;75 static build(str): Base64EncodedString|Base64UrlEncodedString {76 if (Base64StringBuilder.BASE64_URL_ENCODED_REGEX.test(str)) {77 return new Base64UrlEncodedString(str);78 } else {79 return new Base64EncodedString(str);80 }81 }82}83export class Base64EncodedString {84 //BASE64_NONURL_ENCODED_REGEX = new RegExp('(\+|\=|\/)+', 'g');85 BASE64_URL_ENCODED_REGEX = /(\-|_)+/g;86 constructor(private _str) {87 if (this.BASE64_URL_ENCODED_REGEX.test(_str)) {88 throw "String provided is not base64 encoded.";89 }90 }91 toBase64Url() {92 return this._str.replace(/\+/g, '-').replace(/\//g, '_').replace(/\=+$/, '');93 }94 toBase64() {95 return this._str;96 }97 toArrayBuffer() {98 return base64DecToArr(this.toBase64());99 }100}101export class Base64UrlEncodedString {102 //BASE64_NONURL_ENCODED_REGEX = new RegExp('(\+|\=|\/)+', 'g');103 BASE64_NONURL_ENCODED_REGEX = /(\+|\=|\/)+/g;104 constructor(private _str) {105 //const badString = 'h/FoAgT9GbyRg0d4dYWE28GBeOGlm2UnKWTOCghY6JjpKU7KB4twkqfwDYkC4YX9GsS5Jt+Qj5ulbkTHgiri9g==';106 //const goodString = '23UOCCiZU3MhMEfISeHkh-pfyno1iqakU_9ZEZiZKJVCt0QzmbalJwmSbhLFND8tQ64GjsAnhGAKd76TDo7PCg';107 if (this.BASE64_NONURL_ENCODED_REGEX.test(_str)) {108 throw "String provided is not base64 url encoded.";109 }110 }111 toBase64Url() {112 return this._str;113 }114 toBase64() {115 return (this._str + '===')116 .slice(0, this._str.length + (this._str.length % 4))117 .replace(/-/g, '+').replace(/_/g, '/');118 }119 toArrayBuffer() {120 return base64DecToArr(this.toBase64());121 }122}123/*\124|*|125|*| Base64 / binary data / UTF-8 strings utilities (#1)126|*|127|*| https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding128|*|129|*| Author: madmurphy130|*|131\*/132/* Array of bytes to base64 string decoding */133const b64ToUint6 = (nChr) => {134 return nChr > 64 && nChr < 91 ?135 nChr - 65136 : nChr > 96 && nChr < 123 ?137 nChr - 71138 : nChr > 47 && nChr < 58 ?139 nChr + 4140 : nChr === 43 ?141 62142 : nChr === 47 ?143 63144 :145 0;146}147const base64DecToArr = (sBase64, nBlockSize = null) => {148 var149 sB64Enc = sBase64.replace(/[^A-Za-z0-9\+\/]/g, ""), nInLen = sB64Enc.length,150 nOutLen = nBlockSize ? Math.ceil((nInLen * 3 + 1 >>> 2) / nBlockSize) * nBlockSize : nInLen * 3 + 1 >>> 2, aBytes = new Uint8Array(nOutLen);151 for (var nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0; nInIdx < nInLen; nInIdx++) {152 nMod4 = nInIdx & 3;153 nUint24 |= b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << 18 - 6 * nMod4;154 if (nMod4 === 3 || nInLen - nInIdx === 1) {155 for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) {156 aBytes[nOutIdx] = nUint24 >>> (16 >>> nMod3 & 24) & 255;157 }158 nUint24 = 0;159 }160 }161 return aBytes;162}163/* Base64 string to array encoding */164const uint6ToB64 = (nUint6) => {165 return nUint6 < 26 ?166 nUint6 + 65167 : nUint6 < 52 ?168 nUint6 + 71169 : nUint6 < 62 ?170 nUint6 - 4171 : nUint6 === 62 ?172 43173 : nUint6 === 63 ?174 47175 :176 65;177}178const base64EncArr = (aBytes) => {179 var eqLen = (3 - (aBytes.length % 3)) % 3, sB64Enc = "";180 for (var nMod3, nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {181 nMod3 = nIdx % 3;182 /* Uncomment the following line in order to split the output in lines 76-character long: */183 /*184 if (nIdx > 0 && (nIdx * 4 / 3) % 76 === 0) { sB64Enc += "\r\n"; }185 */186 nUint24 |= aBytes[nIdx] << (16 >>> nMod3 & 24);187 if (nMod3 === 2 || aBytes.length - nIdx === 1) {188 sB64Enc += String.fromCharCode(uint6ToB64(nUint24 >>> 18 & 63), uint6ToB64(nUint24 >>> 12 & 63), uint6ToB64(nUint24 >>> 6 & 63), uint6ToB64(nUint24 & 63));189 nUint24 = 0;190 }191 }192 return eqLen === 0 ?193 sB64Enc194 :195 sB64Enc.substring(0, sB64Enc.length - eqLen) + (eqLen === 1 ? "=" : "==");...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { base64StringBuilder } = require("fast-check");2const builder = base64StringBuilder();3builder.addChar("a");4builder.addChar("b");5builder.addChar("c");6builder.addChar("d");7builder.addChar("e");8builder.addChar("f");9builder.addChar("g");10builder.addChar("h");11builder.addChar("i");12builder.addChar("j");13builder.addChar("k");14builder.addChar("l");15builder.addChar("m");16builder.addChar("n");17builder.addChar("o");18builder.addChar("p");19builder.addChar("q");20builder.addChar("r");21builder.addChar("s");22builder.addChar("t");23builder.addChar("u");24builder.addChar("v");25builder.addChar("w");26builder.addChar("x");27builder.addChar("y");28builder.addChar("z");29builder.addChar("A");30builder.addChar("B");31builder.addChar("C");32builder.addChar("D");33builder.addChar("E");34builder.addChar("F");35builder.addChar("G");36builder.addChar("H");37builder.addChar("I");38builder.addChar("J");39builder.addChar("K");40builder.addChar("L");41builder.addChar("M");42builder.addChar("N");43builder.addChar("O");44builder.addChar("P");45builder.addChar("Q");46builder.addChar("R");47builder.addChar("S");48builder.addChar("T");49builder.addChar("U");50builder.addChar("V");51builder.addChar("W");52builder.addChar("X");53builder.addChar("Y");54builder.addChar("Z");55builder.addChar("0");56builder.addChar("1");57builder.addChar("2");58builder.addChar("3");59builder.addChar("4");60builder.addChar("5");61builder.addChar("6");62builder.addChar("7");63builder.addChar("8");64builder.addChar("9");65builder.addChar("+");66builder.addChar("/");67builder.addChar("=");68builder.addChar(" ");69builder.addChar("!");70builder.addChar('"');71builder.addChar("#");72builder.addChar("$");73builder.addChar("%");74builder.addChar("&");75builder.addChar("'");76builder.addChar("(");77builder.addChar(")");78builder.addChar("*");79builder.addChar(",");80builder.addChar("-");81builder.addChar(".");82builder.addChar("/");83builder.addChar(":");84builder.addChar(";");85builder.addChar("<");86builder.addChar(">");

Full Screen

Using AI Code Generation

copy

Full Screen

1const b64 = require('fast-check-monorepo/dist/base64StringBuilder');2console.log(b64.base64StringBuilder(1000));3const b64 = require('fast-check-monorepo/dist/base64StringBuilder');4console.log(b64.base64StringBuilder(1000));5const b64 = require('fast-check-monorepo/dist/base64StringBuilder');6console.log(b64.base64StringBuilder(1000));7const b64 = require('fast-check-monorepo/dist/base64StringBuilder');8console.log(b64.base64StringBuilder(1000));9const b64 = require('fast-check-monorepo/dist/base64StringBuilder');10console.log(b64.base64StringBuilder(1000));11const b64 = require('fast-check-monorepo/dist/base64StringBuilder');12console.log(b64.base64StringBuilder(1000));13const b64 = require('fast-check-monorepo/dist/base64StringBuilder');14console.log(b64.base64StringBuilder(1000));15const b64 = require('fast-check-monorepo/dist/base64StringBuilder');16console.log(b64.base64StringBuilder(1000));17const b64 = require('fast-check-monorepo/dist/base64StringBuilder');18console.log(b64.base64StringBuilder(1000));19const b64 = require('fast-check-monorepo/dist/base64StringBuilder');20console.log(b64.base64StringBuilder(1000));21const b64 = require('fast-check-monorepo/dist/base64StringBuilder');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { base64StringBuilder } = require('fast-check');2const { base64String } = require('fast-check/lib/types/arbitrary/Base64StringArbitrary');3const { base64String: base64StringFromMonorepo } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');4const { base64String: base64StringFromMonorepo2 } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');5const { base64StringBuilder } = require('fast-check');6const { base64String } = require('fast-check/lib/types/arbitrary/Base64StringArbitrary');7const { base64StringBuilder } = require('fast-check-monorepo');8const { base64String } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');9const { base64StringBuilder } = require('fast-check-monorepo');10const { base64String } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');11const { base64StringBuilder } = require('fast-check-monorepo');12const { base64String } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');13const { base64StringBuilder } = require('fast-check-monorepo');14const { base64String } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');15const { base64StringBuilder } = require('fast-check-monorepo');16const { base64String } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');17const { base64StringBuilder } = require('fast-check-monorepo');18const { base64String } = require('fast-check-monorepo/lib/types/arbitrary/Base64StringArbitrary');19const { base64StringBuilder } = require('fast-check-monorepo');

Full Screen

Using AI Code Generation

copy

Full Screen

1import { base64StringBuilder } from 'fast-check';2import { base64String } from '@jsverify/base64-string';3import { string } from '@jsverify/string';4const arb = base64StringBuilder();5const arb1 = base64String();6const arb2 = string();7const arb3 = string();8const arb4 = string();9const arb5 = string();10const arb6 = string();

Full Screen

Using AI Code Generation

copy

Full Screen

1var fs = require('fs');2var path = require('path');3var base64 = require('base64-js');4var btoa = require('btoa');5var atob = require('atob');6var Base64Arbitrary = require('fast-check-monorepo/test/unit/check/arbitrary/Base64Arbitrary.spec.ts');7var base64StringBuilder = require('fast-check-monorepo/test/unit/check/arbitrary/Base64Arbitrary.spec.ts');8var base64StringBuilder = function() {9 var str = '';10 var length = 100;11 var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';12 for (var i = 0; i < length; i++) {13 str += possible.charAt(Math.floor(Math.random() * possible.length));14 }15 return str;16};17console.log(base64StringBuilder());18var fs = require('fs');19var path = require('path');20var base64 = require('base64-js');21var btoa = require('btoa');22var atob = require('atob');23var Base64Arbitrary = require('fast-check-monorepo/test/unit/check/arbitrary/Base64Arbitrary.spec.ts');24var base64StringBuilder = require('fast-check-monorepo/test/unit/check/arbitrary/Base64Arbitrary.spec.ts');25var base64StringBuilder = function() {26 var str = '';27 var length = 100;28 var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';29 for (var i = 0; i < length; i++) {30 str += possible.charAt(Math.floor(Math.random() * possible.length));31 }32 return str;33};34console.log(base64StringBuilder());35var fs = require('fs');36var path = require('path');37var base64 = require('base64-js');38var btoa = require('btoa');39var atob = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1const { base64StringBuilder } = require('fast-check');2const base64String = base64StringBuilder({ minLength: 10, maxLength: 15 });3console.log(base64String());4{5 "scripts": {6 },7 "dependencies": {8 }9}10{11 "dependencies": {12 "fast-check": {13 "requires": {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { base64StringBuilder } = require('fast-check');2const base64String = base64StringBuilder(10);3console.log(base64String);4const { base64StringArbitrary } = require('fast-check');5const base64String = base64StringArbitrary();6console.log(base64String);7const { base64StringArbitrary } = require('fast-check');8const base64String = base64StringArbitrary({ maxLength: 20 });9console.log(base64String);10const { base64StringArbitrary } = require('fast-check');11const base64String = base64StringArbitrary({ minLength: 5, maxLength: 20 });12console.log(base64String);13const { base64StringArbitrary } = require('fast-check');14const base64String = base64StringArbitrary({ maxLength: 20, withPadding: true });15console.log(base64String);16const { base64StringArbitrary } = require('fast-check');17const base64String = base64StringArbitrary({ maxLength: 20, withPadding: false });18console.log(base64String);19const { base64StringArbitrary } = require('fast-check');20const base64String = base64StringArbitrary({ maxLength: 20, withPadding: false, with

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful