How to use sim.run method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

bf-spark-sim.test.js

Source:bf-spark-sim.test.js Github

copy

Full Screen

1const fs = require('fs');2const SparkSim = require('../src/bf-spark-sim');3const unitData = JSON.parse(fs.readFileSync('./tests/info-gl.json', 'utf8'));4const sparkSim = new SparkSim({5 getUnit: id => unitData[id],6});7test('fully specified input - fire squad', async () => {8 const expectedSquadResult = [9 {10 'id': '11047',11 'alias': 'Infernal Pyre Rugahr',12 'position': 'top-left',13 'bbOrder': 6,14 'type': 'sbb',15 'actualSparks': 114,16 'possibleSparks': 114,17 },18 {19 'id': '10257',20 'alias': 'Vesta Padma Michele',21 'position': 'top-right',22 'bbOrder': 2,23 'type': 'sbb',24 'actualSparks': 135,25 'possibleSparks': 228,26 },27 {28 'id': '60497',29 'alias': 'Necromancer Lilly Matah',30 'position': 'middle-left',31 'bbOrder': 3,32 'type': 'sbb',33 'actualSparks': 0,34 'possibleSparks': 0,35 },36 {37 'id': '810278',38 'alias': 'Starpyre Lancer Zeis',39 'position': 'middle-right',40 'bbOrder': 4,41 'type': 'sbb',42 'actualSparks': 141,43 'possibleSparks': 141,44 },45 {46 'id': '11047',47 'alias': 'Infernal Pyre Rugahr',48 'position': 'bottom-left',49 'bbOrder': 5,50 'type': 'sbb',51 'actualSparks': 114,52 'possibleSparks': 114,53 },54 {55 'id': '810278',56 'alias': 'Starpyre Lancer Zeis',57 'position': 'bottom-right',58 'bbOrder': 1,59 'type': 'sbb',60 'actualSparks': 141,61 'possibleSparks': 141,62 },63 ];64 const input = [65 {66 'originalFrames': null,67 'id': '11047',68 'type': 'sbb',69 'bbOrder': 6,70 'position': 'top-left',71 },72 {73 'originalFrames': null,74 'id': '11047',75 'type': 'sbb',76 'bbOrder': 5,77 'position': 'bottom-left',78 },79 {80 'originalFrames': null,81 'id': '810278',82 'type': 'sbb',83 'bbOrder': 4,84 'position': 'middle-right',85 },86 {87 'originalFrames': null,88 'id': '810278',89 'type': 'sbb',90 'bbOrder': 1,91 'position': 'bottom-right',92 },93 {94 'originalFrames': null,95 'id': '60497',96 'type': 'sbb',97 'bbOrder': 3,98 'position': 'middle-left',99 },100 {101 'originalFrames': null,102 'id': '10257',103 'type': 'sbb',104 'bbOrder': 2,105 'position': 'top-right',106 },107 ];108 const results = await sparkSim.run(input, { sortResults: true, });109 expect(results.length).toBe(1);110 const actualResult = results[0];111 expect(actualResult.weightedPercentage).toBeCloseTo(0.9184);112 actualResult.squad.forEach((unit, index) => {113 const expectedUnit = expectedSquadResult[index];114 expect(unit).toEqual(expectedUnit);115 });116});117test('only units specified, with progress event handler - 100% spark squad', async () => {118 const input = [119 {120 'originalFrames': null,121 'id': '860318',122 'type': 'sbb',123 },124 {125 'originalFrames': null,126 'id': '860318',127 'type': 'sbb',128 },129 {130 'originalFrames': null,131 'id': '60527',132 'type': 'sbb',133 },134 {135 'originalFrames': null,136 'id': '60527',137 'type': 'sbb',138 },139 {140 'originalFrames': null,141 'id': '860328',142 'type': 'sbb',143 },144 {145 'originalFrames': null,146 'id': '860328',147 'type': 'sbb',148 },149 ];150 sparkSim.onProgress(event => {151 console.log(event.message);152 });153 const results = await sparkSim.run(input, { sortResults: true, });154 const actualResult = results[0];155 console.log(actualResult);156 expect(actualResult.weightedPercentage).toBeCloseTo(1.0);157});158test('squad with 2 specified, 4 "(any)" units', async () => {159 const input = [160 {161 'originalFrames': null,162 'id': '860328',163 'type': 'sbb',164 },165 {166 'originalFrames': null,167 'id': '860328',168 'type': 'sbb',169 },170 {171 'id': 'X',172 },173 {174 'id': 'X',175 },176 {177 'id': 'X',178 },179 {180 'id': 'X',181 },182 ];183 const results = await sparkSim.run(input, { sortResults: true, });184 const actualResult = results[0];185 console.log(actualResult);186 // should result in perfectly sparking both units187 expect(actualResult.weightedPercentage).toBeCloseTo(1.0);188});189test('Error: < 6 unit input', async () => {190 try {191 await sparkSim.run([]);192 } catch (err) {193 expect(err.message).toMatch('Squad length must be 6');194 }195});196test('Error: < 2 actual units - 5 any', async () => {197 const input = [198 {199 id: 10011,200 },201 {202 id: 'X',203 },204 {205 id: 'X',206 },207 {208 id: 'X',209 },210 {211 id: 'X',212 },213 {214 id: 'X',215 },216 ];217 try {218 await sparkSim.run(input);219 } catch (err) {220 expect(err.message).toMatch('Must have at least 2 actual units in squad');221 }222});223test('Empty units, 2 specfied units', async () => {224 const input = [225 {226 'id': '860328',227 'type': 'sbb',228 },229 {230 'id': '860328',231 'type': 'sbb',232 },233 {234 'id': 'E',235 'position': 'top-left',236 },237 {238 'id': 'E',239 'position': 'middle-left',240 },241 {242 'id': 'E',243 'position': 'bottom-left',244 },245 {246 'id': 'E',247 'position': 'middle-right',248 },249 ];250 const results = await sparkSim.run(input, { sortResults: true, });251 const actualResult = results[0];252 console.log(actualResult);253 // should result in perfectly sparking both units254 expect(actualResult.weightedPercentage).toBeCloseTo(1.0);255});256test('Empty and Any units, 2 specified', async () => {257 const input = [258 {259 'id': '860328',260 'type': 'sbb',261 },262 {263 'id': '860328',264 'type': 'sbb',265 },266 {267 'id': 'X',268 },269 {270 'id': 'X',271 },272 {273 'id': 'X',274 },275 {276 'id': 'E',277 'position': 'middle-right',278 },279 ];280 const results = await sparkSim.run(input, { sortResults: true, });281 // should result in perfectly sparking both units282 results.forEach(result => {283 expect(result.weightedPercentage).toBeCloseTo(1.0);284 });285});286test('Empty and Any units, 2 specified, limit results to 5', async () => {287 const input = [288 {289 'id': '860328',290 'type': 'sbb',291 },292 {293 'id': '860328',294 'type': 'sbb',295 },296 {297 'id': 'X',298 },299 {300 'id': 'X',301 },302 {303 'id': 'X',304 },305 {306 'id': 'E',307 'position': 'middle-right',308 },309 ];310 const results = await sparkSim.run(311 input,312 {313 sortResults: true,314 maxResults: 5,315 });316 expect(results.length).toBeLessThanOrEqual(5);317 // should result in perfectly sparking both units318 results.forEach(result => {319 expect(result.weightedPercentage).toBeCloseTo(1.0);320 });321});322test('Error: Empty unit has BB Order', async () => {323 const input = [324 {325 id: '10011',326 },327 {328 id: 'E',329 position: 'top-left',330 bbOrder: 1,331 },332 {333 id: '10011',334 },335 {336 id: 'X',337 },338 {339 id: 'X',340 },341 {342 id: 'X',343 },344 ];345 try {346 await sparkSim.run(input);347 } catch (err) {348 expect(err.message).toMatch('Empty units must not have any BB Order');349 }350});351test('Error: highest BB order doesn\'t match max', async () => {352 const input = [353 {354 id: '10011',355 },356 {357 id: 'E',358 position: 'top-right',359 },360 {361 id: 'X',362 bbOrder: 6,363 },364 {365 id: '10011',366 },367 {368 id: 'X',369 },370 {371 id: 'X',372 },373 ];374 try {375 await sparkSim.run(input);376 } catch (err) {377 expect(err.message).toMatch('BB Order cannot exceed number of non-empty units (5)');378 }379});380test('Teleporter: Karna Masta sparks with Tilith UBB 72 times', async () => {381 const input = [{382 'id': 'X',383 'position': 'top-left',384 'bbOrder': 2,385 }, {386 'id': 'X',387 'position': 'top-right',388 'bbOrder': 3,389 }, {390 'id': '51317',391 'position': 'middle-left',392 'bbOrder': 1,393 'type': 'sbb',394 }, {395 'id': 'E',396 'position': 'middle-right',397 'type': '',398 }, {399 'id': '50256',400 'position': 'bottom-left',401 'bbOrder': 4,402 'type': 'ubb',403 }, {404 'id': 'E',405 'position': 'bottom-right',406 'type': '',407 },];408 const result = await sparkSim.run(input, { sortResults: true, threshold: 0.1, });409 expect(result[0].squad.length).toBe(6);410 const actualUnits = result[0].squad.filter(u => u.id !== 'E' && u.id !== 'X');411 expect(actualUnits.length).toBe(2);412 actualUnits.forEach(unit => {413 expect(unit.actualSparks).toBe(72);414 });415});416test('unit with unknown proc id', async () => {417 const input = [418 {419 'id': '840128',420 'alias': 'Silent Sentinel Silvie',421 'position': 'top-left',422 'bbOrder': 3,423 'type': 'sbb',424 'actualSparks': 150,425 'possibleSparks': 154,426 'delay': 0,427 },428 {429 'id': '840278',430 'alias': 'Viper Blitzkrieg Durumn',431 'position': 'top-right',432 'bbOrder': 2,433 'type': 'sbb',434 'actualSparks': 158,435 'possibleSparks': 159,436 'delay': 0,437 },438 {439 'id': '840438',440 'alias': 'Demon Ulfhednar Zelion',441 'position': 'middle-left',442 'bbOrder': 5,443 'type': 'sbb',444 'actualSparks': 108,445 'possibleSparks': 143,446 'delay': 0,447 },448 {449 'id': 'E',450 'alias': '(Empty)',451 'position': 'middle-right',452 'type': '',453 'actualSparks': 0,454 'possibleSparks': 0,455 'delay': 0,456 },457 {458 'id': '840288',459 'alias': 'Sonic Blaster Vashi',460 'position': 'bottom-left',461 'bbOrder': 1,462 'type': 'sbb',463 'actualSparks': 138,464 'possibleSparks': 138,465 'delay': 0,466 },467 {468 'id': '40507',469 'alias': 'Radiant Guardian Shera',470 'position': 'bottom-right',471 'bbOrder': 4,472 'type': 'sbb',473 'actualSparks': 234,474 'possibleSparks': 240,475 'delay': 0,476 },477 ];478 const result = await sparkSim.run(input, { sortResults: true, threshold: 0.1, });479 expect(result[0].squad.length).toBe(6);480});481test('Teleporter: Feeva sparks 102 hits, Dranoel sparks 105 hits', async () => {482 const input = [{483 'id': 'X',484 'alias': '(Any)',485 'position': 'top-left',486 'bbOrder': 4,487 'type': '',488 },489 {490 'id': 'X',491 'alias': '(Any)',492 'position': 'top-right',493 'bbOrder': 3,494 'type': '',495 },496 {497 'id': 'X',498 'alias': '(Any)',499 'position': 'middle-left',500 'bbOrder': 5,501 'type': '',502 },503 {504 'id': '830048',505 'alias': 'Dark Soul Dranoel',506 'position': 'middle-right',507 'bbOrder': 1,508 'type': 'sbb',509 },510 {511 'id': '60667',512 'alias': 'Sublime Darkness Feeva',513 'position': 'bottom-left',514 'bbOrder': 6,515 'type': 'sbb',516 },517 {518 'id': 'X',519 'alias': '(Any)',520 'position': 'bottom-right',521 'bbOrder': 2,522 'type': '',523 },];524 const result = await sparkSim.run(input, { sortResults: true, threshold: 0.1, });525 expect(result[0].squad.length).toBe(6);526 const actualUnits = result[0].squad.filter(u => u.id !== 'E' && u.id !== 'X');527 expect(actualUnits.length).toBe(2);528 actualUnits.forEach(unit => {529 if (+unit.id === 60667) {530 expect(unit.actualSparks).toBe(102);531 } else if (+unit.id === 830048) {532 expect(unit.actualSparks).toBe(105);533 } else {534 throw Error(`Unknown unit ${unit.id} - ${unit.alias}`);535 }536 });537});538test('Teleporter: Alza Masta and Xenon OE spark 66 hits', async () => {539 const input = [540 {541 'id': '61207',542 'position': 'top-left',543 'bbOrder': 1,544 'type': 'bb',545 },546 {547 'id': 'E',548 'position': 'top-right',549 'type': '',550 }, {551 'id': 'E',552 'position': 'middle-left',553 'type': '',554 }, {555 'id': 'E',556 'position': 'middle-right',557 'type': '',558 }, {559 'id': '860018',560 'position': 'bottom-left',561 'bbOrder': 2,562 'type': 'sbb',563 }, {564 'id': 'E',565 'position': 'bottom-right',566 'type': '',567 },];568 const result = await sparkSim.run(input, { sortResults: true, threshold: 0.1, });569 expect(result[0].squad.length).toBe(6);570 const actualUnits = result[0].squad.filter(u => u.id !== 'E' && u.id !== 'X');571 expect(actualUnits.length).toBe(2);572 actualUnits.forEach(unit => {573 expect(unit.actualSparks).toBe(66);574 });575});576test('Teleporter: Qiutong and Elza OE spark 108 hits', async () => {577 const input = [578 {579 'id': 'E',580 'position': 'top-left',581 'type': '',582 },583 {584 'id': '60527',585 'position': 'top-right',586 'type': 'sbb',587 'bbOrder': 1,588 }, {589 'id': '850568',590 'position': 'middle-left',591 'bbOrder': 3,592 'type': 'sbb',593 }, {594 'id': 'E',595 'position': 'middle-right',596 'type': '',597 }, {598 'id': '60497',599 'position': 'bottom-left',600 'bbOrder': 2,601 'type': 'sbb',602 }, {603 'id': 'E',604 'position': 'bottom-right',605 'type': '',606 },];607 const result = await sparkSim.run(input, { sortResults: true, threshold: 0.1, });608 expect(result[0].squad.length).toBe(6);609 const actualUnits = result[0].squad.filter(u => u.id !== 'E' && u.id !== 'X' && u.id !== '60497');610 expect(actualUnits.length).toBe(2);611 actualUnits.forEach(unit => {612 expect(unit.actualSparks).toBe(108);613 });614});615test('Teleporter: Qiutong and Reed 7* spark 18 hits', async () => {616 const input = [{617 'id': 'E',618 'position': 'top-left',619 'type': '',620 },621 {622 'id': 'E',623 'position': 'top-right',624 'type': '',625 }, {626 'id': 'X',627 'position': 'middle-left',628 'bbOrder': 2,629 }, {630 'id': 'E',631 'position': 'middle-right',632 'type': '',633 }, {634 'id': '850568',635 'position': 'bottom-left',636 'bbOrder': 1,637 'type': 'sbb',638 }, {639 'id': '10295',640 'position': 'bottom-right',641 'type': 'sbb',642 'bbOrder': 3,643 },644 ];645 const result = await sparkSim.run(input, {646 sortResults: true,647 threshold: 0.1,648 });649 expect(result[0].squad.length).toBe(6);650 const actualUnits = result[0].squad.filter(u => u.id !== 'E' && u.id !== 'X' && u.id !== '60497');651 expect(actualUnits.length).toBe(2);652 actualUnits.forEach(unit => {653 expect(unit.actualSparks).toBe(18);654 });...

Full Screen

Full Screen

simualte.js

Source:simualte.js Github

copy

Full Screen

1var doc = document;2var type = "";3$(function () {4 5 /**6 * SimualtValidate.jsp =-= ValidateController7 * 8 */9 (function () {10 var simCheck = doc.getElementById("sim-check");11 if (simCheck) {12 13 //获取相应模型14 //查询Parameters参数15 $.get('/modelArgs/modelArgs.json').done(function (row){16 //console.log(row)17 if (row.data.length != 0)18 {19 var res = row.data[0];20 if (res.modelType == 1) 21 {22 var add = '<option value="1">Serial model</option>';23 $('#sim-model').append(add);24 $('.sim-v-serial').show();25 $('.sim-v-relay').hide();26 $('.notes').show();27 }28 else if (res.modelType == 2)29 {30 var add = '<option value="2">Relay model</option>';31 $('#sim-model').append(add);32 $('.sim-v-serial').hide();33 $('.sim-v-relay').show();34 $('.notes').hide();35 }36 37 }38 }).fail(function () {39 console.log("fail");40 });41 //点击校验42 $("#sim-check").click(function () {43 var _val = $('#sim-model').val();44 if (_val == 0) 45 {46 $('#sim-error-check').show();47 return false;48 }49 else50 {51 $('#sim-error-check').hide();52 $('#timelimit').hide();53 $('#loopslimit').hide();54 $('#tlimit').hide();55 $('#olimit').hide();56 $('#sim-error-run').hide();57 //执行验证58 if(typeof(WebSocket) == "undefined") {59 alert("您的浏览器不支持WebSocket");60 return;61 }62 document.getElementById('sim-check-info').innerHTML="";63 socket = new SockJS("http://"+document.location.host+"/webSocketServer/validate");64 socket .onopen = function () {65 //logg('Info: connection opened.');66 };67 68 socket .onmessage = function (event) {69 logg(event.data);70 };71 socket .onclose = function (event) {72 //logg('Info: connection closed.');73 //logg(event);74 };75 $.post("/simualte/Validate").done(function (result) {76 //console.log(result);77 type = result;78 if(type == "success"){79 alert("run validate success !");80 }else{81 alert("run validate fail , "+"error is :"+result);82 }83 socket.onclose();84 }).fail(function () {85 alert("run validate fail , "+"error is server error!");86 socket.onclose();87 //console.log("fail");88 });89 function logg(messages) {90 var consoleBox = document.getElementById('sim-check-info');91 var p = document.createElement('p');92 p.style.wordWrap = 'break-word';93 // p.appendChild(document.createTextNode(messages));94 p.innerHTML = messages;95 consoleBox.appendChild(p);96 consoleBox.scrollTop = consoleBox.scrollHeight;97 //console.log(messages)98 }99 }100 });101 102 //获取当前场景是否在运行中103// $.post("/cascade/runSilumate").done(function (res) {104// //console.log(res)105// if (res == "Simulating") 106// {107// $('#modal-run').val("1");108// }109// }).fail(function () {110// //console.log("fail");111// });112 113 //点击运行run114 $('#sim-run').click(function () {115 var runTime = $('#sim-run-time').val();116 var runCount = $('#sim-run-count').val();117 var runModel = $('#sim-model').val();118 var run_t_limit = $('#sim-run-t-limit').val();119 var run_opt_limit = $("#sim-run-opt-limit").val();120 var modal_run = $('#modal-run').val();121// if (modal_run == 1) 122// {123// $('#modal-siming').find('.modal-body p').text("The Simulation is running and can not restart the Simulation");124// $('#modal-siming').modal("show");125// return false;126// }127 if (runModel == 0) 128 {129 $('#sim-error-check').show();130 $('#sim-model').focus();131 return false;132 }133 if (runModel == 1) 134 {135 if (runTime == "") 136 {137 $('#timelimit').show();138 $('#sim-run-time').focus();139 return false;140 }141 if (runCount == "") 142 {143 $('#loopslimit').show();144 $('#sim-run-count').focus();145 return false;146 }147 if (type == "" || type == "fail") 148 {149 $('#sim-error-run').show();150 }151 else if (type == "success")152 {153 $('#sim-error-check').hide();154 $('#loopslimit').hide();155 $('#timelimit').hide();156 $('#sim-error-run').hide();157 window.location.href = "/Simualte?run=yes&distMode="+runModel+"&loadTime="+runTime+"&loopLimit="+runCount;158 }159 }160 else if (runModel == 2)161 {162 if (run_t_limit == "") 163 {164 $('#tlimit').show();165 $('#sim-run-t-limit').focus();166 return false;167 }168 if (run_opt_limit == "") 169 {170 $('#olimit').show();171 $('#sim-run-opt-limit').focus();172 return false;173 }174 175 176 if (type == "" || type == "fail")177 {178 $('#sim-error-run').show();179 }180 else if (type == "success")181 {182 $('#sim-error-check').hide();183 $('#timelimit').hide();184 $('#loopslimit').hide();185 $('#tlimit').hide();186 $('#olimit').hide();187 $('#sim-error-run').hide();188 window.location.href = "/Simualte?run=yes&distMode="+runModel+"&loadTime="+run_t_limit+"&loopLimit="+run_opt_limit;189 }190 191// $('#sim-error-check').hide();192// $('#timelimit').hide();193// $('#loopslimit').hide();194// $('#tlimit').hide();195// $('#olimit').hide();196// $('#sim-error-run').hide();197// window.location.href = "/Simualte?run=yes&distMode="+runModel+"&loadTime="+run_t_limit+"&loopLimit="+run_opt_limit;198 }199 200 });201 }202 203 })(),204 205 206 /**207 * Simualte.jsp =-= SimualteController208 * 209 */210 (function () {211 //获取地址栏中的数据函数212 var simStop = doc.getElementById("sim-stop");213 if (simStop) {214 var example = new Vue({215 el: '#sim-run-percent',216 data: {217 percent:""218 }219 });220 function UrlSearch() {221 var name,value; 222 var str=location.href; //取得整个地址栏223 var num=str.indexOf("?") 224 str=str.substr(num+1); //取得所有参数 stringvar.substr(start [, length ]225 226 var arr=str.split("&"); //各个参数放到数组里227 for(var i=0;i < arr.length;i++){ 228 num=arr[i].indexOf("="); 229 if(num>0){ 230 name=arr[i].substring(0,num);231 value=arr[i].substr(num+1);232 this[name]=value;233 } 234 } 235 };236 //实例化对象237 var Request=new UrlSearch(); //实例化238 var _distMode = Request.distMode;239 var _loadTime = Request.loadTime;240 var _loopLimit = Request.loopLimit;241 if (Request.run == "yes") {242 //alert("开始执行算法");243 //执行算法244 if(typeof(WebSocket) == "undefined") {245 alert("您的浏览器不支持WebSocket");246 return;247 }248 document.getElementById('sim-run-info').innerHTML="";249 ws = new SockJS("http://"+document.location.host+"/webSocketServer/sockjs");250 ws.onopen = function () {251 //log('Info: connection opened.');252 };253 254 ws.onmessage = function (event) {255 log(event.data);256 };257 ws.onclose = function (event) {258// log('Info: connection closed.');259// log(event);260 };261 262 $.post("/cascade/runSilumate",{"distMode":_distMode,"loadTime":_loadTime,"loopLimit":_loopLimit}).done(function(result){263 type = result;264 if(type == "success"){265 alert("run silumate success , please redirect to output!");266 }else{267 alert("run silumate fail , "+"error is :"+result);268 }269 ws.onclose();270 //console.log("success");271 }).fail(function(){272 alert("run silumate fail , please try again!");273 ws.onclose();274 //console.log("fail");275 });276 //停止算法277 $('#sim-stop').click(function () {278 $.post("/cascade/runSilumate").done(function (res){279 //console.log(res)280 if (res == "Simulating") {281 $('#modal-sim').find('.modal-body p').text("The Simulation is running and can not restart the Simulation");282 $('#modal-sim').modal("show");283 $('#modal-simdelBtn').click(function(){284 $('#modal-sim').modal("hide");285 });286 }else{287 $('#modal-sim').find('.modal-body p').text("Are you sure want to restart simulation?");288 $('#modal-sim').modal("show");289 $('#modal-simdelBtn').click(function () {290 $.get("/cascade/restartSilumate").done(function (res){291 if (res == "success") {292 $('#modal-sim').modal("hide");293 }else{294 $('#modal-sim').modal("hide");295 $('#modal-simfail').modal("show");296 }297 }).fail(function(){298 $('#modal-sim').modal("hide");299 $('#modal-simfail').modal("show");300 });301 302 });303 }304 }).fail(function (){305 $('#modal-sim').modal("hide");306 $('#modal-simfail').modal("show");307 })308 309 310 });311 function log(messages) {312 var _r = new RegExp("Waiting...");313 var consoleBox = document.getElementById('sim-run-info');314 var loadbardiv = document.getElementById('loadbardiv');315 if (_r.test(messages)) {316 consoleBox.appendChild(document.createTextNode(messages));317 loadbardiv.style.display="";318 }else{319 var p = document.createElement('p');320 p.style.wordWrap = 'break-word';321 p.appendChild(document.createTextNode(messages));322 consoleBox.appendChild(p);323 loadbardiv.style.display="none";324 }325 consoleBox.scrollTop = consoleBox.scrollHeight;326 var _r = /\%/;327 if (_r.test(messages)) {328 var i = messages.indexOf("%");329 var num = messages.substr(0,i);330 if (num == '99') {331 var res = messages.replace("99","100");332 example.percent = '('+res+')';333 $('#sim-percent').text('('+res+')');334 }else{335 example.percent = '('+messages+')';336 $('#sim-percent').text('('+messages+')');337 }338 loadbardiv.style.display="none";339 }340 }341 }342 343 344 }345 346 })()347 348 349 350 351 352 353 354 ...

Full Screen

Full Screen

home.controller.js

Source:home.controller.js Github

copy

Full Screen

1(function() {2 'use strict';3 angular4 .module("lpdmApp")5 .controller("homeController", homeController);6 homeController.$inject = ['$scope', '$state', '$stateParams', 'api', 'socket', 'data_stream'];7 function homeController($scope, $state, $stateParams, api, socket, data_stream){8 var ctrl = this;9 function SimTime(time_value, time_string){10 this.time_value = time_value;11 this.time_string = time_string;12 }13 function SimData(){14 this.times = [];15 this.runs = [];16 this.devices = [];17 }18 function SimDevice(device) {19 this.name = device;20 this.tags = [];21 }22 function SimTag(tag) {23 this.name = tag;24 this.runs = [];25 }26 function SimRun(run_id) {27 this.run_id = run_id;28 this.values = [];29 }30 function SimValue(sim_time, value) {31 this.sim_time = sim_time;32 this.value = value;33 }34 SimData.prototype.addLine = addLine;35 function addLine(line) {36 let self = this;37 // add the distinct times38 let sim_time = self.times.find((item) => item.time_value == line.time_value);39 if (!sim_time) {40 sim_time = new SimTime(line.time_value, line.time_string);41 self.times.push(sim_time);42 }43 // assign the sim_run44 let sim_run = self.runs.find((item) => item.run_id == line.run_id);45 if (!sim_run) {46 sim_run = new SimRun(line.run_id);47 self.runs.push(sim_run);48 }49 // add the device info50 let device = self.devices.find((item) => item.name == line.device);51 if (!device) {52 device = new SimDevice(line.device);53 self.devices.push(device);54 }55 // assign the tag56 let tag = device.tags.find((item) => item.name == line.tag);57 if (!tag) {58 tag = new SimTag(line.tag);59 device.tags.push(tag);60 }61 // assign the sim_run62 let sim_run_tag = tag.runs.find((item) => item.run_id == line.run_id);63 if (!sim_run_tag) {64 sim_run_tag = new SimRun(line.run_id);65 tag.runs.push(sim_run_tag);66 }67 // add the value68 let value = new SimValue(sim_time, line.value);69 sim_run_tag.values.push(value);70 }71 function TagView(device, tag){72 this.device = device;73 this.tag = tag;74 }75 ctrl.selected_tag_views = [];76 ctrl.toggleTagView = toggleTagView;77 ctrl.sim_data = new SimData();78 ctrl.initialized = false;79 ctrl.is_running = false;80 ctrl.progress = 0;81 ctrl.scenario = null;82 ctrl.scenario_list = null;83 ctrl.sim_run = null;84 ctrl.sim_run_list = [];85 ctrl.scenario = null;86 ctrl.scenario_list = [];87 ctrl.selected_run = [];88 ctrl.simulation_data = [];89 ctrl.side_nav_is_open = true;90 ctrl.showNav = showNav;91 ctrl.selectSimulationScenario = selectSimulationScenario;92 ctrl.runScenario = runScenario;93 ctrl.selectSimulationRun = selectSimulationRun;94 ctrl.tagIsSelected = tagIsSelected;95 //ctrl.getSimulationData = getSimulationData;96 ctrl.show_results = false;97 ctrl.data_grid = {98 enableSorting: false,99 enableRowSelection: false,100 enableSelectAll: false,101 showGridFooter: true,102 multiSelect: false,103 enableFiltering: true,104 columnDefs: [105 {106 name: 'time_string',107 displayName: 'Time',108 }, {109 name: 'time_value',110 displayName: 'Time',111 }, {112 name: 'device',113 displayName: 'Device',114 }, {115 name: 'tag',116 displayName: 'Tag',117 }, {118 name: 'value',119 displayName: 'Value',120 }121 ],122 data: ctrl.simulation_data,123 //onRegisterApi: function(gridApi){124 ////set gridApi on scope125 //gridApi.selection.on.rowSelectionChanged($scope,function(row){126 //var items = gridApi.selection.getSelectedRows();127 //if (items.length) {128 //$scope.selected_item = items[0];129 //}130 //else {131 //$scope.selected_item = null;132 //}133 //});134 //}135 };136 socket.on('connection', function(data){137 console.log('socket connected!!', data);138 });139 ctrl.selectDeviceTag = selectDeviceTag;140 // setup the array to handle the data from the websocket response141 //data_stream.subscribeToSimulationRun(6, receiveData, receiveError);142 socket.on('simulation_error', receiveError);143 socket.on('simulation_finish', simulationFinish);144 socket.on('simulation_data', receiveSimulationData);145 //socket.emit('subcribe_to_simulation', 6);146 //socket.emit('run_simulation', 'ac.json');147 socket.on('scenario_file', receiveSimulationScenarios);148 socket.emit('get_scenario_file');149 //socket.on('simulation_runs', receiveSimulationRuns);150 socket.on('simulation_runs', receiveSimulationRuns);151 socket.emit('get_simulation_runs');152 socket.on('remove_sim_run_success', removeSimulationRunSuccess);153 socket.on('remove_sim_run_error', removeSimulationRunError);154 ctrl.removeSimulationRun = removeSimulationRun;155 ctrl.initialized = true;156 //init();157 ////158 //159 function receiveSimulationData(data){160 console.log('receiveData', data);161 for(let item of data){162 ctrl.simulation_data.push(item);163 ctrl.sim_data.addLine(item);164 }165 console.log('sim data', ctrl.sim_data);166 //ctrl.response_data.push(data);167 }168 function receiveSimulationScenarios(data){169 console.log('scenarios...', data);170 for (const sr of data) {171 ctrl.scenario_list.push(sr);172 }173 }174 function receiveError(err){175 console.log('receiveError', err);176 }177 function simulationFinish(data){178 console.log('simulationFinish', data);179 }180 function receiveSimulationRuns(data){181 console.log('received simulation runs...', data, typeof data);182 if (Array.isArray(data)){183 for (const sr of data) {184 ctrl.sim_run_list.push(sr);185 }186 }187 else {188 ctrl.sim_run_list.splice(0, 0, data);189 ctrl.selected_run = data;190 ctrl.sim_run = data;191 }192 }193 function tagIsSelected(device, tag){194 // is the device/tag selected?195 // if so there is a TagView object with device & tag properties196 return ctrl.selected_tag_views.findIndex((item) => item.device == device && item.tag == tag) >= 0197 }198 function toggleTagView(device, tag){199 let index = ctrl.selected_tag_views.findIndex((item) => item.device == device && item.tag == tag);200 if (index == -1) {201 ctrl.selected_tag_views.push(new TagView(device, tag));202 }203 else {204 ctrl.selected_tag_views.splice(index, 1);205 }206 }207 function init() {208 console.log('sinit');209 //api.simulation_run.get().then(210 //function(results){211 //ctrl.sim_run_list = results;212 //ctrl.grid_options_run.data = results;213 //ctrl.initialized = true;214 //console.log("homeController test success", results);215 //},216 //function(err){217 //console.log('homeController Error', err);218 //}219 //)220 }221 function showNav(){222 ctrl.side_nav_is_open = !ctrl.side_nav_is_open;223 }224 function selectSimulationScenario(scenario){225 console.log('select scenario', scenario);226 ctrl.scenario = scenario;227 }228 function runScenario(scenario){229 /// run the selected scenario230 console.log('run_scenario', scenario);231 socket.emit('run_simulation', scenario.content);232 ctrl.is_running = true;233 }234 function selectSimulationRun(sim_run){235 ctrl.sim_run = sim_run;236 console.log('select simulation run', sim_run);237 //api.simulation_run_data.get(sim_run.id).then(238 //function(results){239 //console.log('results', results);240 //ctrl.sim_info = results;241 //},242 //function(err){243 //console.error('error', err);244 //}245 //);246 }247 function removeSimulationRun(sim_run){248 // remove simulation runs from the database249 console.log('remove simulation run', sim_run);250 socket.emit('remove_sim_run', sim_run);251 }252 function removeSimulationRunSuccess(sim_run){253 console.log('successfully removed run ', sim_run);254 if (sim_run == 'all'){255 ctrl.sim_run_list.splice(0, ctrl.sim_run_list.length);256 }257 else {258 let index = ctrl.sim_run_list.findIndex((d) => d.id == sim_run);259 if (index >= 0) {260 ctrl.sim_run_list.splice(index, 1);261 }262 }263 }264 function removeSimulationRunError(err){265 console.log('simulation run error', err);266 }267 //function getSimulationData(sim_run){268 //ctrl.sim_run = sim_run;269 //api.simulation_run_all_data.get(sim_run.id).then(270 //function(results){271 //console.log('results', results);272 ////ctrl.simulation_data = results;273 //},274 //function(err){275 //console.error('error', err);276 //}277 //);278 //}279 function selectDeviceTag(device, tag) {280 // select a tag for a device to show the results281 api.simulation_run_tag.get(ctrl.sim_run.id, device.device, tag.tag).then(282 function(results){283 console.log('get device tag data ', results);284 },285 function(err){286 console.log('error', err);287 }288 )289 }290 }...

Full Screen

Full Screen

sim.js

Source:sim.js Github

copy

Full Screen

...10}11function runsims(sim, numNodes, syncFreq, numSyncs, cb) {12 var done = multicb()13 var involvesConcurrency = (factorial(numNodes) != numSyncs || syncFreq != 1)14 sim.run(numNodes, syncFreq, numSyncs, { my_counter: 'counter' }, [15 ['inc', 'my_counter', 1],16 ['inc', 'my_counter', 1],17 ['inc', 'my_counter', 2],18 ['inc', 'my_counter', 1],19 ['inc', 'my_counter', 3],20 ['inc', 'my_counter', 1],21 ['inc', 'my_counter', 4],22 ['inc', 'my_counter', 1]23 ], { my_counter: 14 }, done())24 sim.run(numNodes, syncFreq, numSyncs, { my_counter: 'counter' }, [25 ['inc', 'my_counter', 1],26 ['dec', 'my_counter', 1],27 ['inc', 'my_counter', 2],28 ['inc', 'my_counter', 1],29 ['dec', 'my_counter', 3],30 ['inc', 'my_counter', 1],31 ['dec', 'my_counter', 4],32 ['inc', 'my_counter', 1]33 ], { my_counter: -2 }, done())34 sim.run(numNodes, syncFreq, numSyncs, { my_counterset: 'counterset' }, [35 ['inckey', 'my_counterset', 0, 1],36 ['inckey', 'my_counterset', 'a', 1],37 ['inckey', 'my_counterset', 0, 2],38 ['inckey', 'my_counterset', 'b', 1],39 ['inckey', 'my_counterset', 'a', 3],40 ['inckey', 'my_counterset', 0, 1],41 ['inckey', 'my_counterset', 'a', 4],42 ['inckey', 'my_counterset', 0, 1]43 ], { my_counterset: { 0: 5, a: 8, b: 1 } }, done())44 sim.run(numNodes, syncFreq, numSyncs, { my_counterset: 'counterset' }, [45 ['inckey', 'my_counterset', 0, 1],46 ['inckey', 'my_counterset', 'a', 1],47 ['deckey', 'my_counterset', 0, 2],48 ['deckey', 'my_counterset', 'b', 1],49 ['inckey', 'my_counterset', 'a', 3],50 ['inckey', 'my_counterset', 0, 1],51 ['deckey', 'my_counterset', 'a', 4],52 ['inckey', 'my_counterset', 0, 1]53 ], { my_counterset: { 0: 1, a: 0, b: -1 } }, done())54 sim.run(numNodes, syncFreq, numSyncs, { my_gset: 'growset' }, [55 ['add', 'my_gset', 1],56 ['add', 'my_gset', 1],57 ['add', 'my_gset', 2],58 ['add', 'my_gset', 1],59 ['add', 'my_gset', 3],60 ['add', 'my_gset', 1],61 ['add', 'my_gset', 4],62 ['add', 'my_gset', 1]63 ], { my_gset: [1, 2, 3, 4] }, done())64 sim.run(numNodes, syncFreq, numSyncs, { my_map: 'map' }, [65 ['setkey', 'my_map', 0, 0],66 ['setkey', 'my_map', 'a', 1],67 ['setkey', 'my_map', 'b', 2],68 ['setkey', 'my_map', 'c', 3]69 ], { my_map: { 0: 0, a: 1, b: 2, c: 3 } }, done())70 sim.run(numNodes, syncFreq, numSyncs, { my_map: 'map' }, [71 ['setkey', 'my_map', 0, 1],72 ['setkey', 'my_map', 'a', 1],73 ['setkey', 'my_map', 0, 2],74 ['setkey', 'my_map', 'b', 1],75 ['setkey', 'my_map', 'a', 3],76 ['setkey', 'my_map', 0, undefined],77 ['setkey', 'my_map', 'a', 4],78 ['setkey', 'my_map', 0, 1]79 ], (involvesConcurrency) ? true : { my_map: { 0: 1, a: 4, b: 1 } }, done())80 // if there's concurrency, just make sure it converges (the final state is unpredictable)81 sim.run(numNodes, syncFreq, numSyncs, { my_oset: 'onceset' }, [82 ['add', 'my_oset', 1],83 ['add', 'my_oset', 1],84 ['add', 'my_oset', 2],85 ['add', 'my_oset', 1],86 ['add', 'my_oset', 3],87 ['add', 'my_oset', 1],88 ['add', 'my_oset', 4],89 ['add', 'my_oset', 1]90 ], { my_oset: [1, 2, 3, 4] }, done())91 sim.run(numNodes, syncFreq, numSyncs, { my_oset: 'onceset' }, [92 ['add', 'my_oset', 1],93 ['rem', 'my_oset', 1],94 ['add', 'my_oset', 2],95 ['add', 'my_oset', 1],96 ['add', 'my_oset', 3],97 ['add', 'my_oset', 2],98 ['add', 'my_oset', 4],99 ['rem', 'my_oset', 3]100 ], (involvesConcurrency) ? true : { my_oset: [2, 4] }, done())101 // if there's concurrency, just make sure it converges (the final state is unpredictable)102 sim.run(numNodes, syncFreq, numSyncs, { my_reg: 'register' }, [103 ['set', 'my_reg', 1],104 ['set', 'my_reg', 1],105 ['set', 'my_reg', 2],106 ['set', 'my_reg', 1],107 ['set', 'my_reg', 3],108 ['set', 'my_reg', 1],109 ['set', 'my_reg', 4],110 ['set', 'my_reg', 1]111 ], (involvesConcurrency) ? true : { my_reg: 1 }, done())112 // if there's concurrency, just make sure it converges (the final state is unpredictable)113 sim.run(numNodes, syncFreq, numSyncs, { my_set: 'set' }, [114 ['add', 'my_set', 1],115 ['add', 'my_set', 1],116 ['add', 'my_set', 2],117 ['add', 'my_set', 1],118 ['add', 'my_set', 3],119 ['add', 'my_set', 1],120 ['add', 'my_set', 4],121 ['add', 'my_set', 1]122 ], { my_set: [1, 2, 3, 4] }, done())123 sim.run(numNodes, syncFreq, numSyncs, { my_set: 'set' }, [124 ['add', 'my_set', 1],125 ['rem', 'my_set', 1],126 ['add', 'my_set', 2],127 ['add', 'my_set', 1],128 ['add', 'my_set', 3],129 ['add', 'my_set', 2],130 ['add', 'my_set', 4],131 ['rem', 'my_set', 3]132 ], (involvesConcurrency) ? true : { my_set: [1, 2, 4] }, done())133 // if there's concurrency, just make sure it converges (the final state is unpredictable)134 done(cb)135}136module.exports = function(opts) {137 var dbs = [tutil.makedb(),tutil.makedb(),tutil.makedb()]...

Full Screen

Full Screen

robot-delivery.test.js

Source:robot-delivery.test.js Github

copy

Full Screen

...25 })26 describe('stepping through turns', () => {27 it('should step through 1 turn', () => {28 let sim = new Simulator('^^^^')29 sim.run(1)30 let botPosition = sim.robots[0].posX + ',' + sim.robots[0].posY31 assert.strictEqual(botPosition, '0,1')32 })33 it('should step through more turns then directions', () => {34 let sim = new Simulator('^^^^')35 sim.run(1000)36 let botPosition = sim.robots[0].posX + ',' + sim.robots[0].posY37 assert.strictEqual(botPosition, '0,4')38 })39 it('should step through all turns with 1 bot', () => {40 let sim = new Simulator('^<^<')41 sim.run()42 let robotToTest = 043 let botPosition = sim.robots[robotToTest].posX + ',' + sim.robots[robotToTest].posY44 assert.strictEqual(botPosition, '-2,2')45 })46 it('should step through all turns with 3 bot', () => {47 let sim = new Simulator('^<^<', 3)48 sim.run()49 let robotToTest = 250 let botPosition = sim.robots[robotToTest].posX + ',' + sim.robots[robotToTest].posY51 assert.strictEqual(botPosition, '0,1')52 })53 it('should step through all turns with more bots then turns', () => {54 let sim = new Simulator('^<^<', 5)55 sim.run()56 let robotToTest = 457 let botPosition = sim.robots[robotToTest].posX + ',' + sim.robots[robotToTest].posY58 assert.strictEqual(botPosition, '0,0')59 robotToTest = 060 botPosition = sim.robots[robotToTest].posX + ',' + sim.robots[robotToTest].posY61 assert.strictEqual(botPosition, '0,1')62 })63 })64 describe('checking positions of robots', () => {65 it('should return position of all robots when there is 1 robot', () => {66 let sim = new Simulator('^^^^', 1)67 sim.run()68 assert.strictEqual(sim.getPositions().length, 1)69 assert.strictEqual(sim.getPositions()[0].posX, 0)70 assert.strictEqual(sim.getPositions()[0].posY, 4)71 })72 it('should return position of all robots without running sim', () => {73 let sim = new Simulator('^^^^', 30)74 assert.strictEqual(sim.getPositions().length, 30)75 assert.strictEqual(sim.getPositions()[3].posX, 0)76 assert.strictEqual(sim.getPositions()[3].posY, 0)77 })78 it('should return position of all robots after running threw turns', () => {79 let sim = new Simulator('^^^^', 30)80 sim.run()81 assert.strictEqual(sim.getPositions().length, 30)82 assert.strictEqual(sim.getPositions()[3].posX, 0)83 assert.strictEqual(sim.getPositions()[3].posY, 1)84 })85 })86 describe('query houses with n number of deliveries', () => {87 it('0 deliveries', () => {88 let sim = new Simulator('^^^^', 1)89 sim.run()90 assert.strictEqual(sim.getHousesWithDeliveries(0).length, 1)91 })92 it('1 delivery', () => {93 let sim = new Simulator('^^^^', 1)94 sim.run()95 assert.strictEqual(sim.getHousesWithDeliveries(1).length, 4)96 })97 it('5 deliveries', () => {98 let sim = new Simulator('^^^^^')99 sim.run()100 assert.strictEqual(sim.getHousesWithDeliveries(5).length, 0)101 })102 it('6000 (too high so should return none)', () => {103 let sim = new Simulator('^^^^', 6)104 sim.run()105 assert.strictEqual(sim.getHousesWithDeliveries(6000).length, 0)106 })107 })108 describe('get total sum of deliveries', () => {109 it('expecting 1 delivery', () => {110 let sim = new Simulator('^', 5)111 sim.run()112 assert.strictEqual(sim.getDeliveriesSum(), 1)113 })114 it('expecting 5 deliveries', () => {115 let sim = new Simulator('^<^V<<^V', 5)116 sim.run()117 assert.strictEqual(sim.getDeliveriesSum(), 5)118 })119 it('expecting 38 deliveries', () => {120 let sim = new Simulator('^<^V>^>><V>^<V>^<>V<>^>V<^>^<>^<V>><^<^^^<>V<^>^VVVV', 10)121 sim.run()122 assert.strictEqual(sim.getDeliveriesSum(), 38)123 })124 it('expecting 52 deliveries', () => {125 let sim = new Simulator('^<^V>^>><V>^<V>^<>V<>^>V<^>^<>^<V>><^<^^^<>V<^>^VVVV', 2)126 sim.run()127 assert.strictEqual(sim.getDeliveriesSum(), 52)128 })129 })130 describe('run sim through entire sequence', () => {131 it('with 1 robot', () => {132 let sim = new Simulator('^^^^', 1)133 sim.run()134 assert.strictEqual(sim.robots[0].deliveries.length, 4)135 })136 it('so 1 bot moves twice', () => {137 let sim = new Simulator('^^^^', 3)138 sim.run()139 assert.strictEqual(sim.robots[0].deliveries.length, 2)140 })141 it('with more robots then moves', () => {142 let sim = new Simulator('^^^^', 6)143 sim.run()144 assert.strictEqual(sim.stepsCompleted, 4)145 })146 })...

Full Screen

Full Screen

simulation_runs.js

Source:simulation_runs.js Github

copy

Full Screen

1var pool = require('../database');2module.exports = (socket) => {3 socket.on('get_sim_run_log', (id) => sendSimulationRunLog(socket, id));4 socket.on('get_simulation_runs', () => sendSimulationRuns(socket));5 socket.on('remove_sim_run', (sim_run) => removeSimulationRun(socket, sim_run));6}7function sendSimulationRunLog(socket, id){8 // emit the list of simulation runs9 pool.connect(function(err, client, done) {10 let query = `11 select run_id, id, device, message, tag, value, time_value, time_string12 from public.sim_log as l13 where run_id = $114 and device is not null15 and tag is not null16 `;17 let params = [id];18 client.query(query, params, function(err, result) {19 //call `done(err)` to release the client back to the pool (or destroy it if there is an error)20 done(err);21 if(err) {22 console.log(err);23 socket.emit("sim_run_log_error", err);24 }25 else{26 socket.emit("sim_run_log_success", result.rows);27 }28 });29 });30}31function sendSimulationRuns(socket){32 // emit the list of simulation runs33 pool.connect(function(err, client, done) {34 let query = `35 select id, to_char(time_stamp, 'YYYY-MM-DD HH24:MI') as time_stamp36 from public.sim_run order by time_stamp desc37 `;38 client.query(query, null, function(err, result) {39 //call `done(err)` to release the client back to the pool (or destroy it if there is an error)40 done(err);41 if(err) {42 console.log(err);43 socket.emit("simulation_run_error", err);44 }45 else{46 socket.emit("simulation_runs", result.rows);47 }48 });49 });50}51function removeSimulationRun(socket, sim_run){52 console.log(`remove simulation run ${ sim_run }`);53 pool.connect(function(err, client, done) {54 if (err){55 console.log(err);56 socket.emit("remove_sim_run_error", err);57 done(err);58 }59 else {60 removeSimLog(socket, sim_run, {client: client, done: done});61 }62 });63}64function removeSimLog(socket, sim_run, pg){65 var query = null;66 var params = null;67 if (sim_run == 'all') {68 query = `truncate table sim_log`;69 }70 else {71 query = `delete from sim_log where run_id = $1`;72 params = [+sim_run];73 console.log('delete');74 console.log(params);75 }76 console.log(query);77 pg.client.query(query, params, function(err, result) {78 if (err){79 console.log(err);80 socket.emit("remove_sim_run_error", err);81 pg.done(err);82 }83 else {84 console.log('removeSimRun');85 removeSimRun(socket, sim_run, pg);86 }87 });88}89function removeSimRun(socket, sim_run, pg) {90 var query = null;91 var params = null;92 if (sim_run == 'all') {93 query = `delete from sim_run`;94 }95 else {96 query = `delete from sim_run where id = $1`;97 params = [+sim_run];98 }99 console.log(query);100 pg.client.query(query, params, function(err, result) {101 pg.done(err);102 if (err){103 console.log(err);104 socket.emit("remove_sim_run_error", err);105 }106 else {107 console.log('done');108 socket.emit("remove_sim_run_success", sim_run);109 }110 });...

Full Screen

Full Screen

classdesmoj_1_1core_1_1util_1_1_sim_run_event.js

Source:classdesmoj_1_1core_1_1util_1_1_sim_run_event.js Github

copy

Full Screen

1var classdesmoj_1_1core_1_1util_1_1_sim_run_event =2[3 [ "SimRunEvent", "classdesmoj_1_1core_1_1util_1_1_sim_run_event.html#a6417d0afb6dc44517874b52bf1bfe430", null ],4 [ "getCurrentTime", "classdesmoj_1_1core_1_1util_1_1_sim_run_event.html#a8d0cd2d00369e0faa7c85a785395c329", null ],5 [ "getExperiment", "classdesmoj_1_1core_1_1util_1_1_sim_run_event.html#abe28688a56ceb160ea2d52e2cd13e9ca", null ],6 [ "getModel", "classdesmoj_1_1core_1_1util_1_1_sim_run_event.html#af50a477613e1b8dad55189aa1c14364f", null ],7 [ "getSimTime", "classdesmoj_1_1core_1_1util_1_1_sim_run_event.html#a3e0b66fa84bd97c6538711f6397d8d9b", null ]...

Full Screen

Full Screen

functions_5.js

Source:functions_5.js Github

copy

Full Screen

1var searchData=2[3 ['run',['run',['../classtb__alu_1_1sim.html#a0f40b896b2461e250ebafd4e27b8ff54',1,'tb_alu.sim.run()'],['../classtb__calc__ctrl_1_1sim.html#a0f40b896b2461e250ebafd4e27b8ff54',1,'tb_calc_ctrl.sim.run()'],['../classtb__calc__top_1_1sim.html#a0f40b896b2461e250ebafd4e27b8ff54',1,'tb_calc_top.sim.run()'],['../classtb__io__ctrl_1_1sim.html#a0f40b896b2461e250ebafd4e27b8ff54',1,'tb_io_ctrl.sim.run()']]]...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .then(function () {9 return this.setImplicitWaitTimeout(5000);10 })11 .then(function () {12 return this.execute('mobile: simctl', {13 args: {14 }15 });16 })17 .then(function () {18 return this.execute('mobile: simctl', {19 args: {20 env: {21 },22 'options': {23 },24 'process-arguments': {25 },26 }27 });28 })29 .then(function () {30 return this.execute('mobile: simctl', {31 args: {32 }33 });34 })35 .then(function () {36 return this.execute('mobile: simctl', {37 args: {38 env: {39 },40 'options': {41 },42 'process-arguments': {

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var simctl = require('node-simctl');3var driver = new webdriver.Builder()4 .withCapabilities({5 })6 .build();7driver.sleep(5000).then(function() {8 driver.quit();9});10simctl.run({11}, function(err, sim) {12 if (err) {13 console.log(err);14 return;15 }16 sim.run('test.js');17});

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var sim = require('appium-xcuitest-driver').simctl;3var driver = new webdriver.Builder()4 .withCapabilities({5 })6 .build();7 .then(function() {8 return sim.run({9 env: {env1: 'env1', env2: 'env2'}10 });11 })12 .then(function() {13 })14 .catch(function(err) {15 console.log(err);16 })17 .finally(function() {18 driver.quit();19 });20var webdriver = require('selenium-webdriver');21var sim = require('appium-xcuitest-driver').simctl;22var driver = new webdriver.Builder()23 .withCapabilities({24 })25 .build();26 .then(function() {27 return sim.install({28 });29 })30 .then(function() {31 })32 .catch(function(err) {33 console.log(err);34 })35 .finally(function() {36 driver.quit();37 });38var webdriver = require('selenium-webdriver');39var sim = require('appium-xcuitest-driver').simctl;40var driver = new webdriver.Builder()41 .withCapabilities({42 })43 .build();

Full Screen

Using AI Code Generation

copy

Full Screen

1var sim = require('node-simctl');2sim.run('com.apple.Preferences', 'com.apple.Preferences', function(err, res) {3 if (err) {4 console.log(err);5 } else {6 console.log(res);7 }8});9var sim = require('node-simctl');10sim.run('com.apple.Preferences', 'com.apple.Preferences', function(err, res) {11 if (err) {12 console.log(err);13 } else {14 console.log(res);15 }16});17var sim = require('node-simctl');18sim.run('com.apple.Preferences', 'com.apple.Preferences', function(err, res) {19 if (err) {20 console.log(err);21 } else {22 console.log(res);23 }24});25var sim = require('node-simctl');26sim.run('com.apple.Preferences', 'com.apple.Preferences', function(err, res) {27 if (err) {28 console.log(err);29 } else {30 console.log(res);31 }32});33var sim = require('node-simctl');34sim.run('com.apple.Preferences', 'com.apple.Preferences', function(err, res) {35 if (err) {36 console.log(err);37 } else {38 console.log(res);39 }40});41var sim = require('node-simctl');42sim.run('com.apple.Preferences', 'com.apple.Preferences', function(err, res) {43 if (err) {44 console.log(err);45 } else {46 console.log(res);47 }48});49var sim = require('node-simctl');50sim.run('com.apple.Preferences', 'com.apple.Preferences', function(err, res) {51 if (err) {52 console.log(err);53 } else {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { run } = require('appium-xcuitest-driver');2const args = {3};4run(args);5const driver = run(args);6driver.findElement('accessibility id', 'test').click();7driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1const sim = require('appium-ios-simulator');2const driver = new sim.SimulatorXCUITestDriver();3driver.run({udid: 'xxx', app: 'xxx'});4const sim = require('appium-ios-simulator');5const driver = new sim.SimulatorXCUITestDriver();6driver.run({udid: 'xxx', app: 'xxx'});7const sim = require('appium-ios-simulator');8const driver = new sim.SimulatorXCUITestDriver();9driver.run({udid: 'xxx', app: 'xxx'});10const sim = require('appium-ios-simulator');11const driver = new sim.SimulatorXCUITestDriver();12driver.run({udid: 'xxx', app: 'xxx'});13const sim = require('appium-ios-simulator');14const driver = new sim.SimulatorXCUITestDriver();15driver.run({udid: 'xxx', app: 'xxx'});16const sim = require('appium-ios-simulator');17const driver = new sim.SimulatorXCUITestDriver();18driver.run({udid: 'xxx', app: 'xxx'});19const sim = require('appium-ios-simulator');20const driver = new sim.SimulatorXCUITestDriver();21driver.run({udid: 'xxx', app: 'xxx'});22const sim = require('appium-ios-simulator');23const driver = new sim.SimulatorXCUITestDriver();24driver.run({udid: 'xxx', app: 'xxx'});25const sim = require('appium-ios-simulator

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

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

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful