Best JavaScript code snippet using appium
test_common.js
Source:test_common.js
...66 test_name === "test_context" ||67 test_name === "test_context_no_arg"68 ) {69 return this.terminal70 .executeCommand("context", false, true)71 .then((context) => {72 this._orig_context = context;73 });74 } else if (75 test_name === "test_upgrade" ||76 test_name === "test_upgrade__no_arg"77 ) {78 return this.terminal.executeCommand(79 "install -m sms",80 false,81 true82 );83 } else if (84 test_name === "test_uninstall" ||85 test_name === "test_uninstall__no_arg"86 ) {87 return this.terminal.executeCommand(88 "install -m sms",89 false,90 true91 );92 }93 });94 },95 onAfterTest: function (test_name) {96 const def = this._super.apply(this, arguments);97 return def.then(() => {98 if (99 test_name === "test_context" ||100 test_name === "test_context_no_arg"101 ) {102 return this.terminal.executeCommand(103 `context -o set -v '${JSON.stringify(104 this._orig_context105 )}'`,106 false,107 true108 );109 } else if (110 test_name === "test_upgrade" ||111 test_name === "test_upgrade__no_arg"112 ) {113 return this.terminal.executeCommand(114 "uninstall -m sms",115 false,116 true117 );118 }119 });120 },121 test_create: async function () {122 await this.terminal.executeCommand(123 "create -m res.partner.industry",124 false,125 true126 );127 await new Promise((resolve) => setTimeout(resolve, 800));128 this.assertTrue(this.isFormOpen());129 const record_id = await this.terminal.executeCommand(130 `create -m res.partner.industry -v "{'name': '${_.uniqueId(131 "This is a Test #"132 )}'}"`,133 false,134 true135 );136 this.assertTrue(record_id > 0);137 },138 test_create__no_arg: async function () {139 await this.terminal.executeCommand(140 "create res.partner.industry",141 false,142 true143 );144 await new Promise((resolve) => setTimeout(resolve, 800));145 this.assertTrue(this.isFormOpen());146 const record_id = await this.terminal.executeCommand(147 `create res.partner.industry "{'name': '${_.uniqueId(148 "This is a Test #"149 )}'}"`,150 false,151 true152 );153 this.assertTrue(record_id > 0);154 },155 test_unlink: async function () {156 const record_id = await this.terminal.executeCommand(157 `create -m res.partner.industry -v "{'name': '${_.uniqueId(158 "This is a Test #"159 )}'}"`,160 false,161 true162 );163 const res = await this.terminal.executeCommand(164 `unlink -m res.partner.industry -i ${record_id}`,165 false,166 true167 );168 this.assertTrue(res);169 },170 test_unlink__no_arg: async function () {171 const record_id = await this.terminal.executeCommand(172 `create res.partner.industry "{'name': '${_.uniqueId(173 "This is a Test #"174 )}'}"`,175 false,176 true177 );178 const res = await this.terminal.executeCommand(179 `unlink res.partner.industry ${record_id}`,180 false,181 true182 );183 this.assertTrue(res);184 },185 test_write: async function () {186 const record_a_id = await this.terminal.executeCommand(187 `create -m res.partner.industry -v "{'name': '${_.uniqueId(188 "This is a Test #"189 )}'}"`,190 false,191 true192 );193 const record_b_id = await this.terminal.executeCommand(194 `create -m res.partner.industry -v "{'name': '${_.uniqueId(195 "This is a Test #"196 )}'}"`,197 false,198 true199 );200 let res = await this.terminal.executeCommand(201 `write -m res.partner.industry -i ${record_b_id} -v "{'name': '${_.uniqueId(202 "Other name Test #"203 )}'}"`,204 false,205 true206 );207 this.assertTrue(res);208 res = await this.terminal.executeCommand(209 `write -m res.partner.industry -i "${record_a_id}, ${record_b_id}" -v "{'name': '${_.uniqueId(210 "Other name Test #"211 )}'}"`,212 false,213 true214 );215 this.assertTrue(res);216 },217 test_write__no_arg: async function () {218 const record_a_id = await this.terminal.executeCommand(219 `create -m res.partner.industry -v "{'name': '${_.uniqueId(220 "This is a Test #"221 )}'}"`,222 false,223 true224 );225 const record_b_id = await this.terminal.executeCommand(226 `create res.partner.industry "{'name': '${_.uniqueId(227 "This is a Test #"228 )}'}"`,229 false,230 true231 );232 let res = await this.terminal.executeCommand(233 `write res.partner.industry ${record_b_id} "{'name': '${_.uniqueId(234 "Other name Test #"235 )}'}"`,236 false,237 true238 );239 this.assertTrue(res);240 res = await this.terminal.executeCommand(241 `write res.partner.industry "${record_a_id}, ${record_b_id}" "{'name': '${_.uniqueId(242 "Other name Test #"243 )}'}"`,244 false,245 true246 );247 this.assertTrue(res);248 },249 test_search: async function () {250 const res = await this.terminal.executeCommand(251 "search -m res.partner.industry -f name -d \"[['id', '>', 1]]\" -l 3 -of 2 -o \"id desc\"",252 false,253 true254 );255 this.assertEqual(res.length, 3);256 },257 test_search__no_arg: async function () {258 const res = await this.terminal.executeCommand(259 "search res.partner.industry name \"[['id', '>', 1]]\" 4 2 \"id desc\"",260 false,261 true262 );263 this.assertEqual(res.length, 4);264 },265 test_call: async function () {266 const res = await this.terminal.executeCommand(267 "call -m res.partner -c can_edit_vat -a [1]",268 false,269 true270 );271 this.assertTrue(res);272 },273 test_call__no_arg: async function () {274 const res = await this.terminal.executeCommand(275 "call res.partner can_edit_vat [1]",276 false,277 true278 );279 this.assertTrue(res);280 },281 test_upgrade: async function () {282 await Utils.asyncSleep(6000);283 const res = await this.terminal.executeCommand(284 "upgrade -m sms",285 false,286 true287 );288 this.assertEqual(res[0]?.name, "sms");289 await Utils.asyncSleep(6000);290 },291 test_upgrade__no_arg: async function () {292 await Utils.asyncSleep(6000);293 const res = await this.terminal.executeCommand(294 "upgrade sms",295 false,296 true297 );298 await Utils.asyncSleep(6000);299 this.assertEqual(res[0]?.name, "sms");300 },301 test_install: async function () {302 await Utils.asyncSleep(6000);303 const res = await this.terminal.executeCommand(304 "install -m sms",305 false,306 true307 );308 await Utils.asyncSleep(6000);309 this.assertEqual(res[0]?.name, "sms");310 },311 test_install__no_arg: async function () {312 await Utils.asyncSleep(6000);313 const res = await this.terminal.executeCommand(314 "install sms",315 false,316 true317 );318 await Utils.asyncSleep(6000);319 this.assertEqual(res[0]?.name, "sms");320 },321 test_uninstall: async function () {322 await Utils.asyncSleep(6000);323 const res = await this.terminal.executeCommand(324 "uninstall -m sms",325 false,326 true327 );328 await Utils.asyncSleep(6000);329 this.assertEqual(res[0]?.name, "sms");330 },331 test_uninstall__no_arg: async function () {332 await Utils.asyncSleep(6000);333 const res = await this.terminal.executeCommand(334 "uninstall sms",335 false,336 true337 );338 await Utils.asyncSleep(6000);339 this.assertEqual(res[0]?.name, "sms");340 },341 test_action: async function () {342 let res = await this.terminal.executeCommand(343 "action -a 5",344 false,345 true346 );347 this.assertEqual(res.id, 5);348 if (this.terminal._mode === this.terminal.MODES.BACKEND_NEW) {349 res = await this.terminal.executeCommand(350 "action -a base.action_res_company_form",351 false,352 true353 );354 this.assertEqual(res.id, "base.action_res_company_form");355 res = await this.terminal.executeCommand(356 "action -a \"{'type': 'ir.actions.act_window', 'res_model': 'res.currency', 'view_type': 'form', 'view_mode': 'form', 'views': [[false, 'form']], 'target': 'current', 'res_id': 1}\"",357 false,358 true359 );360 this.assertNotEmpty(res);361 } else {362 res = await this.terminal.executeCommand(363 "action -a base.action_res_company_form",364 false,365 true366 );367 this.assertEqual(res.xml_id, "base.action_res_company_form");368 res = await this.terminal.executeCommand(369 "action -a \"{'type': 'ir.actions.act_window', 'res_model': 'res.currency', 'view_type': 'form', 'view_mode': 'form', 'views': [[false, 'form']], 'target': 'current', 'res_id': 1}\"",370 false,371 true372 );373 this.assertEqual(res.res_model, "res.currency");374 this.assertEqual(res.res_id, 1);375 }376 },377 test_action__no_arg: async function () {378 let res = await this.terminal.executeCommand(379 "action 5",380 false,381 true382 );383 this.assertEqual(res.id, 5);384 if (this.terminal._mode === this.terminal.MODES.BACKEND_NEW) {385 res = await this.terminal.executeCommand(386 "action base.action_res_company_form",387 false,388 true389 );390 this.assertEqual(res.id, "base.action_res_company_form");391 res = await this.terminal.executeCommand(392 "action \"{'type': 'ir.actions.act_window', 'res_model': 'res.currency', 'view_type': 'form', 'view_mode': 'form', 'views': [[false, 'form']], 'target': 'current', 'res_id': 1}\"",393 false,394 true395 );396 this.assertNotEmpty(res);397 } else {398 res = await this.terminal.executeCommand(399 "action base.action_res_company_form",400 false,401 true402 );403 this.assertEqual(res.xml_id, "base.action_res_company_form");404 res = await this.terminal.executeCommand(405 "action \"{'type': 'ir.actions.act_window', 'res_model': 'res.currency', 'view_type': 'form', 'view_mode': 'form', 'views': [[false, 'form']], 'target': 'current', 'res_id': 1}\"",406 false,407 true408 );409 this.assertEqual(res.res_model, "res.currency");410 this.assertEqual(res.res_id, 1);411 }412 },413 test_whoami: async function () {414 const res = await this.terminal.executeCommand(415 "whoami",416 false,417 true418 );419 this.assertEqual(res[0]?.login, "admin");420 },421 test_caf: async function () {422 const res = await this.terminal.executeCommand(423 "caf -m res.currency -f symbol -fi \"{'required': true}\"",424 false,425 true426 );427 this.assertNotEmpty(res.symbol);428 this.assertEmpty(res.id);429 },430 test_caf__no_arg: async function () {431 const res = await this.terminal.executeCommand(432 "caf res.currency symbol \"{'required': true}\"",433 false,434 true435 );436 this.assertNotEmpty(res.symbol);437 this.assertEmpty(res.id);438 },439 test_cam: async function () {440 let res = await this.terminal.executeCommand(441 "cam -m res.currency -o create",442 false,443 true444 );445 this.assertTrue(res);446 res = await this.terminal.executeCommand(447 "cam -m res.currency -o unlink",448 false,449 true450 );451 this.assertTrue(res);452 res = await this.terminal.executeCommand(453 "cam -m res.currency -o write",454 false,455 true456 );457 this.assertTrue(res);458 res = await this.terminal.executeCommand(459 "cam -m res.currency -o read",460 false,461 true462 );463 this.assertTrue(res);464 },465 test_cam__no_arg: async function () {466 const res = await this.terminal.executeCommand(467 "cam res.currency create",468 false,469 true470 );471 this.assertTrue(res);472 },473 test_lastseen: async function () {474 // Only test that can be called475 await this.terminal.executeCommand("lastseen", false, true);476 },477 test_read: async function () {478 const res = await this.terminal.executeCommand(479 "read -m res.currency -i 1 -f symbol",480 false,481 true482 );483 this.assertEqual(res[0]?.id, 1);484 this.assertNotEmpty(res[0]?.symbol);485 this.assertEmpty(res[0]?.display_name);486 },487 test_read__no_arg: async function () {488 const res = await this.terminal.executeCommand(489 "read res.currency 1 symbol",490 false,491 true492 );493 this.assertEqual(res[0]?.id, 1);494 this.assertNotEmpty(res[0]?.symbol);495 this.assertEmpty(res[0]?.display_name);496 },497 test_context: async function () {498 let res = await this.terminal.executeCommand(499 "context",500 false,501 true502 );503 this.assertIn(res, "uid");504 res = await this.terminal.executeCommand(505 "context -o read",506 false,507 true508 );509 this.assertIn(res, "uid");510 // At the moment operations with the context are not possible in legacy mode511 if (this.terminal._mode !== this.terminal.MODES.BACKEND_NEW) {512 res = await this.terminal.executeCommand(513 "context -o write -v \"{'test_key': 'test_value'}\"",514 false,515 true516 );517 this.assertIn(res, "test_key");518 res = await this.terminal.executeCommand(519 "context -o set -v \"{'test_key': 'test_value_change'}\"",520 false,521 true522 );523 this.assertEqual(res.test_key, "test_value_change");524 res = await this.terminal.executeCommand(525 "context -o delete -v test_key",526 false,527 true528 );529 this.assertNotIn(res, "test_key");530 }531 },532 test_context__no_arg: async function () {533 let res = await this.terminal.executeCommand(534 "context read",535 false,536 true537 );538 this.assertIn(res, "uid");539 // At the moment operations with the context are not possible in legacy mode540 if (this.terminal._mode !== this.terminal.MODES.BACKEND_NEW) {541 res = await this.terminal.executeCommand(542 "context write \"{'test_key': 'test_value'}\"",543 false,544 true545 );546 this.assertIn(res, "test_key");547 res = await this.terminal.executeCommand(548 "context set \"{'test_key': 'test_value_change'}\"",549 false,550 true551 );552 this.assertEqual(res.test_key, "test_value_change");553 res = await this.terminal.executeCommand(554 "context delete test_key",555 false,556 true557 );558 this.assertNotIn(res, "test_key");559 }560 },561 test_version: async function () {562 const res = await this.terminal.executeCommand(563 "version",564 false,565 true566 );567 this.assertTrue(res);568 },569 test_longpolling: async function () {570 let res = await this.terminal.executeCommand(571 "longpolling -o verbose",572 false,573 true574 );575 this.assertTrue(res);576 res = await this.terminal.executeCommand(577 "longpolling -o off",578 false,579 true580 );581 this.assertTrue(res);582 res = await this.terminal.executeCommand(583 "longpolling -o add_channel -p test_channel",584 false,585 true586 );587 this.assertTrue(res);588 res = await this.terminal.executeCommand(589 "longpolling -o del_channel -p test_channel",590 false,591 true592 );593 this.assertTrue(res);594 res = await this.terminal.executeCommand(595 "longpolling -o stop",596 false,597 true598 );599 this.assertTrue(res);600 res = await this.terminal.executeCommand(601 "longpolling -o start",602 false,603 true604 );605 this.assertTrue(res);606 },607 test_longpolling__no_arg: async function () {608 let res = await this.terminal.executeCommand(609 "longpolling verbose",610 false,611 true612 );613 this.assertTrue(res);614 res = await this.terminal.executeCommand(615 "longpolling off",616 false,617 true618 );619 this.assertTrue(res);620 res = await this.terminal.executeCommand(621 "longpolling add_channel test_channel",622 false,623 true624 );625 this.assertTrue(res);626 res = await this.terminal.executeCommand(627 "longpolling del_channel test_channel",628 false,629 true630 );631 this.assertTrue(res);632 res = await this.terminal.executeCommand(633 "longpolling stop",634 false,635 true636 );637 this.assertTrue(res);638 res = await this.terminal.executeCommand(639 "longpolling start",640 false,641 true642 );643 this.assertTrue(res);644 },645 _isLogin: async function (login) {646 const res = await this.terminal.executeCommand(647 "whoami",648 false,649 true650 );651 return res[0]?.login === login;652 },653 test_login: async function () {654 // Get active database655 // FIXME: This type of calls are ugly, maybe some day656 // can scan the dependencies.657 let res = await this.terminal.executeCommand(658 "dblist --only-active",659 false,660 true661 );662 const dbname = res;663 res = await this.terminal.executeCommand(664 `login -d ${dbname} -u demo -p demo`,665 false,666 true667 );668 this.assertTrue(res);669 this.assertTrue(this._isLogin("demo"));670 res = await this.terminal.executeCommand(671 `login -d ${dbname} -u #admin`,672 false,673 true674 );675 this.assertTrue(res);676 this.assertTrue(this._isLogin("admin"));677 },678 test_login__no_arg: async function () {679 // Get active database680 // FIXME: This type of calls are ugly, maybe some day681 // can scan the dependencies.682 let res = await this.terminal.executeCommand(683 "dblist --only-active",684 false,685 true686 );687 const dbname = res;688 res = await this.terminal.executeCommand(689 `login ${dbname} demo demo`,690 false,691 true692 );693 this.assertTrue(res);694 this.assertTrue(this._isLogin("demo"));695 res = await this.terminal.executeCommand(696 `login ${dbname} #admin`,697 false,698 true699 );700 this.assertTrue(res);701 this.assertTrue(this._isLogin("admin"));702 },703 test_uhg: async function () {704 const res = await this.terminal.executeCommand(705 "uhg -g base.group_user",706 false,707 true708 );709 this.assertTrue(res);710 },711 test_uhg__no_arg: async function () {712 const res = await this.terminal.executeCommand(713 "uhg base.group_user",714 false,715 true716 );717 this.assertTrue(res);718 },719 test_dblist: async function () {720 let res = await this.terminal.executeCommand("dblist", false, true);721 this.assertNotEmpty(res);722 res = await this.terminal.executeCommand(723 "dblist --only-active",724 false,725 true726 );727 this.assertTrue(typeof res === "string");728 },729 test_tour: async function () {730 // This test is incomplete to avoid page reloads731 const res = await this.terminal.executeCommand("tour", false, true);732 this.assertNotEmpty(res);733 },734 test_json: async function () {735 const res = await this.terminal.executeCommand(736 "json -e /web_editor/get_assets_editor_resources -d \"{'key':'web.assets_backend'}\"",737 false,738 true739 );740 this.assertIn(res, "views");741 },742 test_json__no_arg: async function () {743 const res = await this.terminal.executeCommand(744 "json /web_editor/get_assets_editor_resources \"{'key':'web.assets_backend'}\"",745 false,746 true747 );748 this.assertIn(res, "views");749 },750 test_depends: async function () {751 const res = await this.terminal.executeCommand(752 "depends -m mail",753 false,754 true755 );756 this.assertNotEmpty(res);757 },758 test_depends__no_arg: async function () {759 const res = await this.terminal.executeCommand(760 "depends mail",761 false,762 true763 );764 this.assertNotEmpty(res);765 },766 test_ual: async function () {767 const res = await this.terminal.executeCommand("ual", false, true);768 this.assertTrue(res);769 },770 test_count: async function () {771 const res = await this.terminal.executeCommand(772 "count -m res.currency",773 false,774 true775 );776 this.assertTrue(res > 0);777 const resb = await this.terminal.executeCommand(778 "count -m res.currency -d \"[['symbol', '=', '$']]\"",779 false,780 true781 );782 this.assertTrue(resb < res);783 },784 test_count__no_arg: async function () {785 const res = await this.terminal.executeCommand(786 "count res.currency",787 false,788 true789 );790 this.assertTrue(res > 0);791 const resb = await this.terminal.executeCommand(792 "count res.currency \"[['symbol', '=', '$']]\"",793 false,794 true795 );796 this.assertTrue(resb < res);797 },798 test_ref: async function () {799 const res = await this.terminal.executeCommand(800 "ref -x base.main_company,base.model_res_partner",801 false,802 true803 );804 this.assertNotEmpty(res);805 this.assertEqual(res.length, 2);806 },807 test_ref__no_arg: async function () {808 const res = await this.terminal.executeCommand(809 "ref base.main_company,base.model_res_partner",810 false,811 true812 );813 this.assertNotEmpty(res);814 this.assertEqual(res.length, 2);815 },816 test_rpc: async function () {817 const res = await this.terminal.executeCommand(818 "rpc -o \"{'route': '/jsonrpc', 'method': 'server_version', 'params': {'service': 'db'}}\"",819 false,820 true821 );822 this.assertNotEmpty(res);823 },824 test_rpc__no_arg: async function () {825 const res = await this.terminal.executeCommand(826 "rpc \"{'route': '/jsonrpc', 'method': 'server_version', 'params': {'service': 'db'}}\"",827 false,828 true829 );830 this.assertNotEmpty(res);831 },832 test_metadata: async function () {833 const res = await this.terminal.executeCommand(834 "metadata -m res.partner -i 1",835 false,836 true837 );838 this.assertNotEmpty(res);839 this.assertEqual(res.xmlid, "base.main_partner");840 },841 test_metadata__no_arg: async function () {842 const res = await this.terminal.executeCommand(843 "metadata res.partner 1",844 false,845 true846 );847 this.assertNotEmpty(res);848 this.assertEqual(res.xmlid, "base.main_partner");849 },850 });...
foscam.js
Source:foscam.js
...80 }; // executeCommand81 // *************************** Network ************************************82 foscam.getIPInfo = function(callback) {83 // Get IP infoamtion.84 return foscam.executeCommand('getIPInfo', null, callback);85 };86 foscam.setIpInfo = function(isDHCP, ip, gate, mask, dns1, dns2, callback) {87 //isDHCP: 0(False), 1(True)88 //System will reboot automatically to take effect after call this CGI command.89 var params = {90 'isDHCP': isDHCP,91 'ip': ip,92 'gate': gate,93 'mask': mask,94 'dns1': dns1,95 'dns2': dns2,96 };97 return foscam.executeCommand('setIpInfo', params, callback);98 };99 foscam.setPortInfo = function(webPort, mediaPort, httpsPort, onvifPort, callback) {100 //Set http port and media port of camera.101 var params = {102 'webPort' : webPort,103 'mediaPort' : mediaPort,104 'httpsPort' : httpsPort,105 'onvifPort' : onvifPort,106 };107 return foscam.executeCommand('setPortInfo', params, callback);108 };109 foscam.refreshWifiList = function(callback) {110 //Start scan the aps around.111 //This operation may takes a while, about 20s or above,112 //the other operation on this device will be blocked during the period.113 return foscam.executeCommand('refreshWifiList', null, callback);114 };115 foscam.getWifiList = function(startNo, callback) {116 //Get the aps around after refreshWifiList.117 //Note: Only 10 aps will be returned one time.118 params = {'startNo': startNo};119 return foscam.executeCommand('getWifiList', params, callback);120 };121 foscam.setWifiSetting = function(ssid, psk, isEnable, isUseWifi, netType,122 encrypType, authMode, keyFormat, defaultKey,123 key1, key2, key3, key4,124 key1Len, key2Len, key3Len, key4Len, callback) {125 //Set wifi config.126 //Camera will not connect to AP unless you enject your cable.127 params = {'isEnable' : isEnable,128 'isUseWifi' : isUseWifi,129 'ssid' : ssid,130 'netType' : netType,131 'encryptType': encrypType,132 'psk' : psk,133 'authMode' : authMode,134 'keyFormat' : keyFormat,135 'defaultKey' : defaultKey,136 'key1' : key1,137 'key2' : key2,138 'key3' : key3,139 'key4' : key4,140 'key1Len' : key1Len,141 'key2Len' : key2Len,142 'key3Len' : key3Len,143 'key4Len' : key4Len,144 };145 return foscam.executeCommand('setWifiSetting', params, callback);146 };147 foscam.getUPnPConfig = function(callback) {148 return foscam.executeCommand( 'getUPnPConfig', null, callback );149 };150 foscam.setUPnPConfig = function(isEnable, callback) {151 params = {'isEnable': isEnable};152 return foscam.executeCommand('setUPnPConfig', params, callback);153 };154 foscam.getDDNSConfig = function(callback) {155 return foscam.executeCommand('getDDNSConfig', null, callback);156 };157 foscam.setDDNSConfig = function(isEnable, hostName, ddnsServer, user, password, callback) {158 params = {'isEnable': isEnable,159 'hostName': hostName,160 'ddnsServer': ddnsServer,161 'user': user,162 'password': password,163 };164 return foscam.executeCommand('setDDNSConfig', params, callback);165 };166 // *************** AV Settings ******************167 foscam.getSubVideoStreamType = function(callback) {168 //Get the stream type of sub stream.169 return foscam.executeCommand('getSubVideoStreamType', null, callback);170 };171 foscam.setSubVideoStreamType = function(format, callback) {172 params = {'format': format};173 return foscam.executeCommand('setSubVideoStreamType', params, callback);174 };175 foscam.setSubStreamFormat = function(format, callback) {176 params = {'format': format};177 return foscam.executeCommand('setSubStreamFormat', params, callback);178 };179 foscam.getMainVideoStreamType = function(callback) {180 return foscam.executeCommand('getMainVideoStreamType', null, callback);181 };182 foscam.setMainVideoStreamType = function(streamType, callback) {183 //Set the stream type of main stream184 params = {'streamType': streamType};185 return foscam.executeCommand('setMainVideoStreamType', params, callback);186 };187 foscam.getVideoStreamParam = function(callback){188 //Get video stream param189 return foscam.executeCommand('getVideoStreamParam', null, callback);190 };191 foscam.setVideoStreamParam = function(streamType, resolution, bitRate,192 frameRate, GOP, isVBR, callback) {193 //Set the video stream param of stream N194 //resolution(0~4): 0 720P,195 // 1 VGA(640*480),196 // 2 VGA(640*360),197 // 3 QVGA(320*240),198 // 4 QVGA(320*180)199 //bitrate: Bit rate of stream type N(20480~2097152)200 //framerate: Frame rate of stream type N201 //GOP: P frames between 1 frame of stream type N.202 // The suggest value is: X * framerate.203 //isvbr: 0(Not in use currently), 1(In use)204 params = {'streamType': streamType,205 'resolution': resolution,206 'bitRate' : bitRate,207 'frameRate' : frameRate,208 'GOP' : GOP,209 'isVBR' : isVBR,210 };211 return foscam.executeCommand('setVideoStreamParam', params, callback);212 };213 foscam.mirrorVideo = function(isMirror, callback) {214 // Mirror Video215 // 0 Not mirror216 // 1 Mirror217 params = {'isMirror': isMirror};218 return foscam.executeCommand('mirrorVideo', params, callback);219 };220 foscam.flipVideo = function(isFlip, callback) {221 // Flip video222 // 0 Not flip223 // 1 Flip224 params = {'isFlip': isFlip};225 return foscam.executeCommand('flipVideo', params, callback);226 };227 foscam.getMirrorAndFlipSetting = function(callback) {228 return foscam.executeCommand('getMirrorAndFlipSetting', null, callback);229 };230 // *************** User account ******************231 foscam.changeUserName = function(usrName, newUsrName, callback) {232 // Change user name.233 params = {234 'usrName': usrName,235 'newUsrName': newUsrName,236 };237 return foscam.executeCommand('changeUserName', params, callback);238 };239 foscam.changePassword = function(usrName, oldPwd, newPwd, callback) {240 // Change password.241 params = {242 'usrName': usrName,243 'oldPwd' : oldPwd,244 'newPwd' : newPwd,245 };246 return foscam.executeCommand('changePassword', params, callback);247 };248 // *************** Device manage *******************249 foscam.setSystemTime = function(timeSource, ntpServer, dateFormat,250 timeFormat, timeZone, isDst, dst,251 year, mon, day, hour, minute, sec,252 callback) {253 // Only support timeSource = 0(Get time from NTP server)254 // Supported ntpServer 'time.nist.gov',255 // 'time.kriss.re.kr',256 // 'time.windows.com',257 // 'time.nuri.net',258 params = {'timeSource': timeSource,259 'ntpServer' : ntpServer,260 'dateFormat': dateFormat,261 'timeFormat': timeFormat,262 'timeZone' : timeZone,263 'isDst' : isDst,264 'dst' : dst,265 'year' : year,266 'mon' : mon,267 'day' : day,268 'hour' : hour,269 'minute' : minute,270 'sec' : sec271 };272 return foscam.executeCommand('setSystemTime', params, callback);273 };274 foscam.getSystemTime = function(callback) {275 // Get system time.276 return foscam.executeCommand('getSystemTime', null, callback);277 };278 foscam.getDevName = function(callback) {279 //Get camera name.280 return foscam.executeCommand('getDevName', null, callback);281 };282 foscam.setDevName = function(devName, callback){283 // Set camera name284 params = {'devName': devName};285 return foscam.executeCommand('setDevName', params, callback);286 };287 foscam.getDevState = function(callback) {288 return foscam.executeCommand('getDevState', null, callback);289 };290 // *************** PTZ Control *******************291 foscam.ptzMoveUp = function(callback) {292 return foscam.executeCommand('ptzMoveUp', null, callback);293 };294 foscam.ptzMoveDown = function(callback) {295 return foscam.executeCommand('ptzMoveDown', null, callback);296 };297 foscam.ptzMoveLeft = function(callback) {298 return foscam.executeCommand('ptzMoveLeft', null, callback);299 };300 foscam.ptzMoveRight = function(callback) {301 return foscam.executeCommand('ptzMoveRight', null, callback);302 };303 foscam.ptzMoveTopLeft = function(callback) {304 return foscam.executeCommand('ptzMoveTopLeft', null, callback);305 };306 foscam.ptzMoveTopRight = function(callback) {307 return foscam.executeCommand('ptzMoveTopRight', null, callback);308 };309 foscam.ptzMoveBottomLeft = function(callback) {310 return foscam.executeCommand('ptzMoveBottomLeft', null, callback);311 };312 foscam.ptzMoveBottomRight = function(callback) {313 return foscam.executeCommand('ptzMoveBottomRight', null, callback);314 };315 foscam.ptzStopRun = function(callback) {316 return foscam.executeCommand('ptzStopRun', null, callback);317 };318 foscam.ptzReset = function(callback) {319 return foscam.executeCommand('ptzReset', null, callback);320 };321 foscam.getPTZSpeed = function(callback) {322 return foscam.executeCommand('getPTZSpeed', null, callback);323 };324 foscam.setPTZSpeed = function(speed, callback) {325 params = {'speed': speed};326 return foscam.executeCommand('setPTZSpeed', params, callback);327 };328 foscam.getPTZSelfTestMode = function(callback) {329 return foscam.executeCommand('getPTZSelfTestMode', null, callback);330 };331 foscam.setPTZSelfTestMode = function(mode, callback) {332 //Set the selftest mode of PTZ333 //mode = 0: No selftest334 //mode = 1: Normal selftest335 //mode = 1: After normal selftest, then goto presetpoint-appointed336 params = {'mode': mode}337 return foscam.executeCommand('setPTZSelfTestMode', params, callback);338 };339 // *************** AV Function *******************340 foscam.getAlarmRecordConfig = function(callback) {341 // Get alarm record config342 return foscam.executeCommand('getAlarmRecordConfig', null, callback);343 };344 foscam.setAlarmRecordConfig = function(isEnablePreRecord, preRecordSecs, alarmRecordSecs, callback) {345 // Set alarm record config346 params = {'isEnablePreRecord': isEnablePreRecord,347 'preRecordSecs' : preRecordSecs,348 'alarmRecordSecs' : alarmRecordSecs,349 };350 return foscam.executeCommand('setAlarmRecordConfig', params, callback);351 };352 foscam.getLocalAlarmRecordConfig = function(callback) {353 // Get local alarm-record config354 return foscam.executeCommand('getLocalAlarmRecordConfig', null, callback);355 };356 foscam.setLocalAlarmRecordConfig = function(isEnableLocalAlarmRecord, localAlarmRecordSecs, callback) {357 // Set local alarm-record config358 params = {'isEnableLocalAlarmRecord': isEnableLocalAlarmRecord,359 'localAlarmRecordSecs' : localAlarmRecordSecs360 };361 return foscam.executeCommand('setLocalAlarmRecordConfig', params, callback);362 };363 foscam.getH264FrmRefMode = function(callback) {364 // Get grame shipping reference mode of H264 encode stream.365 // Return args:366 // mode: 0 Normal reference mode367 // 1 Two frames are seprated by four skipping frames368 return foscam.executeCommand('getH264FrmRefMode', null, callback);369 };370 foscam.setH264FrmRefMode = function(mode, callback) {371 // Set frame shipping reference mode of H264 encode stream.372 params = {'mode': mode};373 return foscam.executeCommand('setH264FrmRefMode', params, callback);374 };375 foscam.getScheduleRecordConfig = function(callback) {376 // Get schedule record config.377 // cmd: getScheduleRecordConfig378 // Return args:379 // isEnable: 0/1380 // recordLevel: 0 ~ ?381 // spaceFullMode: 0 ~ ?382 // isEnableAudio: 0/1383 // schedule[N]: N <- (0 ~ 6)384 return foscam.executeCommand('getScheduleRecordConfig', null, callback);385 };386 foscam.setScheduleRecordConfig = function(isEnable, recordLevel,387 spaceFullMode, isEnableAudio,388 schedule0, schedule1, schedule2,389 schedule3, schedule4, schedule5,390 schedule6, callback) {391 // Set schedule record config.392 // cmd: setScheduleRecordConfig393 // args: See meth::getScheduleRecordConfig394 params = {'isEnable' : isEnable,395 'isEnableAudio': isEnableAudio,396 'recordLevel' : recordLevel,397 'spaceFullMode': spaceFullMode,398 'schedule0' : schedule0,399 'schedule1' : schedule1,400 'schedule2' : schedule2,401 'schedule3' : schedule3,402 'schedule4' : schedule4,403 'schedule5' : schedule5,404 'schedule6' : schedule6,405 };406 return foscam.executeCommand('setScheduleRecordConfig', params, callback);407 }408 foscam.getRecordPath = function(callback){409 // Get Record path: sd/ftp410 // cmd: getRecordPath411 // return args:412 // path: (0, SD), (2, FTP)413 // free: free size(K)414 // total: total size(K)415 return foscam.executeCommand('getRecordPath', null, callback);416 };417 foscam.setRecordPath = function(Path, callback){418 // Set Record path: sd/ftp419 // cmd: setRecordPath420 // params:421 // path: (0, SD), (2, FTP)422 params = {'Path': Path};423 return foscam.executeCommand('setRecordPath', params, callback);424 };425 return foscam;426 }427};428function encodeURIComponent_GBK(str) {429 if(str==null || typeof(str)=='undefined' || str=='')430 return '';431 var a = str.toString().split('');432 for(var i=0; i<a.length; i++) {433 var ai = a[i];434 if( (ai>='0' && ai<='9') || (ai>='A' && ai<='Z') || (ai>='a' && ai<='z') || ai==='.' || ai==='-' || ai==='_') continue;435 var b = iconv.encode(ai, 'gbk');436 var e = [''];437 for(var j = 0; j<b.length; j++)...
test_core.js
Source:test_core.js
...12 test_name === "test_context_term" ||13 test_name === "test_context_term_no_arg"14 ) {15 return this.terminal16 .executeCommand("context_term", false, true)17 .then((context) => {18 this._orig_context = context;19 });20 }21 });22 return def;23 },24 onAfterTest: async function (test_name) {25 const def = this._super.apply(this, arguments);26 def.then(() => {27 if (28 test_name === "test_context_term" ||29 test_name === "test_context_term_no_arg"30 ) {31 return this.terminal.executeCommand(32 `context_term -o set -v '${JSON.stringify(33 this._orig_context34 )}'`,35 false,36 true37 );38 }39 });40 return def;41 },42 test_help: async function () {43 await this.terminal.executeCommand("help", false, true);44 await this.terminal.executeCommand("help -c search", false, true);45 await this.terminal.executeCommand("help search", false, true);46 },47 test_print: async function () {48 const res = await this.terminal.executeCommand(49 "print -m 'This is a test!'",50 false,51 true52 );53 this.assertEqual(res, "This is a test!");54 },55 test_print__no_arg: async function () {56 const res = await this.terminal.executeCommand(57 "print 'This is a test!'",58 false,59 true60 );61 this.assertEqual(res, "This is a test!");62 },63 test_load: async function () {64 const res = await this.terminal.executeCommand(65 "load -u https://cdnjs.cloudflare.com/ajax/libs/Mock.js/1.0.0/mock-min.js",66 false,67 true68 );69 this.assertTrue(res);70 },71 test_load__no_arg: async function () {72 const res = await this.terminal.executeCommand(73 "load https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css",74 false,75 true76 );77 this.assertTrue(res);78 },79 test_context_term: async function () {80 let res = await this.terminal.executeCommand(81 "context_term",82 false,83 true84 );85 this.assertIn(res, "active_test");86 res = await this.terminal.executeCommand(87 "context_term -o read",88 false,89 true90 );91 this.assertIn(res, "active_test");92 res = await this.terminal.executeCommand(93 "context_term -o write -v \"{'test_key': 'test_value'}\"",94 false,95 true96 );97 this.assertIn(res, "test_key");98 res = await this.terminal.executeCommand(99 "context_term -o set -v \"{'test_key': 'test_value_change'}\"",100 false,101 true102 );103 this.assertEqual(res.test_key, "test_value_change");104 res = await this.terminal.executeCommand(105 "context_term -o delete -v test_key",106 false,107 true108 );109 this.assertNotIn(res, "test_key");110 },111 test_context_term__no_arg: async function () {112 let res = await this.terminal.executeCommand(113 "context_term read",114 false,115 true116 );117 this.assertIn(res, "active_test");118 res = await this.terminal.executeCommand(119 "context_term write \"{'test_key': 'test_value'}\"",120 false,121 true122 );123 this.assertIn(res, "test_key");124 res = await this.terminal.executeCommand(125 "context_term set \"{'test_key': 'test_value_change'}\"",126 false,127 true128 );129 this.assertEqual(res.test_key, "test_value_change");130 res = await this.terminal.executeCommand(131 "context_term delete test_key",132 false,133 true134 );135 this.assertNotIn(res, "test_key");136 },137 test_alias: async function () {138 let res = await this.terminal.executeCommand("alias", false, true);139 this.assertEmpty(res);140 res = await this.terminal.executeCommand(141 "alias -n test -c \"print -m 'This is a test! $1 ($2[Nothing])'\"",142 false,143 true144 );145 this.assertIn(res, "test");146 res = await this.terminal.executeCommand(147 'test Foo "Bar Space"',148 false,149 true150 );151 this.assertEqual(res, "This is a test! Foo (Bar Space)");152 res = await this.terminal.executeCommand("test Foo", false, true);153 this.assertEqual(res, "This is a test! Foo (Nothing)");154 res = await this.terminal.executeCommand(155 "alias -n test",156 false,157 true158 );159 this.assertNotIn(res, "test");160 },161 test_alias__no_arg: async function () {162 let res = await this.terminal.executeCommand(163 "alias test \"print 'This is a test! $1 ($2[Nothing])'\"",164 false,165 true166 );167 this.assertIn(res, "test");168 res = await this.terminal.executeCommand("alias test", false, true);169 this.assertNotIn(res, "test");170 },171 test_quit: async function () {172 await this.terminal.executeCommand("quit", false, true);173 this.assertFalse(174 this.terminal.$el.hasClass("terminal-transition-topdown")175 );176 },177 test_exportvar: async function () {178 const res = await this.terminal.executeCommand(179 "exportvar -c \"print 'This is a test'\"",180 false,181 true182 );183 this.assertTrue(Object.prototype.hasOwnProperty.call(window, res));184 this.assertEqual(window[res], "This is a test");185 },186 test_exportvar__no_arg: async function () {187 const res = await this.terminal.executeCommand(188 "exportvar \"print 'This is a test'\"",189 false,190 true191 );192 this.assertTrue(Object.prototype.hasOwnProperty.call(window, res));193 this.assertEqual(window[res], "This is a test");194 },195 test_chrono: async function () {196 const res = await this.terminal.executeCommand(197 "chrono -c \"print -m 'This is a test'\"",198 false,199 true200 );201 this.assertNotEqual(res, -1);202 },203 test_chrono__no_arg: async function () {204 const res = await this.terminal.executeCommand(205 "chrono \"print 'This is a test'\"",206 false,207 true208 );209 this.assertNotEqual(res, -1);210 },211 test_repeat: async function () {212 const res = await this.terminal.executeCommand(213 "repeat -t 500 -c \"print -m 'This is a test'\"",214 false,215 true216 );217 this.assertNotEqual(res, -1);218 },219 test_repeat__no_arg: async function () {220 const res = await this.terminal.executeCommand(221 "repeat 500 \"print 'This is a test'\"",222 false,223 true224 );225 this.assertNotEqual(res, -1);226 },227 test_jobs: async function () {228 const res = await this.terminal.executeCommand("jobs", false, true);229 this.assertEqual(res[0]?.scmd.cmd, "jobs");230 },231 test_parse_simple_json: async function () {232 let res = await this.terminal.executeCommand(233 "parse_simple_json -i \"keyA=ValueA keyB='Complex ValueB' keyC=1234 keyD='keyDA=ValueDA keyDB=\\'Complex ValueDB\\' keyDC=1234'\"",234 false,235 true236 );237 this.assertEqual(res.keyA, "ValueA");238 this.assertEqual(res.keyB, "Complex ValueB");239 this.assertEqual(res.keyC, 1234);240 this.assertNotEmpty(res.keyD);241 this.assertEqual(res.keyD.keyDA, "ValueDA");242 this.assertEqual(res.keyD.keyDB, "Complex ValueDB");243 this.assertEqual(res.keyD.keyDC, 1234);244 res = await this.terminal.executeCommand(245 "parse_simple_json -i \"{'keyA': 'ValueA', 'keyB': 'Complex ValueB', 'keyC': 1234, 'keyD': { 'keyDA': 'ValueDA', 'keyDB': 'Complex ValueDB', 'keyDC': 1234 }}\"",246 false,247 true248 );249 this.assertEqual(res.keyA, "ValueA");250 this.assertEqual(res.keyB, "Complex ValueB");251 this.assertEqual(res.keyC, 1234);252 this.assertNotEmpty(res.keyD);253 this.assertEqual(res.keyD.keyDA, "ValueDA");254 this.assertEqual(res.keyD.keyDB, "Complex ValueDB");255 this.assertEqual(res.keyD.keyDC, 1234);256 res = await this.terminal.executeCommand(257 "parse_simple_json -i \"[['test', '=', 'value']]\"",258 false,259 true260 );261 this.assertNotEmpty(res);262 this.assertEqual(res[0][0], "test");263 this.assertEqual(res[0][1], "=");264 this.assertEqual(res[0][2], "value");265 res = await this.terminal.executeCommand(266 "parse_simple_json -i 1234",267 false,268 true269 );270 this.assertEqual(res, 1234);271 res = await this.terminal.executeCommand(272 "parse_simple_json -i \"'Simple Text'\"",273 false,274 true275 );276 this.assertEqual(res, "Simple Text");277 },278 });...
kits.js
Source:kits.js
...27 try {28 if (cmdObject.content === test[0]) {29 let player = getPlayerByNAME(cmdObject.sender);30 let playerName = player.name;31 system.executeCommand(`execute @a[name="${playerName}"] ~ ~ ~ tellraw @a {"rawtext":[{"text":"§bKits are: .kit archer, .kit miner, .kit lumberjack, .kit warrior, .kit mage, §a(.kit staff)§b and .kit demolitionist---kit script made by Nickg two and Cynical"}]}`, () => {});32 }33 if (cmdObject.content === kita[0]) {34 let player = getPlayerByNAME(cmdObject.sender);35 let playerName = player.name;36 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s arrow 64 `, () => {});37 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s bow 1 `, () => {});38 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s cooked_beef 16 `, () => {});39 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s chainmail_helmet 1 `, () => {});40 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s chainmail_chestplate 1 `, () => {});41 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s chainmail_leggings 1 `, () => {});42 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s chainmail_boots 1 `, () => {});43 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ say §b@s has chosen kit Archer! `, () => {});44 system.executeCommand(`execute @a[name="${playerName}",scores={kit=1}] ~ ~ ~ say §b@s has already picked a kit! `, () => {});45 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ scoreboard players set @s kit 1`,{});46 }47 if (cmdObject.content === kit2[0]) {48 let player = getPlayerByNAME(cmdObject.sender);49 let playerName = player.name;50 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_pickaxe 1 `, () => {});51 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_helmet 1 `, () => {});52 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_chestplate 1 `, () => {});53 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_leggings 1 `, () => {});54 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_boots 1 `, () => {});55 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s stone_shovel 1 `, () => {});56 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s torch 32 `, () => {});57 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s cooked_beef 16 `, () => {});58 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ say §b@s has chosen kit Miner! `, () => {});59 system.executeCommand(`execute @a[name="${playerName}",scores={kit=1}] ~ ~ ~ say §b@s has already picked a kit! `, () => {});60 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ scoreboard players set @s kit 1`,{});61 }62 if (cmdObject.content === kit3[0]) {63 let player = getPlayerByNAME(cmdObject.sender);64 let playerName = player.name;65 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_axe 1 `, () => {});66 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s crafting_table 1 `, () => {});67 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s leather_chestplate 1 `, () => {});68 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s leather_leggings 1 `, () => {});69 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s leather_boots 1 `, () => {});70 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s wood 10 `, () => {});71 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s leather_helmet 32 `, () => {});72 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s cooked_beef 16 `, () => {});73 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ say §b@s has chosen kit Lumberjack! `, () => {});74 system.executeCommand(`execute @a[name="${playerName}",scores={kit=1}] ~ ~ ~ say §b@s has already picked a kit! `, () => {});75 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ scoreboard players set @s kit 1`,{});76 } 77 if (cmdObject.content === kit4[0]) {78 let player = getPlayerByNAME(cmdObject.sender);79 let playerName = player.name;80 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s stone_sword 1 `, () => {});81 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_helmet 1 `, () => {});82 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_chestplate 1 `, () => {});83 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_leggings 1 `, () => {});84 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_boots 1 `, () => {});85 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s shield 1 `, () => {});86 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s cooked_beef 16 `, () => {});87 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ say §b@s has chosen kit Warrior! `, () => {});88 system.executeCommand(`execute @a[name="${playerName}",scores={kit=1}] ~ ~ ~ say §b@s has already picked a kit! `, () => {});89 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ scoreboard players set @s kit 1`,{});90 }91 if (cmdObject.content === kit5[0]) {92 let player = getPlayerByNAME(cmdObject.sender);93 let playerName = player.name;94 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s blaze_rod 3 `, () => {});95 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s enchanting_table 1 `, () => {});96 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s book 7 `, () => {});97 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s ender_pearl 5 `, () => {});98 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s brewing_stand 1 `, () => {});99 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s cooked_beef 16 `, () => {});100 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ say §b@s has chosen kit Mage! `, () => {});101 system.executeCommand(`execute @a[name="${playerName}",scores={kit=1}] ~ ~ ~ say §b@s has already picked a kit! `, () => {});102 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ scoreboard players set @s kit 1`,{});103 }104 if (cmdObject.content === kit6[0]) {105 let player = getPlayerByNAME(cmdObject.sender);106 let playerName = player.name;107 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s tnt 5 `, () => {});108 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s flint_and_steel 1 `, () => {});109 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s fire_charge 7 `, () => {});110 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s iron_pickaxe 1 `, () => {});111 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s leather_chestplate 1 `, () => {});112 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ give @s cooked_beef 16 `, () => {});113 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ say §b@s has chosen kit Demolitionist! `, () => {});114 system.executeCommand(`execute @a[name="${playerName}",scores={kit=1}] ~ ~ ~ say §b@s has already picked a kit! `, () => {});115 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ scoreboard players set @s kit 1`,{});116 }117 if (cmdObject.content === kit7[0]) {118 let player = getPlayerByNAME(cmdObject.sender);119 let playerName = player.name;120 system.executeCommand(`execute @a[name="${playerName}",tag=staff] ~ ~ ~ give @s command_block 1 `, () => {});121 system.executeCommand(`execute @a[name="${playerName}",tag=staff] ~ ~ ~ give @s redstone block 1 `, () => {});122 system.executeCommand(`execute @a[name="${playerName}",tag=staff] ~ ~ ~ gamemode c `, () => {});123 system.executeCommand(`execute @a[name="${playerName}",tag=staff] ~ ~ ~ give @s diamond_sword 1 `, () => {});124 }125} catch(err) {126 console.error(err);127 }128 129 130});131onPlayerInitialized(player => {132 let playerName = player.name133 system.executeCommand(`scoreboard objectives add kit dummy`,{});134 system.executeCommand(`execute @a[name="${playerName}"] ~ ~ ~ scoreboard players add @s kit 0`,{});135 system.executeCommand(`execute @a[name="${playerName}",scores={kit=0}] ~ ~ ~ title @s title Make sure to do .kit, n§b@s`,{});136 137 ...
kumember.js
Source:kumember.js
...55 <div className="kumember-layout-container">56 <div className="kumember-header-container">57 <button58 className="uppercase main-button"59 onClick={() => this.executeCommand("undo", null)}60 >61 <i className="fa fa-undo" aria-hidden="true"></i>62 </button>63 <button64 className="uppercase main-button"65 onClick={() => this.executeCommand("redo", null)}66 >67 <i className="fa fa-repeat" aria-hidden="true"></i>68 </button>69 <button70 className="uppercase main-button"71 onClick={() => this.executeCommand("copy", null)}72 >73 <i className="fa fa-files-o" aria-hidden="true"></i>74 </button>75 <button76 className="uppercase main-button"77 onClick={() => this.executeCommand("cut", null)}78 >79 <i className="fa fa-scissors" aria-hidden="true"></i>80 </button>81 <button82 className="uppercase main-button"83 onClick={() => this.executeCommand("bold", null)}84 >85 <i className="fa fa-bold" aria-hidden="true"></i>86 </button>87 <button88 className="uppercase main-button"89 onClick={() => this.executeCommand("italic", null)}90 >91 <i className="fa fa-italic" aria-hidden="true"></i>92 </button>93 <button94 className="uppercase main-button"95 onClick={() => this.executeCommand("strikeThrough", null)}96 >97 <i className="fa fa-strikethrough" aria-hidden="true"></i>98 </button>99 <button100 className="uppercase main-button"101 onClick={() => this.executeCommand("justtfyLeft", null)}102 >103 <i className="fa fa-align-left" aria-hidden="true"></i>104 </button>105 <button106 className="uppercase main-button"107 onClick={() => this.executeCommand("justifyCenter", null)}108 >109 <i className="fa fa-align-center" aria-hidden="true"></i>110 </button>111 <button112 className="uppercase main-button"113 onClick={() => this.executeCommand("justifyRight", null)}114 >115 <i className="fa fa-align-right" aria-hidden="true"></i>116 </button>117 <button118 className="uppercase main-button"119 onClick={() => this.executeCommand("justifyFull", null)}120 >121 <i className="fa fa-align-justify" aria-hidden="true"></i>122 </button>123 <button124 className="uppercase main-button"125 onClick={() => this.executeCommand("indent", null)}126 >127 <i className="fa fa-indent" aria-hidden="true"></i>128 </button>129 <button130 className="uppercase main-button"131 onClick={() => this.executeCommand("outdent", null)}132 >133 <i className="fa fa-dedent" aria-hidden="true"></i>134 </button>135 <button136 className="uppercase main-button"137 onClick={() => this.executeCommand("subscript", null)}138 >139 <i className="fa fa-subscript" aria-hidden="true"></i>140 </button>141 <button142 className="uppercase main-button"143 onClick={() => this.executeCommand("superscript", null)}144 >145 <i className="fa fa-superscript" aria-hidden="true"></i>146 </button>147 <button148 className="uppercase main-button"149 onClick={() => this.executeCommand("insertUnorderedList", null)}150 >151 <i className="fa fa-list-ul" aria-hidden="true"></i>152 </button>153 <button154 className="uppercase main-button"155 onClick={() => this.executeCommand("insertOrderedList", null)}156 >157 <i className="fa fa-list-ol" aria-hidden="true"></i>158 </button>159 <button160 className="uppercase main-button"161 onClick={() => this.executeCommand("insertParagraph", null)}162 >163 <i className="fa fa-paragraph" aria-hidden="true"></i>164 </button>165 <HeaderCommand166 executeCommand={this.executeCommand}167 updatePopupState={this.updatePopupState}168 />169 <ForegroundColorCommand170 executeCommand={this.executeCommand}171 updatePopupState={this.updatePopupState}172 foreColor={this.state.foreColor}173 backColor={this.state.backColor}174 updatePropsState={this.onChangeForeColor}175 />176 <BackgroundColorCommand177 executeCommand={this.executeCommand}178 updatePopupState={this.updatePopupState}179 foreColor={this.state.foreColor}180 backColor={this.state.backColor}181 updatePropsState={this.onChangeBackColor}182 />183 {/* <UndoCommand executeCommand={this.executeCommand} />184 <RedoCommand executeCommand={this.executeCommand} />185 <CopyComand executeCommand={this.executeCommand} />186 <CutCommand executeCommand={this.executeCommand} />187 <PasteCommand executeCommand={this.executeCommand} editor={this.state.editor} />188 <BoldCommand executeCommand={this.executeCommand} />189 <HeadersCommand executeCommand={this.executeCommand} />190 <button className="uppercase" onClick={() => this.executeCommand('backColor', '#dfa')}>Color</button>191 <button className="uppercase" onClick={() => this.executeCommand('copy', null)}>b</button>192 <button className="uppercase" onClick={() => this.executeCommand('cut', null)}>b</button>193 <button className="uppercase" onClick={() => this.executeCommand('delete', null)}>b</button>194 <button className="uppercase" onClick={() => this.executeCommand('foreColor', 'red')}>b</button>195 196 <button className="uppercase" onClick={() => this.executeCommand('bold', null)}>b</button>197 <button className="uppercase" onClick={() => this.executeCommand('bold', null)}>b</button> */}198 </div>199 <div200 className="kumember-content-container"201 id="kumember-content-container"202 >203 <iframe204 className="kumember-editor"205 name="kumember-editor"206 id="kumember-editor"207 ></iframe>208 {this.state.isPopupOpen ? (209 <div210 style={{211 backgroundColor: "#cdcdd0d1",...
multi-db.spec.js
Source:multi-db.spec.js
...45 })46 if (Cypress.config('serverVersion') >= 4.0) {47 if (isEnterpriseEdition()) {48 it('shows a message indicating whether system updates have occured', () => {49 cy.executeCommand(':clear')50 cy.executeCommand(':use system')51 cy.executeCommand('CREATE DATABASE test1')52 cy.wait(3000) // CREATE database can take a sec53 cy.resultContains('1 system update, no records')54 cy.executeCommand('STOP DATABASE test1')55 cy.wait(1000)56 cy.resultContains('1 system update, no records')57 cy.executeCommand('STOP DATABASE test1')58 cy.wait(1000)59 if (Cypress.config('serverVersion') >= 4.1) {60 cy.resultContains('1 system update, no records')61 } else {62 cy.resultContains('no changes, no records')63 }64 cy.executeCommand('DROP DATABASE test1')65 cy.executeCommand(':clear')66 })67 }68 it(':use command works + shows current db in editor gutter', () => {69 cy.executeCommand(':clear')70 const editor = () => cy.get('[data-testid="editor-wrapper"]')71 editor().contains('neo4j$')72 cy.executeCommand(':use system')73 editor().contains('system$')74 cy.executeCommand(':use neo4j')75 editor().contains('neo4j$')76 })77 it('lists databases in sidebar', () => {78 cy.executeCommand(':clear')79 cy.get('[data-testid="drawerDBMS"]').click()80 databaseOptionListOptions().should('have.length', 2)81 cy.get('[data-testid="drawerDBMS"]').click()82 })83 if (isEnterpriseEdition()) {84 it('adds databases to the sidebar and adds backticks to special db names', () => {85 // Add db86 cy.executeCommand(':use system')87 cy.executeCommand('CREATE DATABASE `name-with-dash`')88 cy.resultContains('1 system update')89 cy.executeCommand(':clear')90 // Count items in list91 cy.get('[data-testid="drawerDBMS"]').click()92 databaseOptionListOptions().should('have.length', 3)93 databaseOptionListOptions().contains('system')94 databaseOptionListOptions().contains('neo4j')95 databaseOptionListOptions().contains('name-with-dash')96 // Select to use db, make sure backticked97 databaseOptionList().select('name-with-dash')98 cy.get('[data-testid="frameCommand"]', { timeout: 10000 })99 .first()100 .should('contain', ':use `name-with-dash`')101 cy.resultContains(102 'Queries from this point and forward are using the database'103 )104 // Try without backticks105 cy.executeCommand(':use system')106 cy.resultContains(107 'Queries from this point and forward are using the database'108 )109 cy.executeCommand(':clear')110 cy.executeCommand(':use name-with-dash')111 cy.resultContains(112 'Queries from this point and forward are using the database'113 )114 // Cleanup115 cy.executeCommand(':use system')116 cy.executeCommand('DROP DATABASE `name-with-dash`')117 databaseOptionListOptions().should('have.length', 2)118 cy.get('[data-testid="drawerDBMS"]').click()119 })120 }121 it('lists databases with :dbs command', () => {122 cy.executeCommand(':clear')123 cy.executeCommand(':dbs')124 databaseList().should('have.length', 2)125 databaseList().contains('system')126 databaseList().contains('neo4j')127 cy.executeCommand(':use system')128 })129 if (isEnterpriseEdition()) {130 it('lists new databases with :dbs command', () => {131 cy.executeCommand('CREATE DATABASE sidebartest')132 cy.wait(3000) // CREATE database can take a sec133 cy.executeCommand(':clear')134 cy.executeCommand(':dbs')135 databaseList().should('have.length', 3)136 databaseList().contains('system')137 databaseList().contains('neo4j')138 databaseList().contains('sidebartest')139 cy.executeCommand('DROP DATABASE sidebartest')140 cy.executeCommand(':clear')141 cy.executeCommand(':dbs')142 databaseList().should('have.length', 2)143 databaseList().contains('system')144 databaseList().contains('neo4j')145 })146 }147 it('shows error message when trying to set a parameter on system db', () => {148 cy.executeCommand(':clear')149 cy.executeCommand(':use system')150 cy.executeCommand(':param x => 1')151 const resultFrame = cy152 .get('[data-testid="frame"]', { timeout: 10000 })153 .first()154 resultFrame.should('contain', 'cannot be declared')155 })156 it('shows error when trying to use a db that doesnt exist', () => {157 cy.executeCommand(':clear')158 cy.executeCommand(':use nonexistingdb')159 const resultFrame = cy160 .get('[data-testid="frame"]', { timeout: 10000 })161 .first()162 resultFrame.should('contain', 'could not be found')163 })164 if (isEnterpriseEdition()) {165 it('re-runs query from frame action button on original db', () => {166 cy.executeCommand(':clear')167 cy.executeCommand(':use neo4j')168 cy.executeCommand(':clear')169 cy.executeCommand('RETURN "Test string"')170 cy.executeCommand(':use system')171 // Close first frame172 cy.get('[title="Close"]', { timeout: 10000 })173 .first()174 .click()175 // Make sure it's closed176 cy.get('[data-testid="frame"]', { timeout: 10000 }).should(177 'have.length',178 1179 )180 // Click re-run181 cy.get('[data-testid="rerunFrameButton"]', { timeout: 10000 })182 .first()183 .click()184 // Make sure we have what we expect...
robot.test.js
Source:robot.test.js
...12describe("test robot module", () => {13 it("ignore commands until 1st valid PLACE command", () => {14 const robot = createRobot();15 let x, y, f;16 robot.executeCommand("INVALID COMMAND 1");17 robot.executeCommand("");18 robot.executeCommand(MOVE);19 robot.executeCommand(MOVE);20 robot.executeCommand(LEFT);21 ({ x, y, f } = robot.getCurrentPostion());22 expect(x).toEqual(0);23 expect(y).toEqual(0);24 expect(f).toEqual("");25 // 1st valid PLACE command after many ignored / invalid commands will be executed26 robot.executeCommand("PLACE 2,3,EAST");27 ({ x, y, f } = robot.getCurrentPostion());28 expect(x).toEqual(2);29 expect(y).toEqual(3);30 expect(f).toEqual(EAST);31 });32 it("move that make robot falls will be prevented", () => {33 const robot = createRobot();34 let x, y, f;35 // robot at the top NORTH EAST. MOVE commmand will make robot fall, so will be discarded36 robot.executeCommand("PLACE 4,4,NORTH");37 robot.executeCommand(MOVE);38 ({ x, y, f } = robot.getCurrentPostion());39 expect(x).toEqual(4);40 expect(y).toEqual(4);41 expect(f).toEqual(NORTH);42 // robot at the origin, facing SOUTH. MOVE comand will make robot fall, so will be discarded43 robot.executeCommand("PLACE 0,0,SOUTH");44 robot.executeCommand(MOVE);45 ({ x, y, f } = robot.getCurrentPostion());46 expect(x).toEqual(0);47 expect(y).toEqual(0);48 expect(f).toEqual(SOUTH);49 });50 it("Movements causing robot to fall will be prevented, but further valid movements commands still be allowed", () => {51 const robot = createRobot();52 let x, y, f;53 // robot at the top NORTH EAST.54 robot.executeCommand("PLACE 4,4,NORTH");55 // A MOVE commmand will make robot fall, so will be discarded56 robot.executeCommand(MOVE);57 ({ x, y, f } = robot.getCurrentPostion());58 expect(x).toEqual(4);59 expect(y).toEqual(4);60 expect(f).toEqual(NORTH);61 // LEFT command not causing robot to fall so will be executed62 robot.executeCommand(LEFT);63 ({ x, y, f } = robot.getCurrentPostion());64 expect(x).toEqual(4);65 expect(y).toEqual(4);66 expect(f).toEqual(WEST);67 });68 it("PLACE command to position robot out of the table, will be discarded", () => {69 const robot = createRobot();70 robot.executeCommand("PLACE 5,5,NORTH");71 const { x, y, f } = robot.getCurrentPostion();72 expect(x).toEqual(0);73 expect(y).toEqual(0);74 expect(f).toEqual("");75 });76 it("commands in example 1", () => {77 const robot = createRobot();78 robot.executeCommand("PLACE 0,0,NORTH");79 robot.executeCommand(MOVE);80 robot.executeCommand(REPORT);81 const { x, y, f } = robot.getCurrentPostion();82 expect(x).toEqual(0);83 expect(y).toEqual(1);84 expect(f).toEqual(NORTH);85 });86 it("commands in example 2", () => {87 const robot = createRobot();88 robot.executeCommand("PLACE 0,0,NORTH");89 robot.executeCommand(LEFT);90 robot.executeCommand(REPORT);91 const { x, y, f } = robot.getCurrentPostion();92 expect(x).toEqual(0);93 expect(y).toEqual(0);94 expect(f).toEqual(WEST);95 });96 it("commands in example 3", () => {97 const robot = createRobot();98 robot.executeCommand("PLACE 1,2,EAST");99 robot.executeCommand(MOVE);100 robot.executeCommand(MOVE);101 robot.executeCommand(LEFT);102 robot.executeCommand(MOVE);103 robot.executeCommand(REPORT);104 const { x, y, f } = robot.getCurrentPostion();105 expect(x).toEqual(3);106 expect(y).toEqual(3);107 expect(f).toEqual(NORTH);108 });...
params.spec.js
Source:params.spec.js
...25 .should('include', 'Neo4j Browser')26 cy.wait(3000)27 })28 it('handles :param without web worker', () => {29 cy.executeCommand(':config userCypherThread: false').then(() => {30 cy.executeCommand(':clear')31 return runTests()32 })33 })34 it('handles :param WITH web worker', () => {35 cy.executeCommand(':config userCypherThread: true').then(() => {36 cy.executeCommand(':clear')37 return runTests()38 })39 })40})41function runTests() {42 let setParamQ43 let getParamQ44 // it('can connect', () => {45 const password = Cypress.config('password')46 cy.connect('neo4j', password)47 // })48 // it(':param x => 1+1', () => {49 // Set param50 cy.executeCommand(':clear')51 setParamQ = ':param x => 1+1'52 cy.executeCommand(setParamQ)53 cy.resultContains('"x": 2')54 // return param55 cy.executeCommand(':clear')56 getParamQ = 'RETURN $x'57 cy.executeCommand(getParamQ)58 cy.waitForCommandResult()59 cy.resultContains('2')60 // it(':param x => {prop: 1} multi line', () => {61 // Set param62 cy.executeCommand(':clear')63 setParamQ = `:param [x] => {{}{shift}{enter}RETURN {{}prop: 1} AS x{enter}}`64 cy.executeCommand(setParamQ)65 cy.resultContains('"prop": 1')66 // return param67 cy.executeCommand(':clear')68 getParamQ = 'RETURN $x'69 cy.executeCommand(getParamQ)70 cy.waitForCommandResult()71 cy.resultContains('"prop": 1')72 // })73 // it(':param x => 1.0', () => {74 // Set param75 cy.executeCommand(':clear')76 setParamQ = ':param x => 1.0'77 cy.executeCommand(setParamQ)78 cy.resultContains('"x": 1.0')79 // return param80 cy.executeCommand(':clear')81 getParamQ = 'RETURN $x'82 cy.executeCommand(getParamQ)83 cy.waitForCommandResult()84 cy.resultContains('1.0')85 // })86 // it('handles falsy param value e.g. :param x => 0', () => {87 // Set param88 cy.executeCommand(':clear')89 setParamQ = ':param x => 0'90 cy.executeCommand(setParamQ)91 cy.resultContains('"x": 0')92 // return param93 cy.executeCommand(':clear')94 getParamQ = 'RETURN $x'95 cy.executeCommand(getParamQ)96 cy.waitForCommandResult()97 cy.resultContains('0')98 // })99 if (Cypress.config('serverVersion') >= 3.4) {100 // it(":param x => point({crs: 'wgs-84', latitude: 57.7346, longitude: 12.9082})", () => {101 cy.executeCommand(':clear')102 const query =103 ":param x => point({crs: 'wgs-84', latitude: 57.7346, longitude: 12.9082})"104 cy.executeCommand(query, { parseSpecialCharSequences: false })105 cy.get('[data-testid="rawParamData"]', { timeout: 20000 })106 .first()107 .should('contain', '"x": point({srid:4326, x:12.9082, y:57.7346})')108 getParamQ = 'RETURN $x'109 cy.executeCommand(getParamQ)110 cy.waitForCommandResult()111 cy.resultContains('point({srid:4326, x:12.9082, y:57.7346})')112 }113 // })...
Using AI Code Generation
1var exec = require('child_process').exec;2var child;3child = exec('ls -la',4 function (error, stdout, stderr) {5 console.log('stdout: ' + stdout);6 console.log('stderr: ' + stderr);7 if (error !== null) {8 console.log('exec error: ' + error);9 }10});
Using AI Code Generation
1driver.init(desired).then(function () {2 return driver.execute("mobile: shell", {3 });4}).then(function (res) {5 console.log(res);6});
Using AI Code Generation
1driver.executeCommand('mobile: scroll', {direction: 'down'});2driver.executeScript('mobile: scroll', {direction: 'down'});3driver.executeAsyncScript('mobile: scroll', {direction: 'down'});4driver.getOrientation();5driver.setOrientation('LANDSCAPE');6driver.getGeoLocation();7driver.setGeoLocation(0, 0);8driver.getNetworkConnection();9driver.setNetworkConnection(6);10driver.getLogTypes();11driver.getLog('syslog');12driver.logEvent('test');13driver.isLocked();14driver.lock(5);15driver.unlock();
Using AI Code Generation
1driver.executeCommand("mobile: scroll", {"direction":"down"});2driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Views\"));");3driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Views\"));");4driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollBackward();");5driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollBackward();");6driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollForward();");7driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollForward();");8driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Views\"));");9driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Views\"));");10driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollTo(text(\"Views\"
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!