How to use okButton.click method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

DeploymentPage_Cloud_eucalyptusec2.widgets.js

Source:DeploymentPage_Cloud_eucalyptusec2.widgets.js Github

copy

Full Screen

1/*2 * Copyright (C) 2009-2012 VMware, Inc. All rights reserved.3 *4 *  Licensed under the Apache License, Version 2.0 (the "License");5 *  you may not use this file except in compliance with the License.6 *  You may obtain a copy of the License at7 *     http://www.apache.org/licenses/LICENSE-2.08 *  Unless required by applicable law or agreed to in writing, software9 *  distributed under the License is distributed on an "AS IS" BASIS,10 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11 *  See the License for the specific language governing permissions and12 *  limitations under the License.13 */14 15DeploymentPage_Cloud_eucalyptusec2.widgets = {16    cloudServerService: ["wm.JsonRpcService", {service: "cloudServerService", sync: true}, {}],17	deploymentService: ["wm.JsonRpcService", {service: "deploymentService", sync: true}, {}],18    ImageListVar: ["wm.Variable", {type: "com.wavemaker.tools.cloudmgr.CloudImage", json: "[{name: 'server1', dataValue: 'server1'}, {name: 'server2', dataValue: 'server2'}]"}, {}],19    KeyPairListVar: ["wm.Variable", {type: "com.wavemaker.tools.cloudmgr.CloudKeyPair"}],20	VMTypeListVar: ["wm.Variable", {type: "EntryData", 21		json: "[{name: 'm1.small', dataValue: 'm1.small'}, {name: 'c1.medium', dataValue: 'c1.medium'}, {name: 'm1.large', dataValue: 'm1.large'}, {name: 'm1.xlarge', dataValue: 'm1.xlarge'}, {name: 'c1.xlarge', dataValue: 'c1.xlarge'}]"}],22	SecurityGroupListVar: ["wm.Variable", {type: "com.wavemaker.tools.cloudmgr.CloudSecurityGroup", json: "[{name: 'network1', dataValue: 'network1'}, {name: 'network2', dataValue: 'network2'}]"}],23    HostNamesVar: ["wm.Variable", {type: "com.wavemaker.tools.cloudmgr.CloudServer"}, {}],24    destTypeVar: ["wm.Variable", {type: "EntryData", json: "[{name: 'Server', dataValue: 'server'}, {name: 'Container', dataValue: 'container'}]"}],25	serverTypeVar: ["wm.Variable", {type: "EntryData", json: "[{name: 'Tomcat', dataValue: 'tomcat'}, {name: 'WebSphere', dataValue: 'websphere'}, {name: 'JBoss', dataValue: 'jboss'}, {name: 'WebLogic', dataValue: 'webLogic'}]"}],26	serviceProviderVar: ["wm.Variable", {type: "EntryData", 27		json: "[{name: 'Amazon', dataValue: 'amazon'}, {name: 'Eucalyptus', dataValue: 'eucalyptus'}, {name: 'OpSource', dataValue: 'opsource'}, {name: 'RackSpace', dataValue: 'rackspace'}]"}],28	layoutBox1: ["wm.Layout", {height: "100%"}, {}, {29	MainLayers: ["wm.Layers", {width: "100%", height: "100%"}, {}, {30	    CredentialLayer: ["wm.Layer", {width: "100%", height: "100%", margin: "10", border: "3", borderColor: "#B0BDD4"}, {}, {31		stepCredentialLabel: ["wm.Label", {_classes: {domNode: ["wm_FontSizePx_14px", "DeploymentHeader"]}, height: "38px", width: "96px", caption: "Enter Eucalyptus Cloud account information", margin: "0,0,5,0"}, {}, {32		    format: ["wm.DataFormatter", {}, {}]33		}],34		CredentialLayerPanel: ["wm.Panel", {height: "100%", width: "100%", margin: "6"},{}, {35		CredentialPanel:  ["wm.Panel", {height: "120px", width: "450px", layoutKind: "top-to-bottom"}, {}, {36		    //accessKeyId: ["wm.Text", {password: 1, width: "200px", caption: "Access Key Id", captionSize: "150px", height: "20px", displayValue: "WKy3rMzOWPouVOxK1p3Ar1C2uRBwa2FBXnCw", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],37			accessKeyId: ["wm.Text", {password: 1, width: "200px", caption: "Access Key Id", captionSize: "150px", height: "20px", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],38		    spacer111: ["wm.Spacer", {height: "5px", width: "250px"}, {}],39		    //secretAccessKey: ["wm.Text", {password: 1, width: "200px", caption: "Secret Access Key", captionSize: "150px", height: "20px",  displayValue: "JcoW4FMCieH2ts1MJLJZCTAe9vl7xLCrw64Q", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],40			secretAccessKey: ["wm.Text", {password: 1, width: "200px", caption: "Secret Access Key", captionSize: "150px", height: "20px", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],41			spacer113: ["wm.Spacer", {height: "5px", width: "250px"}, {}],42			//cloudIPAddr: ["wm.Text", {width: "200px", caption: "Cloud IP Address", captionSize: "150px", height: "20px", displayValue: "172.16.2.50", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],43			cloudIPAddr: ["wm.Text", {width: "200px", caption: "Cloud IP Address", captionSize: "150px", height: "20px", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],44			spacer115: ["wm.Spacer", {height: "5px", width: "250px"}, {}],45			//cloudPort: ["wm.Text", {width: "200px", caption: "Port", captionSize: "150px", height: "20px", displayValue: "8773", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],46			cloudPort: ["wm.Text", {width: "200px", caption: "Port", captionSize: "150px", height: "20px", changeOnKey: true}, {onEnterKeyPress: "CredentialOKButtonClick"}],47		}],48		spacer118: ["wm.Spacer", {height: "15px", width: "20px"}, {}],49		HelpPanel: ["wm.Panel", {height: "150px", width: "100%", layoutKind: "left-to-right"}, {}, {50			spacer337: ["wm.Spacer", {height: "5px", width: "100px"}, {}],51			helpLabel: ["wm.Html", {showing: false, height: "100%", width: "100%", singleLine: false,}],52		}],53		spacerButtonPanel1: ["wm.Spacer", {height: "100%"}],54		CredentialButtonPanel: ["wm.Panel", {height: "48px", width: "100%", layoutKind: "left-to-right", verticalAlign: "top", horizontalAlign: "right"}, {}, {55		    CredentialOKButton: ["wm.Button", {height: "48px", width: "150px", caption: "OK"}, {onclick: "CredentialOKButtonClick"}, {56			binding: ["wm.Binding", {}, {}, {57			    wire: ["wm.Wire", {"targetProperty":"disabled","expression":"!${accessKeyId.dataValue} || !${secretAccessKey.dataValue}"}, {}]58			}]59		    }],60			//spacer382: ["wm.Spacer", {height: "48px", width: "14px"}, {}],61			CredentialBackButton: ["wm.Button", {height: "48px", width: "150px", caption: "Back to Service Provider List"}, {onclick: "CredentialBackButtonClick"}]    62		}]63		}]64	    }],65	    CreateServersLayer: ["wm.Layer", {width: "100%", height: "100%", margin: "10", border: "3", borderColor: "#B0BDD4"}, {onShow: "createServerShow"}, {66		CreateServersLabel: ["wm.Label", {_classes: {domNode: ["wm_FontSizePx_14px", "DeploymentHeader"]}, height: "38px", width: "100%", caption: "Create Server", margin: "0,0,5,0"}],67		CreateServerLayerPanel: ["wm.Panel", {height: "100%", width: "100%", margin: "6"},{}, {68		69			CreateServerOptionsPanel1:  ["wm.Panel", {height: "175px", width: "100%", layoutKind: "left-to-right"}, {}, {70				ImageListPanel: ["wm.Panel", {height: "100%", width: "45%", layoutKind: "top-to-bottom"}, {}, {71					ImageListLabel: ["wm.Label", {height: "20px", width: "100%", caption: "Choose a server image"}],72					ImageList: ["wm.List", {width: "100%", height: "100%", 73						dataFields: "id,description,OS",74						border: "2", borderColor: "rgb(120,120,120)", headerVisible: true}, {}, {75						binding: ["wm.Binding", {}, {}, {76							wire: ["wm.Wire", {targetProperty: "dataSet", source: "ImageListVar"}, {}]77						}]78					}],79				}],80			81				optionsSpacer2: ["wm.Spacer", {height: "48px", width: "14px"}, {}],		    82				SecurityGroupPanel: ["wm.Panel", {height: "100%", width: "55%", layoutKind: "top-to-bottom"}, {}, {83					SecurityGroupLabel: ["wm.Label", {height: "20px", width: "100%", caption: "Choose security groups"}],84					SecurityGroupList: ["wm.List", {width: "100%", height: "100%", multiSelect: true,85						dataFields: "name,description,owner", 86						border: "2", borderColor: "rgb(120,120,120)", headerVisible: true}, {}, {87						binding: ["wm.Binding", {}, {}, {88						wire: ["wm.Wire", {targetProperty: "dataSet", source: "SecurityGroupListVar"}, {}]89						}]90					}],91				}],92			}],93			spacer281: ["wm.Spacer", {height: "10px"}],94			CreateServerOptionsPanel2:  ["wm.Panel", {height: "135px", width: "100%", layoutKind: "left-to-right"}, {}, {95				//KeyPairListPanel: ["wm.Panel", {height: "135px", width: "100%", layoutKind: "top-to-bottom"}, {}, {96				KeyPairListPanel: ["wm.Panel", {height: "100%", width: "65%", layoutKind: "top-to-bottom"}, {}, {97					KeyPairListLabel: ["wm.Label", {height: "20px", width: "100%", caption: "Choose an SSH key pair"}],98					KeyPairList: ["wm.List", {width: "100%", height: "100%", 99						dataFields: "keyname, fingerprint, material",100						border: "2", borderColor: "rgb(120,120,120)", headerVisible: true}, {}, {101						binding: ["wm.Binding", {}, {}, {102							wire: ["wm.Wire", {targetProperty: "dataSet", source: "KeyPairListVar"}, {}]103						}]104					}],105				}],106				Spacer211: ["wm.Spacer", {height: "48px", width: "14px"}, {}],	107				VMTypeListPanel: ["wm.Panel", {height: "100%", width: "35%", layoutKind: "top-to-bottom"}, {}, {108					VMTypeListLabel: ["wm.Label", {height: "20px", width: "100%", caption: "Choose or enter a VM type.  The list may not be complete"}],109					VMTypeList: ["wm.SelectMenu", {captionSize: "95px", captionAlign: "left", width: "100%", height: "24px", displayField: "name", dataField: "dataValue"}, {}, {110					binding: ["wm.Binding", {}, {}, {111						wire: ["wm.Wire", {targetProperty: "dataSet", source: "VMTypeListVar"}, {}]112					}]113				}],114				}],115			}],116			spacerButtonPanel5: ["wm.Spacer", {height: "100%"}],117			CreateServerButtonPanel: ["wm.Panel", {height: "48px", width: "100%", layoutKind: "left-to-right", verticalAlign: "top", horizontalAlign: "right"}, {}, {118				CreateServerButton: ["wm.Button", { caption: "Create", width: "150px", height: "100%"}, {onclick: "createServerClick"}, {119				binding: ["wm.Binding", {}, {}, {120					wire: ["wm.Wire", {"targetProperty":"disabled","expression":"${SecurityGroupList.emptySelection} || ${ImageList.emptySelection}"}, {}]121				}]122				}],123				//spacer388: ["wm.Spacer", {height: "48px", width: "14px"}, {}],124				CreateServerBackButton: ["wm.Button", { caption: "Back to Server List", width: "150px", height: "100%", }, {onclick: "createServerBackClick"}]		    125			}]126			}],127	    }],128		TargetPropertiesLayer: ["wm.Layer", {width: "100%", height: "100%", margin: "10", border: "3", borderColor: "#B0BDD4"}, {onShow: "setDefaultProperties"}, {129			TargetPropertiesLabel: ["wm.Label", {_classes: {domNode: ["wm_FontSizePx_14px", "DeploymentHeader"]}, height: "38px", width: "100%", caption: "Server Properties", margin: "0,0,5,0"}],130			TargetPropertiesLayerPanel: ["wm.Panel", {height: "100%", width: "100%", margin: "6"},{}, {131				targetName: ["wm.Text", {captionSize: "115px", captionAlign: "left", caption: "Name", width: "100%", height: "24px", changeOnKey: true}],132				targetDescription: ["wm.Text", {captionSize: "115px", captionAlign: "left", caption: "Description", width: "100%", height: "24px", changeOnKey: true}],133				destType: ["wm.SelectMenu", {captionSize: "115px", captionAlign: "left", caption: "Destination Type", width: "100%", height: "24px", displayField: "name", dataField: "dataValue"}, {}, {134					binding: ["wm.Binding", {}, {}, {135						wire: ["wm.Wire", {targetProperty: "dataSet", source: "destTypeVar"}, {}]136					}]137				}],138				serviceProvider: ["wm.SelectMenu", {captionSize: "115px", captionAlign: "left", caption: "Service Provider", width: "100%", height: "24px", displayField: "name", dataField: "dataValue"}, {}, {139					binding: ["wm.Binding", {}, {}, {140						wire: ["wm.Wire", {targetProperty: "dataSet", source: "serviceProviderVar"}, {}]141					}]142				}],143				serverType: ["wm.SelectMenu", {captionSize: "115px", captionAlign: "left", caption: "App Server", width: "100%", height: "24px", displayField: "name", dataField: "dataValue"}, {}, {144					binding: ["wm.Binding", {}, {}, {145						wire: ["wm.Wire", {targetProperty: "dataSet", source: "serverTypeVar"}, {}]146					}]147				}],148				dnsHost: ["wm.Text", {captionSize: "115px", captionAlign: "left", caption: "Host Name", width: "100%", height: "24px", changeOnKey: true}],149				portNumber: ["wm.Text", {captionSize: "115px", captionAlign: "left", caption: "Port", width: "100%", height: "24px", changeOnKey: true}],150				serverUser: ["wm.Text", {captionSize: "115px", captionAlign: "left", caption: "User", 151							width: "100%", height: "24px", displayValue: "", emptyValue: "", changeOnKey: true}],152				serverPassword1: ["wm.Text", {password: 1, captionSize: "115px", captionAlign: "left", caption: "Enter Password", 153							width: "100%", height: "24px", displayValue: "", emptyValue: "", changeOnKey: true}],154				serverPassword2: ["wm.Text", {password: 1, captionSize: "115px", captionAlign: "left", caption: "Confirm Password", 155							width: "100%", height: "24px", displayValue: "", emptyValue: "", changeOnKey: true}],156			157				spacer389: ["wm.Spacer", {height: "8px", width: "14px"}, {}],158				overrideFlag: ["wm.CheckBoxEditor", {captionSize: "230px", captionAlign: "left", caption: "Override information if already exists?", 159					width: "100%", layoutKind: "left-to-right", displayValue: true, emptyValue: "false"}, {}, {160						editor: ["wm._CheckBoxEditor", {dataType: "boolean"}, {}]161				}],162				163				spacerButtonPanel5: ["wm.Spacer", {height: "100%"}],164				TargetPropertiesButtonPanel: ["wm.Panel", {height: "48px", width: "100%", layoutKind: "left-to-right", 165						verticalAlign: "top", horizontalAlign: "right"}, {}, {166					TargetPropertiesOKButton: ["wm.Button", { caption: "OK", width: "150px", height: "100%"}, 167						{onclick: "targetPropertiesOKClick"}, {168						binding: ["wm.Binding", {}, {}, {169							wire: ["wm.Wire", {"targetProperty":"disabled","expression":"!${targetName.dataValue} || !${targetDescription.dataValue}"}, {}]170						}]171					}],172					//spacer389: ["wm.Spacer", {height: "48px", width: "14px"}, {}],173					TargetPropertiesBackButton: ["wm.Button", { caption: "Back to Server List", width: "150px", height: "100%", }, {onclick: "targetPropertiesBackClick"}]	174				}],175			}],176		}],177	    178		ServerListLayer: ["wm.Layer", {width: "100%", height: "100%", margin: "10", border: "3", borderColor: "#B0BDD4"}, {}, {179		ServerListLabel: ["wm.Label", {_classes: {domNode: ["wm_FontSizePx_14px", "DeploymentHeader"]}, height: "38px", width: "100%", caption: "Server List", margin: "0,0,5,0"}],180		181		ServerListLayerPanel: ["wm.Panel", {height: "100%", width: "100%", margin: "6"},{}, {182		HostListPanel:  ["wm.Panel", {height: "255px", width: "450px", layoutKind: "top-to-bottom"}, {}, {183		    HostListLabel: ["wm.Label", {height: "20px", width: "100%", caption: "Choose a server"}],184		    HostList: ["wm.List", {toggleSelect: true, width: "100%", height: "100%",  185				dataFields: "serverId, dnsHost, created, imageId", 186				columnWidths: "85px, 180px, 100px, 100px",187				headerVisible: true, border: "2", borderColor: "rgb(120,120,120)"}, {}, {188			binding: ["wm.Binding", {}, {}, {189			    wire: ["wm.Wire", {targetProperty: "dataSet", source: "HostNamesVar"}, {}]190			}]191		    }],192		}],193		194		spacer383: ["wm.Spacer", {height: "85px", width: "14px"}, {}],195		HostListButtonPanel: ["wm.Panel", {height: "48px", width: "100%", layoutKind: "left-to-right", verticalAlign: "top", horizontalAlign: "right"}, {}, {196		    HostListRefreshButton: ["wm.Button", { caption: "Refresh", width: "150px", height: "100%"}, {onclick: "serverListRefreshClick"}],197			//spacer358: ["wm.Spacer", {height: "48px", width: "14px"}, {}],198			199			HostListCreateButton: ["wm.Button", { caption: "Create", width: "150px", height: "100%"}, {onclick: "collectServerBaseInfo"}],200			//spacer361: ["wm.Spacer", {height: "48px", width: "14px"}, {}],201			HostListTerminateButton: ["wm.Button", { caption: "Terminate", width: "150px", height: "100%"}, {onclick: "deleteServerClick"}, {202				binding: ["wm.Binding", {}, {}, {203					wire: ["wm.Wire", {"targetProperty":"disabled","source":"HostList.emptySelection"}, {}]204				}]205		    }],206			//spacer385: ["wm.Spacer", {height: "48px", width: "14px"}, {}],207			HostListDepTargetButton: ["wm.Button", { caption: "Add to Deployment Target Table", width: "150px", height: "100%"}, {onclick: "addToDepTargetClick"}, {208				binding: ["wm.Binding", {}, {}, {209					wire: ["wm.Wire", {"targetProperty":"disabled","source":"HostList.emptySelection"}, {}]210				}]211		    }],212			//spacer386: ["wm.Spacer", {height: "48px", width: "14px"}, {}],213			HostListBackButton: ["wm.Button", { caption: "Back to Enter Credentials", width: "150px", height: "100%"}, {onclick: "serverListBackClick"}]		    214		}]215		}]216	    }]217	}]218    }]...

Full Screen

Full Screen

twitterActions.js

Source:twitterActions.js Github

copy

Full Screen

1function retweet(tweetObj, url){2  var tweetid = tweetObj.id_str;3  var text = tweetObj.text;4  var screen_name = tweetObj.user.screen_name;5  $("#dialog").remove();6  $(document.body).append("<div id='dialog'><div id='dialog_content'><div class='tweetConfirm'>"+ formatTweet(tweetObj) +7                          "</div><div class='clear'></div>"+8                          " Retweet this? <div class='clear'></div><button id='okbutton'>"+9                          " OK </button> <button id='cancelbutton'> Cancel </button><button id='editbutton'> Edit </button>"+10                          "<div class='clear'></div></div></div>");11  if (url)12    appendFBLike(url, $("#dialog_content"));13  $("#okbutton").click(function(e){14    $(e.target).attr("disabled", true);15    $.ajax({16      type: 'POST',17      url:"/retweet.php?tweet_id=" + tweetid,18      success: function(){ 19        $("#dialog_content").html("Retweeted"); 20        setTimeout(function(){21          $("#dialog").remove();22        }, 3000);23      },24      error: function() {showLogin();}25    });26  });27  $("#cancelbutton").click(function(){28    $("#dialog").remove();29  });30  $("#editbutton").click(function(){31    tweet("RT @" + screen_name + " " +text); 32  });33}34function tweet(Text){35  $("#dialog").remove();36  $(document.body).append("<div id='dialog'><div id='dialog_content'> What's happening? "+37    "<div class='clear'></div><textarea id='tweetText' rows='5' cols='45'>" + 38    "</textarea><div class='clear'></div><button id='okbutton'> OK </button> "+39    "<button id='cancelbutton'> Cancel </button> <span id='textCounter'></span><div class='clear'></div></div></div>");40  if (Text)41    $("#tweetText")[0].value = Text;42  $("#textCounter").html(140 - $("#tweetText")[0].value.length);43  $("#okbutton").click(function(e){44    $(e.target).attr("disabled", true);45    $.ajax({46      type: 'POST',47      url:"/reply.php?tweet_text="+ escape($("#tweetText")[0].value),48      success: function(){ 49        $("#dialog_content").html("Tweet sent"); 50        setTimeout(function(){51          $("#dialog").remove();52        }, 3000);53      },54      error: function() {showLogin();}55    });56  });57  $("#cancelbutton").click(function(){58    $("#dialog").remove();59  });60}61function reply(tweet){62  tweetid = tweet.id_str;63  var additionals = typeof tweet.retweeted_status != 'undefined' ? " @" + tweet.retweeted_status.user.screen_name : "";64  additionals += typeof official_hashtag != 'undefined' ? " " + official_hashtag : "";65  $("#dialog").remove();66  $(document.body).append("<div id='dialog'><div id='dialog_content'><div class='tweetConfirm'>"+formatTweet(tweet)+67    "</div><div class='clear'></div><textarea id='replyText' rows='5' cols='45'>@" + 68    tweet.user.screen_name + additionals + "</textarea>" +69    " <div class='clear'></div><button id='okbutton'> OK </button> "+70    "<button id='cancelbutton'> Cancel </button> <span id='textCounter'></span><div class='clear'></div> </div></div>");71  $("#textCounter").html(140 - $("#replyText")[0].value.length);72  $("#okbutton").click(function(e){73    $(e.target).attr("disabled", true);74    $.ajax({75      type: 'POST',76      url:"/reply.php?tweet_id=" + tweetid + "&tweet_text="+ escape($("#replyText")[0].value),77      success: function(){ 78        $("#dialog_content").html("Reply sent"); 79        setTimeout(function(){80          $("#dialog").remove();81        }, 3000);82      },83      error: function() {showLogin();}84    });85  });86  $("#cancelbutton").click(function(){87    $("#dialog").remove();88  });89}90function favorite(tweet, url){91  tweetid = tweet.id_str;92  $("#dialog").remove();93  $(document.body).append("<div id='dialog'> <div id='dialog_content'><div class='tweetConfirm'>"+94                          formatTweet(tweet)+"</div><div class='clear'></div>"+95                          " Favorite this? <div class='clear'></div><button id='okbutton'>"+96                          " OK </button> <button id='cancelbutton'> Cancel </button><div class='clear'></div> </div></div>");97  if (url)98    appendFBLike(url, $("#dialog_content"));99  $("#okbutton").click(function(e){100    $(e.target).attr("disabled", true);101    $.ajax({102      type: 'POST',103      url:"/favorite.php?tweet_id=" + tweetid,104      success: function(){ 105        $("#dialog_content").html("Favorited"); 106        setTimeout(function(){107          $("#dialog").remove();108        }, 3000);109      },110      error: function() {showLogin();}111    });112  });113  $("#cancelbutton").click(function(){114    $("#dialog").remove();115  });116}117function showLogin(){118  $("#dialog_content").html("Failed"); 119  setTimeout(function(){120    $("#dialog").remove();121  }, 3000);...

Full Screen

Full Screen

RestrictionEnzymeController.js

Source:RestrictionEnzymeController.js Github

copy

Full Screen

1Ext.define("Vesa.controller.RestrictionEnzymeController", {2    extend: "Ext.app.Controller",3    requires: ["Teselagen.manager.RestrictionEnzymeGroupManager"],4    GroupManager: null,5    managerWindow: null,6    enzymeSelector: null,7    init: function() {8        this.GroupManager = Teselagen.manager.RestrictionEnzymeGroupManager;9        this.control({10            "#enzymeGroupSelector": {11                change: this.onEnzymeGroupSelected12            },13            "#enzymeSearchField": {14                keyup: this.onEnzymeSearchFieldKeyup15            },16            "#restrictionEnzymesManagerOKButton": {17                click: this.onOKButtonClick18            },19            "#saveGroupButton": {20                click: this.onSaveButtonClick21            },22            "#deleteGroupButton": {23                click: this.onDeleteGroupButtonClick24            },25        });26        this.application.on({27            RestrictionEnzymeManagerOpened: this.onEnzymeManagerOpened, 28            scope: this29        });30    },31    /**32     * Populates the group selector combobox when the restriction enzyme33     * manage window is opened.34     */35    onEnzymeManagerOpened: function(manager) {36        this.managerWindow = manager;37        this.enzymeSelector = manager.query("#enzymeSelector")[0];38        if(!this.GroupManager.getIsInitialized()) {39            this.GroupManager.initialize();40        }41        var nameData = [];42        var groupSelector = this.managerWindow.query("#enzymeGroupSelector")[0];43        Ext.each(this.GroupManager.getGroupNames(), function(name) {44            groupSelector.store.add({name: name});45        });46        // Set the value in the combobox to the first element by default.47        groupSelector.setValue(groupSelector.store.getAt("0").get("name"));48        // Load data into the enzyme selector.49        var startGroup = this.GroupManager.groupByName(groupSelector.getValue());50        var groupArray = [];51        Ext.each(startGroup.getEnzymes(), function(enzyme) {52            groupArray.push({name: enzyme.getName()});53        });54        this.enzymeSelector.store.loadData(groupArray);55        this.enzymeSelector.bindStore(this.enzymeSelector.store);56        this.displayActiveGroup();57    },58    displayActiveGroup: function() {59        var activeGroup = this.GroupManager.getActiveGroup();60        var names = [];61        Ext.each(activeGroup.getEnzymes(), function(enzyme) {62            names.push({name: enzyme.getName()});63        }, this);64        this.enzymeSelector.toField.store.loadData(names, false);65        this.enzymeSelector.toField.bindStore(this.enzymeSelector.toField.store);66    },67    /**68     * Populates the itemselector field with enzyme names.69     * Called when the user selects a new group in the combobox.70     */71    onEnzymeGroupSelected: function(combobox) {72        var newGroup = this.GroupManager.groupByName(combobox.getValue());73        var newStoreData = [];74        var enzymeArray = [];75        Ext.each(newGroup.getEnzymes(), function(enzyme) {76            enzymeArray.push({name: enzyme.getName()});77        });78        this.enzymeSelector.fromField.store.loadData(enzymeArray, false);79        this.enzymeSelector.fromField.bindStore(this.enzymeSelector.fromField.store);80    },81    onEnzymeSearchFieldKeyup: function(field) {82        this.enzymeSelector.fromField.store.filterBy(function(rec) {83            if(rec.data.name.search(new RegExp(field.getValue(), "i")) != -1) {84                return true;85            }86        });87        this.enzymeSelector.fromField.bindStore(this.enzymeSelector.fromField.store);88    },89    /**90     * Saves active enzymes and closes the window.91     */92    onOKButtonClick: function() {93        var names = [];94        this.enzymeSelector.toField.store.each(function(obj) {95            names.push(obj.data.name);96        });97        var newActiveGroup = this.GroupManager.createGroupByEnzymes("active", 98                                                                    names);99        this.managerWindow.close();100        if(newActiveGroup !== this.GroupManager.getActiveGroup()){101            this.GroupManager.setActiveGroup(newActiveGroup);102            this.application.fireEvent("ActiveEnzymesChanged");103        }104    }...

Full Screen

Full Screen

SaveAsWindowController.js

Source:SaveAsWindowController.js Github

copy

Full Screen

1Ext.define("Vede.controller.VectorEditor.SaveAsWindowController", {2    extend: "Vede.controller.VectorEditor.SequenceEditingController",3    requires: ["Teselagen.manager.SequenceFileManager",4               "Teselagen.manager.ProjectManager",5               "Teselagen.manager.VectorEditorManager",6               "Teselagen.event.ProjectEvent",7               "Teselagen.event.SequenceManagerEvent",8               "Teselagen.bio.parsers.ParsersManager",9               "Teselagen.constants.Constants"],10    sequenceManager: null,11    sequenceGrid: null,12    sequenceNameField: null,13    onSequenceManagerChanged: function(sequenceManager) {14        this.sequenceManager = sequenceManager;15    },16    onWindowShow: function() {17        this.sequenceGrid = Ext.getCmp('saveAsWindowSequencesGrid');18        this.sequenceNameField = Ext.getCmp('saveAsWindowSequenceNameField');19        Teselagen.manager.ProjectManager.sequences.clearFilter();20        Teselagen.manager.ProjectManager.sequences.loadPage(1);21        this.sequenceGrid.reconfigure(Teselagen.manager.ProjectManager.sequences);22        this.sequenceNameField.setValue(this.sequenceManager.getName());23    },24    onGridItemClick: function(grid, sequence, el) {25        this.sequenceNameField.setValue(sequence.get('name'));26    },27    onSaveAsWindowOKButtonClick: function() {28        this.sequenceGrid = Ext.getCmp('saveAsWindowSequencesGrid');29        var workingSequence = Teselagen.manager.ProjectManager.workingSequence;30        var sequencesNames = [];31        var name = Ext.String.trim(this.sequenceNameField.getValue());32        if(!name || name.match(/^\s*$/) || !name.length) {33            this.sequenceNameField.setFieldStyle("border-color:red");34        } else {35            var genbank = this.sequenceManager.toGenbank();36            var locus = genbank.getLocus();37            locus.locusName = name;38            genbank.setLocus(locus);39            // May not work with non-genbank files.40            var newSequenceFile = Ext.create("Teselagen.models.SequenceFile", {41                sequenceFileFormat: workingSequence.data.sequenceFileFormat,42                sequenceFileContent: genbank.toString(),43                sequenceFileName: workingSequence.data.sequenceFileName,44                partSource: workingSequence.data.partSource,45                name: name46            });47            newSequenceFile.save({48                success: function () {49                    var duplicated = JSON.parse(arguments[1].response.responseText).duplicated;50                    if(!duplicated) {51                        Vede.application.fireEvent(Teselagen.event.ProjectEvent.LOAD_PROJECT_TREE, function () {52                            Ext.getCmp("mainAppPanel").getActiveTab().el.unmask();53                            Teselagen.manager.ProjectManager.openSequence(newSequenceFile);54                        });55                        // this.sequenceGrid.store.clearFilter();56                        Ext.getCmp('SaveAsWindow').close();57                    } else {58                        Ext.MessageBox.alert('', 'A sequence with the name "' +59                            name + '" already exists. \nPlease select another name.');60                    }61                },62                failure: function() {63                    Ext.MessageBox.alert('', 'Error saving sequence. Please try again.');64                }65            });66        }67    },68    onTabChange: function(mainAppPanel, newTab) {69        if(newTab.initialCls === "VectorEditorPanel") {70            this.onSequenceManagerChanged(newTab.model);71        }72    },73    init: function() {74        this.control({75            '#mainAppPanel': {76                tabchange: this.onTabChange77            },78            '#SaveAsWindow': {79                show: this.onWindowShow80            },81            '#saveAsWindowSequencesGrid': {82                itemclick: this.onGridItemClick83            },84            '#saveAsWindowOKButton': {85                click: this.onSaveAsWindowOKButtonClick86            }87        });88        this.application.on(Teselagen.event.SequenceManagerEvent.SEQUENCE_MANAGER_CHANGED,89                            this.onSequenceManagerChanged, this);90    }...

Full Screen

Full Screen

appium-test-wd.js

Source:appium-test-wd.js Github

copy

Full Screen

1import path from 'path';2import * as wd from 'wd';3import * as capabilities from '../capabilities';4import {DEVICE_TIMEOUT, JEST_TIMEOUT, TARGET_PLATFORM} from '../constants';5describe('Create Android session (wd)', () => {6  let driver;7  beforeAll(async () => {8    jest.setTimeout(JEST_TIMEOUT);9    const {capabilities: deviceConfig, ...serverConfig} = capabilities[TARGET_PLATFORM];10    if (process.env.BROWSERSTACK) {11      deviceConfig.name = path.basename(__filename, path.extname(__filename));12    }13    console.debug('[beforeAll] initializing driver serverConfig %j and capabilities %j', serverConfig, deviceConfig);14    // Connect to Appium server15    driver = await wd.promiseChainRemote(serverConfig);16    // Start the session17    await driver.init(deviceConfig)18      .setImplicitWaitTimeout(DEVICE_TIMEOUT)19      .sleep(5000);20    console.info('[beforeAll] driver initialized %j', driver);21  });22  afterAll(async () => {23    await driver.quit();24  });25  // NOTE-RT: BrowserStack doesn't seem to support `getCurrentPackage`26  xit('verify the running application', async () => {27    // Check that we're running the ApiDemos app by checking package and activity28    const activity = await driver.getCurrentActivity();29    const pkg = await driver.getCurrentPackage();30    expect(`${pkg}${activity}`).toBe('com.apktest.MainActivity');31  });32  it('Press alert button and press OK', async () => {33    console.log('REGULAR BUTTON');34    let button = await driver.elementByAccessibilityId('test-button-1');35    // console.log(button)36    await button.click();37    // Click alert message button38    let okbutton = await driver.element('id', 'android:id/button1');39    console.log('OK');40    // console.log(okbutton);41    await okbutton.click();42  });43  it('Press alert button and press Cancel', async () => {44    console.log('REGULAR BUTTON');45    let button = await driver.elementByAccessibilityId('test-button-1');46    // console.log(button)47    await button.click();48    // Click alert message button49    let okbutton = await driver.element('id', 'android:id/button2');50    console.log('CANCEL');51    // console.log(okbutton);52    await okbutton.click();53  });54  it('Press second button and press OK', async () => {55    console.log('REGULAR BUTTON');56    let button = await driver.elementByAccessibilityId('test-button-2');57    // console.log(button)58    await button.click();59    // Click alert message button60    let okbutton = await driver.element('id', 'android:id/button1');61    console.log('OK');62    // console.log(okbutton);63    await okbutton.click();64  });65  it('Press alert button and press Cancel', async () => {66    console.log('REGULAR BUTTON');67    let button = await driver.elementByAccessibilityId('test-button-2');68    // console.log(button)69    await button.click();70    // Click alert message button71    let okbutton = await driver.element('id', 'android:id/button2');72    console.log('CANCEL');73    // console.log(okbutton);74    await okbutton.click();75  });76  77  it('Press Google Sign in and sign in succesfully', async () => {78    console.log('Google SIGNIN');79    let button = await driver.elementByAccessibilityId('google-signinbutton');80    // console.log(button)81    await button.click();82    await driver.sleep(5000)83    let contexts = await driver.contexts();84    console.log(contexts)85    await driver.context('WEBVIEW_chrome')86    let context = await driver.currentContext();87    console.log(context)88  });...

Full Screen

Full Screen

OKCloseCancelButtonsPlugin.js

Source:OKCloseCancelButtonsPlugin.js Github

copy

Full Screen

1/*2* OKCloseCancelButtonsPlugin - Handles the OK, Close and Cancel buttons3*/4function OKCloseCancelButtonsPlugin()5{6    this.m_strCloseFunctionName = undefined;7    8    OKCloseCancelButtonsPlugin.Base.constructor.apply( this );9}10UberObject.Base( OKCloseCancelButtonsPlugin, Plugin );1112Object.extend( OKCloseCancelButtonsPlugin.prototype, {13    loadConfigParams: function()14    {15        OKCloseCancelButtonsPlugin.Base.loadConfigParams.apply( this );16        this.extendConfigParams( {17            m_strCloseFunctionName: { type: 'string', bRequired: false }18        } );19    },2021    RegisterMessageHandlers: function()22    {23        this.RegisterListenerObject( { message: 'registerdomeventhandlers', 24	            listener: this.OnRegisterDomEventHandlers, context: this } );25	    26	    this.extendPlugged( 'setOKText', this );27	    28	    OKCloseCancelButtonsPlugin.Base.RegisterMessageHandlers.apply( this, arguments );29    },3031    OnRegisterDomEventHandlers: function()32    {33        var objPlugged = this.getPlugged();3435        objPlugged.attachButton( 'elementCloseButton', this.OnCloseButtonClick, this );36        objPlugged.attachButton( 'elementOKButton', this.OnOKButtonClick, this );37        objPlugged.attachButton( 'elementCancelButton', this.OnCancelButtonClick, this );38    },3940    /**41    * OnCloseButtonClick - Hides ourselves42    */43    OnCloseButtonClick: function( in_objEvent )44    {45        this._doButtonAction( 'close' );46    },4748    /**49    * OnOKButtonClick - Hides ourselves50    */51    OnOKButtonClick: function( in_objEvent )52    {53        this._doButtonAction( 'submit' );54    },5556    /**57    * OnCancelButtonClick - Hides ourselves58    */59    OnCancelButtonClick: function( in_objEvent )60    {61        this._doButtonAction( 'cancelled' );62    },6364    _doButtonAction: function( in_strMessage )65    {66        Util.Assert( TypeCheck.String( in_strMessage ) );67        var objPlugged = this.getPlugged();68        var aArguments = this._getClosingArguments();69        70        objPlugged.Raise( objPlugged.type + in_strMessage, aArguments );71    },72    73    /**74    * _getClosingArguments - you just like the name, don't you?75    * @param {Variant} - either undefined or an array, passed directly to the Raise function.76    */77    _getClosingArguments: function()78    {79        var aRetVal = undefined;80        if( this.m_strCloseFunctionName )81        {82           var vRetVal = this.getPlugged()[ this.m_strCloseFunctionName ]();83           if( vRetVal )84           {85                aRetVal = [ vRetVal ];86           } // end if87        } // end if88        89        return aRetVal;90    },91    92    /**93    * setOKText - set the text of the OK button94    * @param {String} in_strText - text to set the input button to95    */96    setOKText: function( in_strText )97    {98        Util.Assert( TypeCheck.String( in_strText ) );99        100        this.getPlugged().$( 'elementOKButton' ).innerHTML = in_strText;101    }
...

Full Screen

Full Screen

actions.js

Source:actions.js Github

copy

Full Screen

1// import {IDLESTATUS_AWAY, IDLESTATUS_EXPIRED} from './constants';2// import {_authenticationSuccess,_setLastCheckedTime, logout} from '../../actions/credential.actions';3// import SecurityAPI from '../../api/credential.api';4// import {ModalService} from '..//modal.service';5// import {I18n} from 'react-redux-i18n';6// import {browserHistory} from 'react-router';7// import {actions as idleActions} from './index';8// import AdalService from '..//adal.service';9// import * as ActionTypes from '../../actions/action-types.constants.js';10//11//12// //time returned is in milliseconds13// export const idleStatusDelay = idleStatus => (dispatch, getState) => {14// 	if(idleStatus === IDLESTATUS_AWAY)15// 		return 1200000; //20 mins after action16// 	if(idleStatus === IDLESTATUS_EXPIRED)17// 		return 610000; //10 mins after first notification18// };19//20// export const activeStatusAction = (dispatch, getState) => {};21//22// export const idleStatusAction = idleStatus => (dispatch, getState) => {23//24// 	if(idleStatus === IDLESTATUS_AWAY) {25// 		ModalService.showAlertNoClosing(I18n.t('redux_idle_monitor.first_timer_body') ,I18n.t('redux_idle_monitor.first_timer_title')).then(result => {26//27// 			SecurityAPI.getAuthenticatedUser().then(authenticatedUser => {28// 				dispatch((idleActions.start)());29// 				dispatch(_authenticationSuccess(authenticatedUser));30// 				dispatch(_setLastCheckedTime(new Date().getTime()));31// 			}).fail(() => {32// 				SecurityAPI.logout().then(() => {33// 					awayOKButtonClickOnEndedSessionAction(dispatch);34// 				}).fail(() => {35// 					awayOKButtonClickOnEndedSessionAction(dispatch);36// 				});37// 			});38// 		});39// 	}40//41//42// 	if(idleStatus === IDLESTATUS_EXPIRED) {43// 		SecurityAPI.getAuthenticatedUser().then(authenticatedUser => {44// 			dispatch((idleActions.start)());45// 			dispatch(_authenticationSuccess(authenticatedUser));46// 			dispatch(_setLastCheckedTime(new Date().getTime()));47// 			ModalService.removeExistingAlert();48// 		}).fail(() => {49// 			SecurityAPI.logout().then(() => {50// 				expiredStatusAction(dispatch);51// 			}).fail(() => {52// 				expiredStatusAction(dispatch);53// 			});54// 		});55// 	}56// };57//58// const expiredStatusAction = (dispatch) => {59// 	ModalService.removeExistingAlert();60// 	dispatch({type: ActionTypes.LOGOUT_SUCCESS});61// 	AdalService.logout();62// 	browserHistory.push('/');63// 	dispatch(_setLastCheckedTime(0));64// 	ModalService.showAlertNoClosing(I18n.t('redux_idle_monitor.second_timer_body'), I18n.t('redux_idle_monitor.second_timer_title')).then(result => {   });65// 	dispatch((idleActions.stop)());66// }67//68// const awayOKButtonClickOnEndedSessionAction = (dispatch) => {69// 	dispatch({type: ActionTypes.LOGOUT_SUCCESS});70// 	AdalService.logout();71// 	browserHistory.push('/');72// 	dispatch(_setLastCheckedTime(0));73// 	dispatch((idleActions.stop)());...

Full Screen

Full Screen

SelectWindowController.js

Source:SelectWindowController.js Github

copy

Full Screen

1/**2 * Select window controller3 * @class Vede.controller.VectorEditor.SelectWindowController4 */5Ext.define("Vede.controller.VectorEditor.SelectWindowController", {6    extend: "Ext.app.Controller",7    requires: ["Teselagen.event.SelectionEvent",8               "Teselagen.event.SequenceManagerEvent",9               "Teselagen.event.MenuItemEvent"],10    MenuItemEvent: null,11    SelectionEvent: null,12    selectWindow: null,13    sequenceManager: null,14    onSelectWindowOpened: function(window) {15        this.selectWindow = window;16    },17    onSequenceManagerChanged: function(sequenceManager) {18        this.sequenceManager = sequenceManager;19    },20    onOKButtonClick: function() {21        if(!this.sequenceManager) {22            this.selectWindow.close();23        }24        var from = Ext.getCmp("selectWindowFromField").getValue();25        var to = Ext.getCmp("selectWindowToField").getValue();26        var seqLen = this.sequenceManager.getSequence().toString().length;27        if(isNaN(from) || from > seqLen || from < 1) {28            Ext.getCmp("selectWindowFromField").setFieldStyle("border-color:red");29        } else if(isNaN(to) || to > seqLen || to < 1) {30            Ext.getCmp("selectWindowToField").setFieldStyle("border-color:red");31        } else {32            this.selectWindow.close();33            this.application.fireEvent(this.SelectionEvent.SELECTION_CHANGED,34                                       this, Number(from) - 1, Number(to));35        }36    },37    onTabChange: function(mainAppPanel, newTab) {38        if(newTab.initialCls === "VectorEditorPanel") {39            this.onSequenceManagerChanged(newTab.model);40        }41    },42    init: function() {43        this.control({44            "#mainAppPanel": {45                tabchange: this.onTabChange46            },47            "#selectWindowOKButton": {48                click: this.onOKButtonClick49            }50        });51        this.MenuItemEvent = Teselagen.event.MenuItemEvent;52        this.SelectionEvent = Teselagen.event.SelectionEvent;53        this.application.on(this.MenuItemEvent.SELECT_WINDOW_OPENED,54                            this.onSelectWindowOpened, this);55        this.application.on(Teselagen.event.SequenceManagerEvent.SEQUENCE_MANAGER_CHANGED, 56                            this.onSequenceManagerChanged, this);57    }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2const assert = require('assert');3(async () => {4    const browser = await remote({5        capabilities: {6        }7    })8    await browser.pause(5000);9    await browser.click('~okButton');10    await browser.pause(5000);11    await browser.deleteSession();12})();13const { remote } = require('webdriverio');14const assert = require('assert');15(async () => {16    const browser = await remote({17        capabilities: {18        }19    })20    await browser.pause(5000);21    await browser.click('~okButton');22    await browser.pause(5000);23    await browser.deleteSession();24})();25const { remote } = require('webdriverio');26const assert = require('assert');27(async () => {28    const browser = await remote({29        capabilities: {30        }31    })32    await browser.pause(5000);33    await browser.click('~okButton');34    await browser.pause(5000);35    await browser.deleteSession();36})();37const { remote } = require('webdriverio');38const assert = require('assert');39(async () => {40    const browser = await remote({41        capabilities: {42        }43    })44    await browser.pause(5000);45    await browser.click('~okButton');46    await browser.pause(5000);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var desired = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6  .init(desired)7  .elementByAccessibilityId('OK')8  .then(function(element) {9    return element.click();10  })11  .then(function() {12    return driver.quit();13  })14  .done();15var wd = require('wd');16var assert = require('assert');17var desired = {18};19var driver = wd.promiseChainRemote('localhost', 4723);20  .init(desired)21  .elementByAccessibilityId('OK')22  .then(function(element) {23    return element.click();24  })25  .then(function() {26    return driver.quit();27  })28  .done();29var wd = require('wd');30var assert = require('assert');31var desired = {32};33var driver = wd.promiseChainRemote('localhost', 4723);34  .init(desired)35  .elementByAccessibilityId('OK')36  .then(function(element) {37    return element.click();38  })39  .then(function() {

Full Screen

Using AI Code Generation

copy

Full Screen

1var app = require('express')(),2    server = require('http').Server(app),3    io = require('socket.io')(server),4    port = 3000;5server.listen(port, function() {6    console.log('Server listening at port %d', port);7});8app.get('/', function(req, res) {9    res.sendFile(__dirname + '/index.html');10});11app.get('/static', function(req, res) {12    res.sendFile(__dirname + '/static.html');13});14var usernames = {};15var numUsers = 0;16io.on('connection', function(socket) {17    var addedUser = false;18    socket.on('new message', function(data) {19        socket.broadcast.emit('new message', {20        });21    });22    socket.on('add user', function(username) {23        if (addedUser) return;24        socket.username = username;25        ++numUsers;26        addedUser = true;27        socket.emit('login', {28        });29        socket.broadcast.emit('user joined', {30        });31    });32    socket.on('typing', function() {33        socket.broadcast.emit('typing', {34        });35    });36    socket.on('stop typing', function() {37        socket.broadcast.emit('stop typing', {38        });39    });40    socket.on('disconnect', function() {41        if (addedUser) {42            --numUsers;43            socket.broadcast.emit('user left', {44            });45        }46    });47});

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

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

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful