Best JavaScript code snippet using appium
nrs.header.js
Source:nrs.header.js
1/******************************************************************************2 * Copyright © 2013-2016 The Nxt Core Developers. *3 * Copyright © 2016-2017 Jelurida IP B.V. *4 * *5 * See the LICENSE.txt file at the top-level directory of this distribution *6 * for licensing information. *7 * *8 * Unless otherwise agreed in a custom licensing agreement with Jelurida B.V.,*9 * no part of the Nxt software, including this file, may be copied, modified, *10 * propagated, or distributed except according to the terms contained in the *11 * LICENSE.txt file. *12 * *13 * Removal or modification of this copyright notice is prohibited. *14 * *15 ******************************************************************************/16/**17 * @depends {nrs.js}18 */19var NRS = (function(NRS, $) {20 function widgetVisibility(widget, depends) {21 if (NRS.isApiEnabled(depends)) {22 widget.show();23 } else {24 widget.hide();25 }26 }27 $(window).on('load', function() {28 widgetVisibility($("#header_send_money"), { apis: [NRS.constants.REQUEST_TYPES.sendMoney] });29 widgetVisibility($("#header_transfer_currency"), { apis: [NRS.constants.REQUEST_TYPES.transferCurrency] });30 widgetVisibility($("#header_send_message"), { apis: [NRS.constants.REQUEST_TYPES.sendMessage] });31 if (!NRS.isFundingMonitorSupported()) {32 $("#funding_monitor_menu_item").hide();33 }34 if (!NRS.isExternalLinkVisible()) {35 $("#api_console_li").hide();36 $("#database_shell_li").hide();37 }38 if (!NRS.isWebWalletLinkVisible()) {39 $("#web_wallet_li").remove();40 }41 });42 $("#refreshSearchIndex").on("click", function() {43 NRS.sendRequest("luceneReindex", {44 adminPassword: NRS.getAdminPassword()45 }, function (response) {46 if (response.errorCode) {47 $.growl(NRS.escapeRespStr(response.errorDescription));48 } else {49 $.growl($.t("search_index_refreshed"));50 }51 })52 });53 $("#header_open_web_wallet").on("click", function() {54 if (java) {55 java.openBrowser(NRS.accountRS);56 }57 });58 $("#client_status_modal").on("show.bs.modal", function() {59 if (NRS.isMobileApp()) {60 $("#client_status_description").text($.t("mobile_client_description", { url: NRS.getRemoteNodeUrl() }));61 $("#client_status_set_peer").hide();62 $("#client_status_remote_peer_container").hide();63 $("#client_status_blacklist_peer").hide();64 return;65 } else if (NRS.state.isLightClient) {66 $("#client_status_description").text($.t("light_client_description"));67 } else {68 $("#client_status_description").text($.t("api_proxy_description"));69 }70 if (NRS.state.apiProxyPeer) {71 $("#client_status_remote_peer").val(String(NRS.state.apiProxyPeer).escapeHTML());72 $("#client_status_set_peer").prop('disabled', true);73 $("#client_status_blacklist_peer").prop('disabled', false);74 } else {75 $("#client_status_remote_peer").val("");76 $("#client_status_set_peer").prop('disabled', false);77 $("#client_status_blacklist_peer").prop('disabled', true);78 }79 NRS.updateConfirmationsTable();80 });81 $("#client_status_remote_peer").keydown(function() {82 if ($(this).val() == NRS.state.apiProxyPeer) {83 $("#client_status_set_peer").prop('disabled', true);84 $("#client_status_blacklist_peer").prop('disabled', false);85 } else {86 $("#client_status_set_peer").prop('disabled', false);87 $("#client_status_blacklist_peer").prop('disabled', true);88 }89 });90 NRS.forms.setAPIProxyPeer = function ($modal) {91 var data = NRS.getFormData($modal.find("form:first"));92 data.adminPassword = NRS.getAdminPassword();93 return {94 "data": data95 };96 };97 NRS.forms.setAPIProxyPeerComplete = function(response) {98 var announcedAddress = response.announcedAddress;99 if (announcedAddress) {100 NRS.state.apiProxyPeer = announcedAddress;101 $.growl($.t("remote_peer_updated", { peer: String(announcedAddress).escapeHTML() }));102 } else {103 $.growl($.t("remote_peer_selected_by_server"));104 }105 NRS.updateDashboardMessage();106 };107 NRS.forms.blacklistAPIProxyPeer = function ($modal) {108 var data = NRS.getFormData($modal.find("form:first"));109 data.adminPassword = NRS.getAdminPassword();110 return {111 "data": data112 };113 };114 NRS.forms.blacklistAPIProxyPeerComplete = function(response) {115 if (response.done) {116 NRS.state.apiProxyPeer = null;117 $.growl($.t("remote_peer_blacklisted"));118 }119 NRS.updateDashboardMessage();120 };121 $(".external-link").on('click', function(e) {122 if (!NRS.isMobileApp()) {123 return;124 }125 e.preventDefault();126 window.open($(this).attr('href'), '_system');127 return false;128 });129 return NRS;...
index.js
Source:index.js
1import React, { Component } from 'react'2import Downshift from 'downshift'3import { withRouter } from 'react-router-dom'4import { connect } from 'react-redux'5import FontAwesomeIcon from '@fortawesome/react-fontawesome'6import PropTypes from 'prop-types'7import Item from './item'8import './search-bar.css'9class SearchBar extends Component {10 static propTypes = {11 history: PropTypes.shape({12 push: PropTypes.func.isRequired,13 }).isRequired,14 tokens: PropTypes.shape({15 blockNumber: PropTypes.number.isRequired,16 }).isRequired,17 envObjects: PropTypes.shape({18 FILE_BASE_URL: PropTypes.string.isRequired,19 }).isRequired,20 }21 itemClicked = (selection) => {22 const { history } = this.props23 history.push(`/token/${selection.tokenID}`)24 }25 itemCompute = (item) => (item ? item.value : '')26 render() {27 const { tokens, envObjects } = this.props28 const FILE_BASE_URL = envObjects ? envObjects.FILE_BASE_URL : null29 const tokenData = tokens.items30 const tokenSubmissions = Object.keys(tokenData).map((tokenID) => {31 const {32 name,33 ticker,34 address,35 symbolMultihash,36 clientStatus,37 inAppealPeriod,38 } = tokenData[tokenID]39 return {40 value: name || '',41 searchVal: name ? name.toLowerCase() : '',42 tokenID,43 name,44 ticker,45 address,46 symbolMultihash,47 clientStatus,48 inAppealPeriod,49 }50 })51 return (52 <div className="SearchBar">53 <FontAwesomeIcon icon="search" />54 <Downshift onChange={this.itemClicked} itemToString={this.itemCompute}>55 {({56 getInputProps,57 getItemProps,58 getMenuProps,59 isOpen,60 inputValue,61 }) => (62 <div className="SearchBar-box">63 <input64 {...getInputProps()}65 className="SearchBar-input"66 placeholder="Search tokens.."67 />68 {isOpen && tokenSubmissions.length > 0 && inputValue.length > 0 && (69 <ul {...getMenuProps()} className="SearchBar-results">70 {isOpen71 ? tokenSubmissions72 .filter(73 (item) =>74 inputValue.length > 0 &&75 (item.name76 .toLowerCase()77 .includes(inputValue.toLowerCase()) ||78 item.ticker79 .toLowerCase()80 .includes(inputValue.toLowerCase()) ||81 item.address.toLowerCase() ===82 inputValue.toLowerCase())83 )84 .sort((a, b) => {85 // Status of both items are within the same category86 // (not pending, pending, challenged), don't sort.87 if (88 (a.clientStatus === 0 && b.clientStatus === 1) ||89 (a.clientStatus === 2 && b.clientStatus === 3) ||90 (a.clientStatus === 4 && b.clientStatus === 5) ||91 (a.clientStatus === 1 && b.clientStatus === 0) ||92 (a.clientStatus === 3 && b.clientStatus === 2) ||93 (a.clientStatus === 5 && b.clientStatus === 4)94 )95 return 096 if (a.clientStatus > b.clientStatus) return -197 if (b.clientStatus > a.clientStatus) return 198 return 099 })100 .sort((a, b) =>101 // Display registered tokens before rejected ones.102 (a.clientStatus === 0 && b.clientStatus === 1) ||103 (a.clientStatus === 1 && a.clientStatus === 1)104 ? b.clientStatus - a.clientStatus105 : 0106 )107 .sort((a, b) => {108 // Show items crowdfunding state first.109 if (a.inAppealPeriod && !b.inAppealPeriod) return -1110 else if (!a.inAppealPeriod && b.inAppealPeriod)111 return 1112 else return 0113 })114 .map((item, index) => (115 <Item116 item={item}117 {...getItemProps({118 key: index,119 index,120 item,121 })}122 FILE_BASE_URL={FILE_BASE_URL}123 />124 ))125 : null}126 </ul>127 )}128 </div>129 )}130 </Downshift>131 </div>132 )133 }134}135export default withRouter(136 connect((state) => ({137 tokens: state.tokens.data,138 envObjects: state.envObjects.data,139 }))(SearchBar)...
CallsReturnTimeSet.js
Source:CallsReturnTimeSet.js
1/*2客æ·èªå®ä¹é
ç½®--代æ¶è´¹è®¾ç½®ä½¿ç¨å°çJS3ä½è
ï¼ç¨é彪4æ¥æï¼2012-08-165*/6//æ¡ä»¶æç´¢7function reloadData()8{9 var sProjectGUID = $('#ddlProjectGUID').val();10// var sKey = getObj("txtKey").value;11// alert(sProjectGUID)12 $('#jqData').getGridParam('postData').ProjectGUID = sProjectGUID;13// $('#jqData').getGridParam('postData').Key = sKey;14 refreshJQGrid('jqData');15}16//æ·»å 17function addVCallsReturnTimeSet() 18{ 19 var sProjectName = trim($("#ddlProjectGUID").find("option:selected").text());20 openAddWindow("VCallsReturnTimeSetAdd.aspx?ProjectGUID=" + $("#ddlProjectGUID").val() + "&ProjectName=" + encodeURIComponent(sProjectName), 800, 600, "jqData");21}22//ç¼è¾23function editVCallsReturnTimeSet()24{25 var sProjectName = trim($("#ddlProjectGUID").find("option:selected").text());26 openModifyWindow("VCallsReturnTimeSetEdit.aspx?ProjectGUID=" + $("#ddlProjectGUID").val() + "&ProjectName=" + encodeURIComponent(sProjectName), 800, 600, "jqData");27 28}29//å é¤30function deleteVCallsReturnTimeSet() 31{32 openDeleteWindow("CallsReturnTimeSet", 13, "jqData");33}34function validateSize() 35{36 handleBtn(false);37 if (!isPositiveInt(getObj("txtRankNo").value))38 {39 handleBtn(true);40 return alertMsg('è·è¿æ¥éª¤å¿
须为æ£æ´æ°ã', getObj('txtRankNo'));41 }42 if ($("#ddlTimeType").val() == "")43 {44 handleBtn(true);45 return alertMsg('请éæ©æ¶é´ç¹ç±»åã', getObj('ddlTimeType'));46 }47 if ($("#ddlClientStatus").val() == "")48 {49 handleBtn(true);50 return alertMsg('请éæ©æ¶é´ç¹ã', getObj('ddlClientStatus'));51 }52 if (!isPositiveInt(getObj("txtAfterDays").value))53 {54 handleBtn(true);55 return alertMsg('æ¶é´ç¹ä¹å天æ°å¿
须为æ£æ´æ°ã', getObj('txtAfterDays'));56 }57 return true;58}59function handleBtn(enabled) {60 setBtnEnabled(getObj("btnSaveOpen"), enabled);61 setBtnEnabled(getObj("btnSaveClose"), enabled);62}63function CalculationMethodChange()64{ 65 if (getObj("ddlCalculationMethod").selectedIndex != 3)66 {67 getObj("txtChargeMoney").value = "0.00";68 getObj("txtChargeMoney").style.borderColor = "#c0c4cf";69 getObj("txtChargeMoney").readOnly = true;70 }71 else72 {73 getObj("txtChargeMoney").style.borderColor = "";74 getObj("txtChargeMoney").readOnly = false;75 }76}77/* åæ¢æ¶é´ç¹ç±»åå è½½æ¶é´ç¹ æ°å¢ */78function TimeTypeChange()79{80 81 var TimeType = $("#ddlTimeType").val(); //æ¶é´ç¹ç±»å82 83 switch (TimeType)84 {85 case "1":86 SetClientStatus();87 break;88 case "2":89 GetIntentionConfigItem();90 break;91 default:92 DelIntentionConfigItem();93 break;94 }95}96function GetIntentionConfigItem()97{98 99 $.ajax(100 {101 url: "VCallsReturnTimeSetAdd.aspx",102 data: { action: "GetIntentionConfigItem" },103 dataType: "json",104 success: SetIntentionConfigItem,105 error: ajaxError106 });107}108//æ¸
空æ¶é´ç¹é项109function DelIntentionConfigItem()110{111 var ddlClientStatus = getObj("ddlClientStatus");112 for (var i = ddlClientStatus.length - 1; i > 0; i--)//ä¿ç表头â请éæ©â113 {114 ddlClientStatus.remove(i);115 }116}117// å è½½118function SetIntentionConfigItem(data, textStatus)119{120 var ddlClientStatus = getObj("ddlClientStatus");121 DelIntentionConfigItem();122 123 if (data.Count > 0)124 {125 126 for (var i = 0; i < data.Count; i++)127 {128 129 var opt = document.createElement("OPTION");130 opt.value = data.Nodes[i].ID;131 opt.text = data.Nodes[i].Name;132 ddlClientStatus.add(opt, ddlClientStatus.length);133 }134 getObj("hdClientStatus").value = data.Nodes[0].ID;135 }136}137function SetClientStatus()138{139 DelIntentionConfigItem();140 var ddlClientStatus = getObj("ddlClientStatus");141 ddlClientStatus.options.add(new Option("å¨è¯¢", "1"));142 ddlClientStatus.options.add(new Option("çæ¿", "2"));143 ddlClientStatus.options.add(new Option("é¢çº¦", "3"));144 ddlClientStatus.options.add(new Option("认è´", "4"));145 ddlClientStatus.options.add(new Option("ç¾çº¦", "5"));146 ddlClientStatus.options.add(new Option("å
¥ä¼", "6"));147 ddlClientStatus.options.add(new Option("丢失", "7"));148 getObj("hdClientStatus").value = "1";149}150function ClientStatusChange()151{152 //getObj("hdClientStatus").value = $("#ddlTimeType").val();153 getObj("hdClientStatus").value = $("#ddlClientStatus").val();...
home_clients.js
Source:home_clients.js
1// check client status, legal status, select order_by value, input search value2function validateSearchClients(client_status,legal_filter,sort_filter,local_search ){3 if(!isValidClientStatus(client_status)){4 return 1; 5 }else if(!isValidSortLegal(legal_filter)){6 return 2;7 }else if(!isValidSortOrder(sort_filter)){ 8 return 3; 9 }else if(!isValidString(local_search)){ 10 return 4; 11 }else{12 return false;13 }14}15 16$(document).ready(function(){17 $(".sandler_db").on('click',function(event){18 var myurl = $(this).attr('href');19 var client_status = myurl.split("/").pop();20 var legal_filter = '0';21 var sort_filter = '0';22 var local_search = '';23 event.preventDefault();24 var validate = validateSearchClients(client_status,legal_filter,sort_filter,local_search);25 if(validate){26 event.preventDefault();27 showErrorSearchClients(validate);28 }else{29 $.ajax({30 async: true,31 type:'GET',32 data:{client_status:client_status,legal_filter:legal_filter,sort_filter:sort_filter,local_search:local_search},33 url: url + 'clients',34 success: function(result){ 35 $('html,body').animate({36 scrollTop: $("#search_result").html(result).css({'padding-top':'70px','min-height':'700px'}).offset().top},37 'slow');38 $('#search').addClass('hidden');39 $('#local_search').removeClass('hidden');40 $(".pagination").addClass('client-pagination');41 },42 error: function(){43 noDataFromDB();44 }45 });46 }47 });48 $(document).on('click', '.client-pagination a',function(event){49 $('li').removeClass('active');50 $(this).parent('li').addClass('active');51 event.preventDefault();52 var client_status = $('#legal_filter').attr('name');53 var legal_filter = $('#legal_filter').val();54 var sort_filter = $('#sort_filter').val();55 var local_search = $('#local_search').val();56 var myurl = $(this).attr('href');57 var validate = validateSearchClients(client_status,legal_filter,sort_filter,local_search);58 if(validate){59 event.preventDefault();60 showErrorSearchClients(validate);;61 }else{ 62 $.ajax({63 async: true,64 type:'GET',65 data:{client_status: client_status, legal_filter:legal_filter, sort_filter:sort_filter, local_search: local_search},66 url: myurl,67 success: function(result){ 68 $('html,body').animate({69 scrollTop: $("#search_result").html(result).offset().top},70 'slow');71 $(".pagination").addClass('client-pagination');72 },73 error: function(){74 noDataFromDB();75 }76 });77 }78 });79 $(document).on('input', '#legal_filter, #sort_filter, #local_search',function(event){ 80 var client_status = $('#legal_filter').attr('name');81 var legal_filter = $('#legal_filter').val();82 var sort_filter = $('#sort_filter').val();83 var local_search = $('#local_search').val(); 84 event.preventDefault();85 var validate = validateSearchClients(client_status,legal_filter,sort_filter,local_search);86 if(validate){87 event.preventDefault();88 showErrorSearchClients(validate);89 }else{90 $.ajax({91 async: true,92 type:'GET',93 data:{client_status: client_status, legal_filter:legal_filter, sort_filter:sort_filter, local_search: local_search},94 url: url + 'clients',95 success: function(result){ 96 $('html,body').animate({97 scrollTop: $("#search_result").html(result).offset().top},98 'slow');99 $(".pagination").addClass('client-pagination');100 },101 error: function(){102 noDataFromDB();103 }104 });105 }106 });...
abort-during-done.window.js
Source:abort-during-done.window.js
1// META: title=XMLHttpRequest: abort() during DONE2 async_test(test => {3 var client = new XMLHttpRequest(),4 result = [],5 expected = [1, 4] // open() -> 1, send() -> 46 client.onreadystatechange = test.step_func(function() {7 result.push(client.readyState)8 })9 client.open("GET", "resources/well-formed.xml", false)10 client.send(null)11 assert_equals(client.readyState, 4)12 assert_equals(client.status, 200)13 assert_equals(client.statusText, "OK")14 assert_equals(client.responseXML.documentElement.localName, "html")15 client.abort()16 assert_equals(client.readyState, 0)17 assert_equals(client.status, 0)18 assert_equals(client.statusText, "")19 assert_equals(client.responseXML, null)20 assert_equals(client.getAllResponseHeaders(), "")21 assert_array_equals(result, expected)22 test.done()23 }, document.title + " (sync)")24 async_test(test => {25 var client = new XMLHttpRequest(),26 result = [],27 expected = [1, 4] // open() -> 1, send() -> 428 client.onreadystatechange = test.step_func(function() {29 result.push(client.readyState);30 if (client.readyState === 4) {31 assert_equals(client.readyState, 4)32 assert_equals(client.status, 200)33 assert_equals(client.statusText, "OK")34 assert_equals(client.responseXML.documentElement.localName, "html")35 client.abort();36 assert_equals(client.readyState, 0)37 assert_equals(client.status, 0)38 assert_equals(client.statusText, "")39 assert_equals(client.responseXML, null)40 assert_equals(client.getAllResponseHeaders(), "")41 test.done()42 }43 })44 client.open("GET", "resources/well-formed.xml", false)45 client.send(null)46 assert_equals(client.readyState, 0)47 assert_equals(client.status, 200)48 assert_equals(client.statusText, "OK")49 assert_equals(client.responseXML.documentElement.localName, "html")50 }, document.title + " (sync aborted in readystatechange)")51 async_test(test => {52 var client = new XMLHttpRequest(),53 result = [],54 expected = [1, 2, 3, 4]55 client.onreadystatechange = test.step_func(function() {56 result.push(client.readyState);57 if (client.readyState === 4) {58 assert_equals(client.readyState, 4)59 assert_equals(client.status, 200)60 assert_equals(client.responseXML.documentElement.localName, "html")61 client.abort();62 assert_equals(client.readyState, 0)63 assert_equals(client.status, 0)64 assert_equals(client.statusText, "")65 assert_equals(client.responseXML, null)66 assert_equals(client.getAllResponseHeaders(), "")67 test.step_timeout(function() {68 assert_array_equals(result, expected)69 test.done();70 }, 100); // wait a bit in case XHR timeout causes spurious event71 }72 })73 client.open("GET", "resources/well-formed.xml")74 client.send(null)...
ptt.js
Source:ptt.js
1var net = require('net');2var sleep = require('sleep');3var telnet = require('./telnet.js');4module.exports = {5 friends: function (client) {6 7 },8 write: function(client, data) {9 for (var i = 0; i < data.length; i++) {10 client.sock.write(data[i]);11 sleep.usleep(500000);12 }13 },14 logout: function (client) {15 client.sock.write('\033OD');16 client.sock.write('\033OD');17 client.sock.write('\033OD');18 client.sock.write('\r');19 client.sock.write('y');20 client.sock.write('\r');21 client.sock.write('\r');22 },23 login: function (client,pass) {24 client.sock = new net.Socket();25 client.user_idx=0;26 /*27 * 0: disconnect28 * 1: connected29 * 2: accounting30 * 3: accounting done31 * 4: passwording32 * 5: passwording done33 * 6: logined34 * -1: login fail35 */36 client.sock.connect('23', 'ptt.cc', function() {37 console.log('CONNECTED TO: ptt.cc:23');38 var mycmd = [[251,24,0,'VT100'],[251,31,80,24],[253,1],[253,3],[254,0],[252,0]];39 var data = telnet.cmd2data(mycmd);40 client.sock.write(data);41 client.status = 1;42 //console.log('mycmd: ' + mycmd.toString());43 //var ret = telnet.parsing(data);44 //console.log('mycmd2: ' + ret.cmd.toString());45 });46 client.sock.on('data', function(data){47 var ret = telnet.parsing(data);48 //console.log('cmd: ' + ret.cmd.toString());49 //console.log('DATA: ' + ret.data.toString());50 switch (client.status) {51 case 1:52 if (ret.data.length > 0) {53 if (ret.data[ret.data.length-1] == 0x08) {54 client.sock.write(client.user[client.user_idx++]);55 client.status = 2;56 }57 }58 break;59 case 2:60 if (ret.data.length > 0) {61 if (client.user_idx < client.user.length) {62 client.sock.write(client.user[client.user_idx++]);63 } else {64 if (client.utf8set === undefined) {65 client.utf8set = 1;66 client.sock.write(',');67 } else {68 client.sock.write('\r');69 client.status = 3;70 }71 }72 }73 break;74 case 3:75 client.status = 4;76 client.sock.write(pass);77 client.sock.write('\r');78 client.status = 5;79 break;80 case 5:81 var str = ret.data.toString();82 if (str.indexOf("guest") != -1) {83 client.status = -1;84 } else {85 client.status = 6;86 //make sure into main menu87 client.sock.write('\r\r');88 client.sock.write('\033OD');89 }90 break;91 case 6:92 client.datacb(ret.data);93 break;94 default:95 break;96 }97 });98 client.sock.on('close', function(){99 client.status = 0;100 client.endcb();101 });102 }...
ClientStatusSpec.js
Source:ClientStatusSpec.js
1describe("ClientStatus", function () {2 it("should assign the correct information for a pending status", function () {3 var clientStatus = new mifosX.models.ClientStatus();4 var pendingStatus = clientStatus.statusTypes["Pending"];5 expect(clientStatus.getStatus("Pending")).toEqual(pendingStatus);6 });7 it("should assign the correct information for an active status", function () {8 var clientStatus = new mifosX.models.ClientStatus();9 var activeStatus = clientStatus.statusTypes["Active"];10 expect(clientStatus.getStatus("Active")).toEqual(activeStatus);11 });12 it("should assign the correct information for a status that is a transfer in progress", function () {13 var clientStatus = new mifosX.models.ClientStatus();14 var transferInProgressStatus = clientStatus.statusTypes["Transfer in progress"];15 expect(clientStatus.getStatus("Transfer in progress")).toEqual(transferInProgressStatus);16 });17 it("should assign the correct information for a status that is a transfer on hold", function () {18 var clientStatus = new mifosX.models.ClientStatus();19 var transferOnHoldStatus = clientStatus.statusTypes["Transfer on hold"];20 expect(clientStatus.getStatus("Transfer on hold")).toEqual(transferOnHoldStatus);21 });22 describe("testing if a status is known", function () {23 it("should return true if statusTypes includes given status", function () {24 var clientStatus = new mifosX.models.ClientStatus();25 expect(clientStatus.statusKnown("Active")).toEqual(true);26 });27 it("should return false if statusTypes does not include a given status", function () {28 var clientStatus = new mifosX.models.ClientStatus();29 expect(clientStatus.statusKnown("Not included status")).toEqual(false);30 });31 });...
middleware.js
Source:middleware.js
1/**2 * @flow3 */4import {CLIENT_STATUS_CHANGED} from '../../actions/api';5import Api, {CLIENT_STATUS} from './index';6const middleware = ({dispatch, getState}) => next => action => {7 if (action.type === CLIENT_STATUS_CHANGED) {8 switch (action.status) {9 case CLIENT_STATUS.CONNECTING:10 case CLIENT_STATUS.DISCONNECTED:11 Api.instance.__rejectRunning();12 Api.instance.__rejectWeakPending();13 break;14 case CLIENT_STATUS.CONNECTED:15 Api.instance.__rejectRunning();16 Api.instance.__rejectWeakPending();17 Api.instance.__pollPending();18 break;19 case CLIENT_STATUS.SECURED:20 case CLIENT_STATUS.LOGGED_IN:21 Api.instance.__pollPending();22 break;23 }24 }25 return next(action);26};...
Using AI Code Generation
1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })8 .end();9var webdriverio = require('webdriverio');10var options = { desiredCapabilities: { browserName: 'chrome' } };11var client = webdriverio.remote(options);12 .init()13 .getTitle().then(function(title) {14 console.log('Title was: ' + title);15 })16 .end();17var webdriverio = require('webdriverio');18var options = { desiredCapabilities: { browserName: 'chrome' } };19var client = webdriverio.remote(options);20 .init()21 .getTitle().then(function(title) {22 console.log('Title was: ' + title);23 })24 .end();25var webdriverio = require('webdriverio');26var options = { desiredCapabilities: { browserName: 'chrome' } };27var client = webdriverio.remote(options);28 .init()29 .getTitle().then(function(title) {30 console.log('Title was: ' + title);31 })32 .end();33var webdriverio = require('webdriverio');34var options = { desiredCapabilities: { browserName: 'chrome' } };35var client = webdriverio.remote(options);36 .init()37 .getTitle().then(function(title) {38 console.log('Title was: ' + title);39 })40 .end();41var webdriverio = require('webdriverio');42var options = { desiredCapabilities: { browserName: 'chrome' } };43var client = webdriverio.remote(options);44 .init()45 .getTitle().then(function(title) {46 console.log('Title was: ' + title);47 })48 .end();
Using AI Code Generation
1var client = require('webdriverio').remote(options);2 .init()3 .status()4 .then(function(res) {5 console.log(res);6 })7 .end();8var client = require('webdriverio').remote(options);9 .init()10 .getSessions()11 .then(function(res) {12 console.log(res);13 })14 .end();15var client = require('webdriverio').remote(options);16 .init()17 .getSession()18 .then(function(res) {19 console.log(res);20 })21 .end();22var client = require('webdriverio').remote(options);23 .init()24 .getSource()25 .then(function(res) {26 console.log(res);27 })28 .end();29var client = require('webdriverio').remote(options);30 .init()31 .getAlertText()32 .then(function(res) {33 console.log(res);34 })35 .end();
Using AI Code Generation
1var wd = require('wd'),2 assert = require('assert'),3 colors = require('colors');4var desiredCap = {5};6var driver = wd.promiseChainRemote("
Using AI Code Generation
1var client = require('webdriverio').remote({2 desiredCapabilities: {3 }4});5 .init()6 .status()7 .then(function (res) {8 console.log(res);9 })10 .end();11{ build:12 { version: '0.17.0',13 time: '2014-08-10 16:53:43' },14 { name: 'Mac OS X',15 version: '10.10.1' },16 { version: '1.7.0_51' },17 { w3c: true,18 webdriver: true },19 { version: '0.16.0',20 { sha: 'f1c8d1a',21 branch: 'master' } } }
Using AI Code Generation
1client.status().then(function(status) {2 console.log(status);3});4{ build: { version: '1.5.3', revision: 'a88d5e2fd2c25325dc8a4966c3a948809af3e774' },5 os: { name: 'Mac OS X', arch: 'x86_64', version: '10.11.3' },6 java: { version: '1.8.0_66' } }7client.status()8client.sessions()9client.sessionCapabilities()10client.getOrientation()11client.setOrientation()12client.getGeoLocation()13client.setGeoLocation()14client.getNetworkConnection()15client.setNetworkConnection()16client.getPerformanceData()17client.getSettings()18client.updateSettings()19client.getAppStrings()20client.lock()21client.unlock()22client.isLocked()23client.background()24client.hideKeyboard()25client.isKeyboardShown()26client.openNotifications()27client.getDeviceTime()28client.setDeviceTime()29client.getDeviceTime()30client.getDeviceTime()
Using AI Code Generation
1client.status(function(err, status) {2 console.log(status);3});4### client.source(callback)5client.source(function(err, source) {6 console.log(source);7});8### client.window(callback)9client.window(function(err, window) {10 console.log(window);11});12### client.windowHandles(callback)13client.windowHandles(function(err, windowHandles) {14 console.log(windowHandles);15});16### client.windowSize(callback)17client.windowSize(function(err, windowSize) {18 console.log(windowSize);19});20### client.windowSize(width, height, callback)21client.windowSize(500, 600, function(err, windowSize) {22 console.log(windowSize);23});24### client.element(selector, callback)
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!!