How to use el.tap method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

core.js

Source:core.js Github

copy

Full Screen

1(function () {2/*** Variables ***/3 var win = window,4 doc = document,5 noop = function(){},6 trueop = function(){ return true; },7 regexPseudoSplit = /([\w-]+(?:\([^\)]+\))?)/g,8 regexPseudoReplace = /(\w*)(?:\(([^\)]*)\))?/,9 regexDigits = /(\d+)/g,10 keypseudo = {11 action: function (pseudo, event) {12 return pseudo.value.match(regexDigits).indexOf(String(event.keyCode)) > -1 == (pseudo.name == 'keypass') || null;13 }14 },15 prefix = (function () {16 var styles = win.getComputedStyle(doc.documentElement, ''),17 pre = (Array.prototype.slice18 .call(styles)19 .join('')20 .match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])21 )[1];22 return {23 dom: pre == 'ms' ? 'MS' : pre,24 lowercase: pre,25 css: '-' + pre + '-',26 js: pre == 'ms' ? pre : pre[0].toUpperCase() + pre.substr(1)27 };28 })(),29 matchSelector = Element.prototype.matchesSelector || Element.prototype[prefix.lowercase + 'MatchesSelector'],30 mutation = win.MutationObserver || win[prefix.js + 'MutationObserver'];31/*** Functions ***/32// Utilities33 var typeCache = {},34 typeString = typeCache.toString,35 typeRegexp = /\s([a-zA-Z]+)/;36 function typeOf(obj) {37 var type = typeString.call(obj);38 return typeCache[type] || (typeCache[type] = type.match(typeRegexp)[1].toLowerCase());39 }40 function clone(item, type){41 var fn = clone[type || typeOf(item)];42 return fn ? fn(item) : item;43 }44 clone.object = function(src){45 var obj = {};46 for (var key in src) obj[key] = clone(src[key]);47 return obj;48 };49 clone.array = function(src){50 var i = src.length, array = new Array(i);51 while (i--) array[i] = clone(src[i]);52 return array;53 };54 var unsliceable = ['undefined', 'null', 'number', 'boolean', 'string', 'function'];55 function toArray(obj){56 return unsliceable.indexOf(typeOf(obj)) == -1 ?57 Array.prototype.slice.call(obj, 0) :58 [obj];59 }60// DOM61 var str = '';62 function query(element, selector){63 return (selector || str).length ? toArray(element.querySelectorAll(selector)) : [];64 }65 function parseMutations(element, mutations) {66 var diff = { added: [], removed: [] };67 mutations.forEach(function(record){68 record._mutation = true;69 for (var z in diff) {70 var type = element._records[(z == 'added') ? 'inserted' : 'removed'],71 nodes = record[z + 'Nodes'], length = nodes.length;72 for (var i = 0; i < length && diff[z].indexOf(nodes[i]) == -1; i++){73 diff[z].push(nodes[i]);74 type.forEach(function(fn){75 fn(nodes[i], record);76 });77 }78 }79 });80 }81// Mixins82 function mergeOne(source, key, current){83 var type = typeOf(current);84 if (type == 'object' && typeOf(source[key]) == 'object') xtag.merge(source[key], current);85 else source[key] = clone(current, type);86 return source;87 }88 function wrapMixin(tag, key, pseudo, value, original){89 if (typeof original[key] != 'function') original[key] = value;90 else {91 original[key] = xtag.wrap(original[key], xtag.applyPseudos(pseudo, value, tag.pseudos));92 }93 }94 var uniqueMixinCount = 0;95 function mergeMixin(tag, mixin, original, mix) {96 if (mix) {97 var uniques = {};98 for (var z in original) uniques[z.split(':')[0]] = z;99 for (z in mixin) {100 wrapMixin(tag, uniques[z.split(':')[0]] || z, z, mixin[z], original);101 }102 }103 else {104 for (var zz in mixin){105 wrapMixin(tag, zz + ':__mixin__(' + (uniqueMixinCount++) + ')', zz, mixin[zz], original);106 }107 }108 }109 function applyMixins(tag) {110 tag.mixins.forEach(function (name) {111 var mixin = xtag.mixins[name];112 for (var type in mixin) {113 var item = mixin[type],114 original = tag[type];115 if (!original) tag[type] = item;116 else {117 switch (type){118 case 'accessors': case 'prototype':119 for (var z in item) {120 if (!original[z]) original[z] = item[z];121 else mergeMixin(tag, item[z], original[z], true);122 }123 break;124 default: mergeMixin(tag, item, original, type != 'events');125 }126 }127 }128 });129 return tag;130 }131// Events132 function delegateAction(pseudo, event) {133 var match, target = event.target;134 if (xtag.matchSelector(target, pseudo.value)) match = target;135 else if (xtag.matchSelector(target, pseudo.value + ' *')) {136 var parent = target.parentNode;137 while (!match) {138 if (xtag.matchSelector(parent, pseudo.value)) match = parent;139 parent = parent.parentNode;140 }141 }142 return match ? pseudo.listener = pseudo.listener.bind(match) : null;143 }144 function touchFilter(event) {145 if (event.type.match('touch')){146 event.target.__touched__ = true;147 }148 else if (event.target.__touched__ && event.type.match('mouse')){149 delete event.target.__touched__;150 return;151 }152 return true;153 }154 function createFlowEvent(type) {155 var flow = type == 'over';156 return {157 attach: 'OverflowEvent' in win ? 'overflowchanged' : [],158 condition: function (event, custom) {159 event.flow = type;160 return event.type == (type + 'flow') ||161 ((event.orient === 0 && event.horizontalOverflow == flow) ||162 (event.orient == 1 && event.verticalOverflow == flow) ||163 (event.orient == 2 && event.horizontalOverflow == flow && event.verticalOverflow == flow));164 }165 };166 }167 function writeProperty(key, event, base, desc){168 if (desc) event[key] = base[key];169 else Object.defineProperty(event, key, {170 writable: true,171 enumerable: true,172 value: base[key]173 });174 }175 var skipProps = {};176 for (var z in document.createEvent('CustomEvent')) skipProps[z] = 1;177 function inheritEvent(event, base){178 var desc = Object.getOwnPropertyDescriptor(event, 'target');179 for (var z in base) {180 if (!skipProps[z]) writeProperty(z, event, base, desc);181 }182 event.baseEvent = base;183 }184// Accessors185 function getArgs(attr, value){186 return {187 value: attr.boolean ? '' : value,188 method: attr.boolean && !value ? 'removeAttribute' : 'setAttribute'189 };190 }191 function modAttr(element, attr, name, value){192 var args = getArgs(attr, value);193 element[args.method](name, args.value);194 }195 function syncAttr(element, attr, name, value, method){196 var nodes = attr.property ? [element.xtag[attr.property]] : attr.selector ? xtag.query(element, attr.selector) : [],197 index = nodes.length;198 while (index--) nodes[index][method](name, value);199 }200 function updateView(element, name, value){201 if (element.__view__){202 element.__view__.updateBindingValue(element, name, value);203 }204 }205 function attachProperties(tag, prop, z, accessor, attr, name){206 var key = z.split(':'), type = key[0];207 if (type == 'get') {208 key[0] = prop;209 tag.prototype[prop].get = xtag.applyPseudos(key.join(':'), accessor[z], tag.pseudos);210 }211 else if (type == 'set') {212 key[0] = prop;213 var setter = tag.prototype[prop].set = xtag.applyPseudos(key.join(':'), attr ? function(value){214 this.xtag._skipSet = true;215 if (!this.xtag._skipAttr) modAttr(this, attr, name, value);216 if (this.xtag._skipAttr && attr.skip) delete this.xtag._skipAttr;217 accessor[z].call(this, attr.boolean ? !!value : value);218 updateView(this, name, value);219 delete this.xtag._skipSet;220 } : accessor[z] ? function(value){221 accessor[z].call(this, value);222 updateView(this, name, value);223 } : null, tag.pseudos);224 if (attr) attr.setter = setter;225 }226 else tag.prototype[prop][z] = accessor[z];227 }228 function parseAccessor(tag, prop){229 tag.prototype[prop] = {};230 var accessor = tag.accessors[prop],231 attr = accessor.attribute,232 name = attr && attr.name ? attr.name.toLowerCase() : prop;233 if (attr) {234 attr.key = prop;235 tag.attributes[name] = attr;236 }237 for (var z in accessor) attachProperties(tag, prop, z, accessor, attr, name);238 if (attr) {239 if (!tag.prototype[prop].get) {240 var method = (attr.boolean ? 'has' : 'get') + 'Attribute';241 tag.prototype[prop].get = function(){242 return this[method](name);243 };244 }245 if (!tag.prototype[prop].set) tag.prototype[prop].set = function(value){246 modAttr(this, attr, name, value);247 updateView(this, name, value);248 };249 }250 }251 var readyTags = {};252 function fireReady(name){253 readyTags[name] = (readyTags[name] || []).filter(function(obj){254 return (obj.tags = obj.tags.filter(function(z){255 return z != name && !xtag.tags[z];256 })).length || obj.fn();257 });258 }259/*** X-Tag Object Definition ***/260 var xtag = {261 tags: {},262 defaultOptions: {263 pseudos: [],264 mixins: [],265 events: {},266 methods: {},267 accessors: {},268 lifecycle: {},269 attributes: {},270 'prototype': {271 xtag: {272 get: function(){273 return this.__xtag__ ? this.__xtag__ : (this.__xtag__ = { data: {} });274 }275 }276 }277 },278 register: function (name, options) {279 var _name;280 if (typeof name == 'string') {281 _name = name.toLowerCase();282 } else {283 return;284 }285 // save prototype for actual object creation below286 var basePrototype = options.prototype;287 delete options.prototype;288 var tag = xtag.tags[_name] = applyMixins(xtag.merge({}, xtag.defaultOptions, options));289 for (var z in tag.events) tag.events[z] = xtag.parseEvent(z, tag.events[z]);290 for (z in tag.lifecycle) tag.lifecycle[z.split(':')[0]] = xtag.applyPseudos(z, tag.lifecycle[z], tag.pseudos);291 for (z in tag.methods) tag.prototype[z.split(':')[0]] = { value: xtag.applyPseudos(z, tag.methods[z], tag.pseudos), enumerable: true };292 for (z in tag.accessors) parseAccessor(tag, z);293 var ready = tag.lifecycle.created || tag.lifecycle.ready;294 tag.prototype.createdCallback = {295 enumerable: true,296 value: function(){297 var element = this;298 xtag.addEvents(this, tag.events);299 tag.mixins.forEach(function(mixin){300 if (xtag.mixins[mixin].events) xtag.addEvents(element, xtag.mixins[mixin].events);301 });302 var output = ready ? ready.apply(this, toArray(arguments)) : null;303 for (var name in tag.attributes) {304 var attr = tag.attributes[name],305 hasAttr = this.hasAttribute(name);306 if (hasAttr || attr.boolean) {307 this[attr.key] = attr.boolean ? hasAttr : this.getAttribute(name);308 }309 }310 tag.pseudos.forEach(function(obj){311 obj.onAdd.call(element, obj);312 });313 return output;314 }315 };316 if (tag.lifecycle.inserted) tag.prototype.enteredViewCallback = { value: tag.lifecycle.inserted, enumerable: true };317 if (tag.lifecycle.removed) tag.prototype.leftViewCallback = { value: tag.lifecycle.removed, enumerable: true };318 if (tag.lifecycle.attributeChanged) tag.prototype.attributeChangedCallback = { value: tag.lifecycle.attributeChanged, enumerable: true };319 var setAttribute = tag.prototype.setAttribute || HTMLElement.prototype.setAttribute;320 tag.prototype.setAttribute = {321 writable: true,322 enumberable: true,323 value: function (name, value){324 var attr = tag.attributes[name.toLowerCase()];325 if (!this.xtag._skipAttr) setAttribute.call(this, name, attr && attr.boolean ? '' : value);326 if (attr) {327 if (attr.setter && !this.xtag._skipSet) {328 this.xtag._skipAttr = true;329 attr.setter.call(this, attr.boolean ? true : value);330 }331 value = attr.skip ? attr.boolean ? this.hasAttribute(name) : this.getAttribute(name) : value;332 syncAttr(this, attr, name, attr.boolean ? '' : value, 'setAttribute');333 }334 delete this.xtag._skipAttr;335 }336 };337 var removeAttribute = tag.prototype.removeAttribute || HTMLElement.prototype.removeAttribute;338 tag.prototype.removeAttribute = {339 writable: true,340 enumberable: true,341 value: function (name){342 var attr = tag.attributes[name.toLowerCase()];343 if (!this.xtag._skipAttr) removeAttribute.call(this, name);344 if (attr) {345 if (attr.setter && !this.xtag._skipSet) {346 this.xtag._skipAttr = true;347 attr.setter.call(this, attr.boolean ? false : undefined);348 }349 syncAttr(this, attr, name, undefined, 'removeAttribute');350 }351 delete this.xtag._skipAttr;352 }353 };354 var elementProto = basePrototype ?355 basePrototype :356 options['extends'] ?357 Object.create(doc.createElement(options['extends']).constructor).prototype :358 win.HTMLElement.prototype;359 var definition = {360 'prototype': Object.create(elementProto, tag.prototype)361 };362 if (options['extends']) {363 definition['extends'] = options['extends'];364 }365 var reg = doc.register(_name, definition);366 fireReady(_name);367 return reg;368 },369 ready: function(names, fn){370 var obj = { tags: toArray(names), fn: fn };371 if (obj.tags.reduce(function(last, name){372 if (xtag.tags[name]) return last;373 (readyTags[name] = readyTags[name] || []).push(obj);374 }, true)) fn();375 },376 /* Exposed Variables */377 mixins: {},378 prefix: prefix,379 captureEvents: ['focus', 'blur', 'scroll', 'underflow', 'overflow', 'overflowchanged', 'DOMMouseScroll'],380 customEvents: {381 overflow: createFlowEvent('over'),382 underflow: createFlowEvent('under'),383 animationstart: {384 attach: [prefix.dom + 'AnimationStart']385 },386 animationend: {387 attach: [prefix.dom + 'AnimationEnd']388 },389 transitionend: {390 attach: [prefix.dom + 'TransitionEnd']391 },392 move: {393 attach: ['mousemove', 'touchmove'],394 condition: touchFilter395 },396 enter: {397 attach: ['mouseover', 'touchenter'],398 condition: touchFilter399 },400 leave: {401 attach: ['mouseout', 'touchleave'],402 condition: touchFilter403 },404 scrollwheel: {405 attach: ['DOMMouseScroll', 'mousewheel'],406 condition: function(event){407 event.delta = event.wheelDelta ? event.wheelDelta / 40 : Math.round(event.detail / 3.5 * -1);408 return true;409 }410 },411 tapstart: {412 observe: {413 mousedown: doc,414 touchstart: doc415 },416 condition: touchFilter417 },418 tapend: {419 observe: {420 mouseup: doc,421 touchend: doc422 },423 condition: touchFilter424 },425 tapmove: {426 attach: ['tapstart', 'dragend', 'touchcancel'],427 condition: function(event, custom){428 switch (event.type) {429 case 'move': return true;430 case 'dragover':431 var last = custom.lastDrag || {};432 custom.lastDrag = event;433 return (last.pageX != event.pageX && last.pageY != event.pageY) || null;434 case 'tapstart':435 if (!custom.move) {436 custom.current = this;437 custom.move = xtag.addEvents(this, {438 move: custom.listener,439 dragover: custom.listener440 });441 custom.tapend = xtag.addEvent(doc, 'tapend', custom.listener);442 }443 break;444 case 'tapend': case 'dragend': case 'touchcancel':445 if (!event.touches.length) {446 if (custom.move) xtag.removeEvents(custom.current , custom.move || {});447 if (custom.tapend) xtag.removeEvent(doc, custom.tapend || {});448 delete custom.lastDrag;449 delete custom.current;450 delete custom.tapend;451 delete custom.move;452 }453 }454 }455 }456 },457 pseudos: {458 __mixin__: {},459 keypass: keypseudo,460 keyfail: keypseudo,461 delegate: { action: delegateAction },462 within: {463 action: delegateAction,464 onAdd: function(pseudo){465 var condition = pseudo.source.condition;466 if (condition) pseudo.source.condition = function(event, custom){467 return xtag.query(this, pseudo.value).filter(function(node){468 return node == event.target || node.contains ? node.contains(event.target) : null;469 })[0] ? condition.call(this, event, custom) : null;470 };471 }472 },473 preventable: {474 action: function (pseudo, event) {475 return !event.defaultPrevented;476 }477 }478 },479 /* UTILITIES */480 clone: clone,481 typeOf: typeOf,482 toArray: toArray,483 wrap: function (original, fn) {484 return function(){485 var args = toArray(arguments),486 output = original.apply(this, args);487 fn.apply(this, args);488 return output;489 };490 },491 merge: function(source, k, v){492 if (typeOf(k) == 'string') return mergeOne(source, k, v);493 for (var i = 1, l = arguments.length; i < l; i++){494 var object = arguments[i];495 for (var key in object) mergeOne(source, key, object[key]);496 }497 return source;498 },499 uid: function(){500 return Math.random().toString(36).substr(2,10);501 },502 /* DOM */503 query: query,504 skipTransition: function(element, fn){505 var prop = prefix.js + 'TransitionProperty';506 element.style[prop] = element.style.transitionProperty = 'none';507 var callback = fn();508 return xtag.requestFrame(function(){509 xtag.requestFrame(function(){510 element.style[prop] = element.style.transitionProperty = '';511 if (callback) xtag.requestFrame(callback);512 });513 });514 },515 requestFrame: (function(){516 var raf = win.requestAnimationFrame ||517 win[prefix.lowercase + 'RequestAnimationFrame'] ||518 function(fn){ return win.setTimeout(fn, 20); };519 return function(fn){ return raf(fn); };520 })(),521 cancelFrame: (function(){522 var cancel = win.cancelAnimationFrame ||523 win[prefix.lowercase + 'CancelAnimationFrame'] ||524 win.clearTimeout;525 return function(id){ return cancel(id); };526 })(),527 matchSelector: function (element, selector) {528 return matchSelector.call(element, selector);529 },530 set: function (element, method, value) {531 element[method] = value;532 if (window.CustomElements) CustomElements.upgradeAll(element);533 },534 innerHTML: function(el, html){535 xtag.set(el, 'innerHTML', html);536 },537 hasClass: function (element, klass) {538 return element.className.split(' ').indexOf(klass.trim())>-1;539 },540 addClass: function (element, klass) {541 var list = element.className.trim().split(' ');542 klass.trim().split(' ').forEach(function (name) {543 if (!~list.indexOf(name)) list.push(name);544 });545 element.className = list.join(' ').trim();546 return element;547 },548 removeClass: function (element, klass) {549 var classes = klass.trim().split(' ');550 element.className = element.className.trim().split(' ').filter(function (name) {551 return name && !~classes.indexOf(name);552 }).join(' ');553 return element;554 },555 toggleClass: function (element, klass) {556 return xtag[xtag.hasClass(element, klass) ? 'removeClass' : 'addClass'].call(null, element, klass);557 },558 queryChildren: function (element, selector) {559 var id = element.id,560 guid = element.id = id || 'x_' + xtag.uid(),561 attr = '#' + guid + ' > ';562 selector = attr + (selector + '').replace(',', ',' + attr, 'g');563 var result = element.parentNode.querySelectorAll(selector);564 if (!id) element.removeAttribute('id');565 return toArray(result);566 },567 createFragment: function(content) {568 var frag = doc.createDocumentFragment();569 if (content) {570 var div = frag.appendChild(doc.createElement('div')),571 nodes = toArray(content.nodeName ? arguments : !(div.innerHTML = content) || div.children),572 length = nodes.length,573 index = 0;574 while (index < length) frag.insertBefore(nodes[index++], div);575 frag.removeChild(div);576 }577 return frag;578 },579 manipulate: function(element, fn){580 var next = element.nextSibling,581 parent = element.parentNode,582 frag = doc.createDocumentFragment(),583 returned = fn.call(frag.appendChild(element), frag) || element;584 if (next) parent.insertBefore(returned, next);585 else parent.appendChild(returned);586 },587 /* PSEUDOS */588 applyPseudos: function(key, fn, target, source) {589 var listener = fn,590 pseudos = {};591 if (key.match(':')) {592 var split = key.match(regexPseudoSplit),593 i = split.length;594 while (--i) {595 split[i].replace(regexPseudoReplace, function (match, name, value) {596 if (!xtag.pseudos[name]) throw "pseudo not found: " + name + " " + split;597 var pseudo = pseudos[i] = Object.create(xtag.pseudos[name]);598 pseudo.key = key;599 pseudo.name = name;600 pseudo.value = value;601 pseudo['arguments'] = (value || '').split(',');602 pseudo.action = pseudo.action || trueop;603 pseudo.source = source;604 var last = listener;605 listener = function(){606 var args = toArray(arguments),607 obj = {608 key: key,609 name: name,610 value: value,611 source: source,612 'arguments': pseudo['arguments'],613 listener: last614 };615 var output = pseudo.action.apply(this, [obj].concat(args));616 if (output === null || output === false) return output;617 return obj.listener.apply(this, args);618 };619 if (target && pseudo.onAdd) {620 if (target.nodeName) pseudo.onAdd.call(target, pseudo);621 else target.push(pseudo);622 }623 });624 }625 }626 for (var z in pseudos) {627 if (pseudos[z].onCompiled) listener = pseudos[z].onCompiled(listener, pseudos[z]) || listener;628 }629 return listener;630 },631 removePseudos: function(target, pseudos){632 pseudos.forEach(function(obj){633 if (obj.onRemove) obj.onRemove.call(target, obj);634 });635 },636 /*** Events ***/637 parseEvent: function(type, fn) {638 var pseudos = type.split(':'),639 key = pseudos.shift(),640 custom = xtag.customEvents[key],641 event = xtag.merge({642 type: key,643 stack: noop,644 condition: trueop,645 attach: [],646 _attach: [],647 pseudos: '',648 _pseudos: [],649 onAdd: noop,650 onRemove: noop651 }, custom || {});652 event.attach = toArray(event.base || event.attach);653 event.chain = key + (event.pseudos.length ? ':' + event.pseudos : '') + (pseudos.length ? ':' + pseudos.join(':') : '');654 var condition = event.condition;655 event.condition = function(e){656 var t = e.touches, tt = e.targetTouches;657 return condition.apply(this, toArray(arguments));658 };659 var stack = xtag.applyPseudos(event.chain, fn, event._pseudos, event);660 event.stack = function(e){661 var t = e.touches, tt = e.targetTouches;662 var detail = e.detail || {};663 if (!detail.__stack__) return stack.apply(this, toArray(arguments));664 else if (detail.__stack__ == stack) {665 e.stopPropagation();666 e.cancelBubble = true;667 return stack.apply(this, toArray(arguments));668 }669 };670 event.listener = function(e){671 var args = toArray(arguments),672 output = event.condition.apply(this, args.concat([event]));673 if (!output) return output;674 if (e.type != key) {675 xtag.fireEvent(e.target, key, {676 baseEvent: e,677 detail: output !== true && (output.__stack__ = stack) ? output : { __stack__: stack }678 });679 }680 else return event.stack.apply(this, args);681 };682 event.attach.forEach(function(name) {683 event._attach.push(xtag.parseEvent(name, event.listener));684 });685 if (custom && custom.observe && !custom.__observing__) {686 custom.observer = function(e){687 var output = event.condition.apply(this, toArray(arguments).concat([custom]));688 if (!output) return output;689 xtag.fireEvent(e.target, key, {690 baseEvent: e,691 detail: output !== true ? output : {}692 });693 };694 for (var z in custom.observe) xtag.addEvent(custom.observe[z] || document, z, custom.observer, true);695 custom.__observing__ = true;696 }697 return event;698 },699 addEvent: function (element, type, fn, capture) {700 var event = (typeof fn == 'function') ? xtag.parseEvent(type, fn) : fn;701 event._pseudos.forEach(function(obj){702 obj.onAdd.call(element, obj);703 });704 event._attach.forEach(function(obj) {705 xtag.addEvent(element, obj.type, obj);706 });707 event.onAdd.call(element, event, event.listener);708 element.addEventListener(event.type, event.stack, capture || xtag.captureEvents.indexOf(event.type) > -1);709 return event;710 },711 addEvents: function (element, obj) {712 var events = {};713 for (var z in obj) {714 events[z] = xtag.addEvent(element, z, obj[z]);715 }716 return events;717 },718 removeEvent: function (element, type, event) {719 event = event || type;720 event.onRemove.call(element, event, event.listener);721 xtag.removePseudos(element, event._pseudos);722 event._attach.forEach(function(obj) {723 xtag.removeEvent(element, obj);724 });725 element.removeEventListener(event.type, event.stack);726 },727 removeEvents: function(element, obj){728 for (var z in obj) xtag.removeEvent(element, obj[z]);729 },730 fireEvent: function(element, type, options, warn){731 var event = doc.createEvent('CustomEvent');732 options = options || {};733 if (warn) console.warn('fireEvent has been modified');734 event.initCustomEvent(type,735 options.bubbles !== false,736 options.cancelable !== false,737 options.detail738 );739 if (options.baseEvent) inheritEvent(event, options.baseEvent);740 try { element.dispatchEvent(event); }741 catch (e) {742 console.warn('This error may have been caused by a change in the fireEvent method', e);743 }744 },745 addObserver: function(element, type, fn){746 if (!element._records) {747 element._records = { inserted: [], removed: [] };748 if (mutation){749 element._observer = new mutation(function(mutations) {750 parseMutations(element, mutations);751 });752 element._observer.observe(element, {753 subtree: true,754 childList: true,755 attributes: !true,756 characterData: false757 });758 }759 else ['Inserted', 'Removed'].forEach(function(type){760 element.addEventListener('DOMNode' + type, function(event){761 event._mutation = true;762 element._records[type.toLowerCase()].forEach(function(fn){763 fn(event.target, event);764 });765 }, false);766 });767 }768 if (element._records[type].indexOf(fn) == -1) element._records[type].push(fn);769 },770 removeObserver: function(element, type, fn){771 var obj = element._records;772 if (obj && fn){773 obj[type].splice(obj[type].indexOf(fn), 1);774 }775 else{776 obj[type] = [];777 }778 }779 };780/*** Universal Touch ***/781var touching = false,782 touchTarget = null;783doc.addEventListener('mousedown', function(e){784 touching = true;785 touchTarget = e.target;786}, true);787doc.addEventListener('mouseup', function(){788 touching = false;789 touchTarget = null;790}, true);791doc.addEventListener('dragend', function(){792 touching = false;793 touchTarget = null;794}, true);795var UIEventProto = {796 touches: {797 configurable: true,798 get: function(){799 return this.__touches__ ||800 (this.identifier = 0) ||801 (this.__touches__ = touching ? [this] : []);802 }803 },804 targetTouches: {805 configurable: true,806 get: function(){807 return this.__targetTouches__ || (this.__targetTouches__ =808 (touching && this.currentTarget &&809 (this.currentTarget == touchTarget ||810 (this.currentTarget.contains && this.currentTarget.contains(touchTarget)))) ? (this.identifier = 0) || [this] : []);811 }812 },813 changedTouches: {814 configurable: true,815 get: function(){816 return this.__changedTouches__ || (this.identifier = 0) || (this.__changedTouches__ = [this]);817 }818 }819};820for (z in UIEventProto){821 UIEvent.prototype[z] = UIEventProto[z];822 Object.defineProperty(UIEvent.prototype, z, UIEventProto[z]);823}824/*** Custom Event Definitions ***/825 function addTap(el, tap, e){826 if (!el.__tap__) {827 el.__tap__ = { click: e.type == 'mousedown' };828 if (el.__tap__.click) el.addEventListener('click', tap.observer);829 else {830 el.__tap__.scroll = tap.observer.bind(el);831 window.addEventListener('scroll', el.__tap__.scroll, true);832 el.addEventListener('touchmove', tap.observer);833 el.addEventListener('touchcancel', tap.observer);834 el.addEventListener('touchend', tap.observer);835 }836 }837 if (!el.__tap__.click) {838 el.__tap__.x = e.touches[0].pageX;839 el.__tap__.y = e.touches[0].pageY;840 }841 }842 function removeTap(el, tap){843 if (el.__tap__) {844 if (el.__tap__.click) el.removeEventListener('click', tap.observer);845 else {846 window.removeEventListener('scroll', el.__tap__.scroll, true);847 el.removeEventListener('touchmove', tap.observer);848 el.removeEventListener('touchcancel', tap.observer);849 el.removeEventListener('touchend', tap.observer);850 }851 delete el.__tap__;852 }853 }854 function checkTapPosition(el, tap, e){855 var touch = e.changedTouches[0],856 tol = tap.gesture.tolerance;857 if (858 touch.pageX < el.__tap__.x + tol &&859 touch.pageX > el.__tap__.x - tol &&860 touch.pageY < el.__tap__.y + tol &&861 touch.pageY > el.__tap__.y - tol862 ) return true;863 }864 xtag.customEvents.tap = {865 observe: {866 mousedown: document,867 touchstart: document868 },869 gesture: {870 tolerance: 8871 },872 condition: function(e, tap){873 var el = e.target;874 switch (e.type) {875 case 'touchstart':876 if (el.__tap__ && el.__tap__.click) removeTap(el, tap);877 addTap(el, tap, e);878 return;879 case 'mousedown':880 if (!el.__tap__) addTap(el, tap, e);881 return;882 case 'scroll':883 case 'touchcancel':884 removeTap(this, tap);885 return;886 case 'touchmove':887 case 'touchend':888 if (this.__tap__ && !checkTapPosition(this, tap, e)) {889 removeTap(this, tap);890 return;891 }892 return e.type == 'touchend' || null;893 case 'click':894 removeTap(this, tap);895 return true;896 }897 }898 };899 win.xtag = xtag;900 if (typeof define == 'function' && define.amd) define(xtag);901 doc.addEventListener('WebComponentsReady', function(){902 xtag.fireEvent(doc.body, 'DOMComponentsLoaded');903 });...

Full Screen

Full Screen

vue-tap.js

Source:vue-tap.js Github

copy

Full Screen

1~function() {2 var plugin = {3 install: function(Vue, options) {4 // 验证是否是有效点击5 isValid = isValid.bind(Vue, options || {});6 // 设置一个指令7 Vue.directive('tap', {8 bind: function(el, binding, vnode/*, oldVnode*/) {9 el.tap = {};10 if (el.disabled)11 return;12 if (isPc()) {13 el.tap.clickHandler = compose(function(event) {14 return (event && vnode.elm == el && binding.value.call(el, event), event);15 });16 el.addEventListener('click', el.tap.clickHandler, false);17 } else {18 el.tap.touchstartHandler = compose(function(event) {19 return event;20 }, touchstartHandler);21 el.tap.touchendHandler = compose(function(event) {22 return (event && vnode.elm == el && binding.value.call(el, event), event);23 }, touchendHandler);24 el.addEventListener('touchstart', el.tap.touchstartHandler, false);25 el.addEventListener('touchend', el.tap.touchendHandler, false);26 }27 },28 componentUpdated: function(el, binding, vnode/*, oldVnode*/) {29 if (isPc()) {30 el.removeEventListener('click', el.tap.clickHandler);31 } else {32 el.removeEventListener('touchstart', el.tap.touchstartHandler);33 el.removeEventListener('touchend', el.tap.touchendHandler);34 }35 if (el.disabled)36 return;37 if (isPc()) {38 el.tap.clickHandler = compose(function(event) {39 return (event && vnode.elm == el && binding.value.call(el, event), event);40 });41 el.addEventListener('click', el.tap.clickHandler, false);42 } else {43 el.tap.touchstartHandler = compose(function(event) {44 return event;45 }, touchstartHandler);46 el.tap.touchendHandler = compose(function(event) {47 return (event && vnode.elm == el && binding.value.call(el, event), event);48 }, touchendHandler);49 el.addEventListener('touchstart', el.tap.touchstartHandler, false);50 el.addEventListener('touchend', el.tap.touchendHandler, false);51 }52 },53 unbind: function(el/*, binding, vnode*/) {54 if (isPc()) {55 el.removeEventListener('click', el.tap.clickHandler);56 } else {57 el.removeEventListener('touchstart', el.tap.touchstartHandler);58 el.removeEventListener('touchend', el.tap.touchendHandler);59 }60 }61 });62 }63 };64 // 组合函数65 function compose() {66 var args = arguments;67 var start = args.length - 1;68 return function() {69 var i = start;70 var result = args[start].apply(this, arguments);71 while(i--) {72 result = args[i].call(this, result);73 }74 return result;75 };76 }77 // 判断是否是PC78 function isPc() {79 var uaInfo = navigator.userAgent;80 var agents = ['Android', 'iPhone', 'Windows Phone', 'iPad', 'iPod'];81 var flag = true;82 for ( var i = 0; i < agents.length; i++ ) {83 if (uaInfo.indexOf(agents[i]) > 0) {84 flag = false;85 break;86 }87 }88 return flag;89 }90 // 判断是否有效tap91 var isValid = function(options, time, distanceX, distanceY) {92 options.moment = options.moment || 10000;93 options.distance = options.distance || 40;94 return time < options.moment 95 && Math.abs(distanceX) < options.distance 96 && Math.abs(distanceY) < options.distance;97 };98 var touchstartHandler = function(event) {99 var evt = event || window.event || this.callee.caller.arguments[0];100 var touch = evt.touches[0];101 this.tap.moment = +new Date;102 this.tap.position = { x: touch.pageX, y: touch.pageY };103 return evt;104 };105 var touchendHandler = function(event) {106 var evt = event || window.event || this.callee.caller.arguments[0];107 var touch = evt.changedTouches[0];108 var diffTime = +new Date - this.tap.moment;109 var distanceX = touch.pageX - this.tap.position.x;110 var distanceY = touch.pageY - this.tap.position.y;111 if (isValid(diffTime, distanceX, distanceY)) {112 return evt;113 }114 };115 /* eslint-disable no-undef */116 if (typeof exports == 'object') {117 module.exports = plugin;118 } else if (typeof define == 'function' && define.amd) {119 define([], function() {120 return plugin;121 });122 } else if (window.Vue) {123 window.vueTap = plugin;124 window.Vue.use(window.vueTap);125 }126 /* eslint-enable no-undef */...

Full Screen

Full Screen

App.test.js

Source:App.test.js Github

copy

Full Screen

1const puppeteer = require('puppeteer')2const faker = require('faker')3const devices = require('puppeteer/DeviceDescriptors')4const iPhone = devices['iPhone 6']5const user = {6 email: faker.internet.email(),7 password: 'test',8 firstName: faker.name.firstName(),9 lastName: faker.name.lastName()10}11const isDebugging = () => {12 let debugging_mode = {13 headless: false,14 slowMo: 25,15 devtools: true 16 }17 return process.env.NODE_ENV === 'debug' ? debugging_mode : {}18}19let browser20let page21let logs = []22let errors = []23beforeAll(async () => {24 browser = await puppeteer.launch(isDebugging())25 page = await browser.newPage()26 await page.setRequestInterception(true)27 page.on('request', interceptedRequest => {28 if (interceptedRequest.url.includes('swapi')) {29 interceptedRequest.abort()30 } else {31 interceptedRequest.continue()32 }33 })34 page.on('console', c => {35 console.log(c.text)36 logs.push(c.text)37 })38 page.on('pageerror', e => errors.push(e.text))39 await page.goto('http://localhost:3000/')40 await page.emulate(iPhone)41})42describe('on page load ', () => {43 test('h1 loads correctly', async () => {44 const html = await page.$eval('[data-testid="h1"]', e => e.innerHTML)45 expect(html).toBe('Welcome to React')46 }, 16000)47 test('nav loads correctly', async () => {48 const navbar = await page.$eval('[data-testid="navbar"]', el => el ? true : false)49 const listItems = await page.$$('[data-testid="navBarLi"]')50 expect(navbar).toBe(true)51 if (listItems.length !== 4)52 await page.pdf({path: 'screenshot.png'})53 expect(listItems.length).toBe(4)54 })55 describe('login form', () => {56 test('fills out form and submits', async () => {57 await page.setCookie({ name: 'JWT', value: 'kdkdkddf' })58 const firstNameEl = await page.$('[data-testid="firstName"]')59 const lastNameEl = await page.$('[data-testid="lastName"]')60 const emaildEl = await page.$('[data-testid="email"]')61 const passwordEl = await page.$('[data-testid="password"]')62 const submitEl = await page.$('[data-testid="submit"]')63 await firstNameEl.tap() 64 await page.type('[data-testid="firstName"]', user.firstName)65 await lastNameEl.tap() 66 await page.type('[data-testid="lastName"]', user.lastName)67 await emaildEl.tap() 68 await page.type('[data-testid="email"]', user.email)69 await passwordEl.tap()70 await page.type('[data-testid="password"]', user.password)71 await submitEl.tap() 72 await page.waitForSelector('[data-testid="success"]')73 }, 16000)74 test('sets firstName cookie', async () => {75 const cookies = await page.cookies()76 const firstNameCookie = cookies.find(c => c.name === 'firstName' && c.value === user.firstName)77 expect(firstNameCookie).not.toBeUndefined()78 })79 })80 test.skip('does not have console logs', () => {81 const newLogs = logs.filter( s => s !== '%cDownload the React DevTools for a better development experience: https://fb.me/react-devtools font-weight:bold')82 expect(newLogs.length).toBe(0)83 })84 test.skip('does not have exceptions', () => {85 expect(errors.length).toBe(0)86 })87 test('fails to fetch starWars endpoint', async () => {88 const h3 = await page.$eval('[data-testid="starWars"]', e => e.innerHTML)89 expect(h3).toBe('Something went wrong')90 })91})92afterAll(() => {93 if (isDebugging()) {94 browser.close()95 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import BlKeyboard from './src/components/BlKeyboard'2const _IS_MOBILE = /mobile|table|ip(ad|hone|od)|android/i.test(navigator.userAgent);3// 这一步判断window.Vue是否存在,因为直接引用vue.min.js, 它会把Vue绑到Window上,我们直接引用打包好的js才能正常跑起来。4if (typeof window !== 'undefined' && window.Vue) {5 window.Vue.component('BlKeyboard', BlKeyboard)6 window.Vue.directive('tap', {7 bind: function (el, binding) {8 el.binding_ref = binding;9 el.tapEventHandler = function (evt) {10 if (el.disabled) return;11 evt.stopPropagation();12 evt.cancelBubble = true;13 var value = el.binding_ref.value;14 value.event = evt;15 value.methods.call(this, value);16 };17 el.tapEventHandler_nop = function (evt) {18 };19 if (_IS_MOBILE) {20 el.addEventListener("touchstart", el.tapEventHandler, true);21 el.addEventListener("touchend", el.tapEventHandler_nop, true);22 } else {23 el.addEventListener("click", el.tapEventHandler, true);24 }25 },26 unbind: function (el) {27 if (_IS_MOBILE) {28 el.removeEventListener("touchstart", el.tapEventHandler, true);29 el.removeEventListener("touchend", el.tapEventHandler_nop, true);30 } else {31 el.removeEventListener("click", el.tapEventHandler, true);32 }33 },34 update: function (el, binding) {35 el.binding_ref = binding;36 }37 });38}39//这样就可以使用Vue.use进行全局安装了。40BlKeyboard.install = function (Vue) {41 if (typeof window !== 'undefined' && window.Vue) {42 Vue = window.Vue43 }44 Vue.component(BlKeyboard.name, BlKeyboard)45 Vue.directive('tap', {46 bind: function (el, binding) {47 el.binding_ref = binding;48 el.tapEventHandler = function (evt) {49 if (el.disabled) return;50 evt.stopPropagation();51 evt.cancelBubble = true;52 var value = el.binding_ref.value;53 value.event = evt;54 value.methods.call(this, value);55 };56 el.tapEventHandler_nop = function (evt) {57 };58 if (_IS_MOBILE) {59 el.addEventListener("touchstart", el.tapEventHandler, true);60 el.addEventListener("touchend", el.tapEventHandler_nop, true);61 } else {62 el.addEventListener("click", el.tapEventHandler, true);63 }64 },65 unbind: function (el) {66 if (_IS_MOBILE) {67 el.removeEventListener("touchstart", el.tapEventHandler, true);68 el.removeEventListener("touchend", el.tapEventHandler_nop, true);69 } else {70 el.removeEventListener("click", el.tapEventHandler, true);71 }72 },73 update: function (el, binding) {74 el.binding_ref = binding;75 }76 });77}...

Full Screen

Full Screen

LoginForm.e2e.js

Source:LoginForm.e2e.js Github

copy

Full Screen

1import puppeteer from 'puppeteer';2const isDebugging = () => {3 const debugging_mode = {4 headless: false,5 slowMo: 250,6 devtools: true7 };8 return process.env.NODE_ENV === 'debug' ? debugging_mode : {};9};10let browser;11let page;12describe('LoginForm', () => {13 beforeAll(async () => {14 browser = await puppeteer.launch(isDebugging());15 });16 afterAll(async () => {17 await browser.close();18 });19 beforeEach(async () => {20 page = await browser.newPage();21 await page.goto('http://localhost:3000/forms/login');22 });23 afterEach(async function() {24 await page.close();25 });26 test('login form handles duplicate user names correctly', async () => {27 const userNameEl = await page.$('[name="username"]');28 const passwordEl = await page.$('[name="password"]');29 const confirmPasswordEl = await page.$('[name="confirm-password"]');30 const submitEl = await page.$('[type="submit"]');31 await userNameEl.tap();32 // holding down Shift in order to select and delete some text33 await page.keyboard.down('Shift');34 for (let i = 0; i < 'lmeikle'.length; i++) await page.keyboard.press('ArrowLeft');35 await page.keyboard.up('Shift');36 await page.keyboard.press('Backspace');37 await page.type('[name="username"]', 'lmeikle');38 await passwordEl.tap();39 await page.type('[name="password"]', '');40 await page.type('[name="password"]', 'whatever');41 await confirmPasswordEl.tap();42 await page.type('[name="confirm-password"]', '');43 await page.type('[name="confirm-password"]', 'whatever');44 await submitEl.tap();45 await page.waitForSelector('.login-form-error');46 const errorText = await page.$eval('.login-form-error', e => e.innerHTML);47 expect(errorText).toBe('Username already taken');48 });49 test('login form handles non matching passwords', async () => {50 const passwordEl = await page.$('[name="password"]');51 const confirmPasswordEl = await page.$('[name="confirm-password"]');52 const submitEl = await page.$('[type="submit"]');53 await passwordEl.tap();54 await page.type('[name="password"]', 'whatever');55 await confirmPasswordEl.tap();56 await page.type('[name="confirm-password"]', 'whatever2');57 await submitEl.focus();58 await page.waitForSelector('.login-form-error');59 const errorText = await page.evaluate(() => document.querySelector('.login-form-error').textContent);60 expect(errorText).toBe('Passwords do not match');61 });...

Full Screen

Full Screen

poker.table.js

Source:poker.table.js Github

copy

Full Screen

1/* eslint camelcase: 0 */2import {decipher, improv_el, tap, close_combat, improv_op, pursuit, infiltrate} from '../actions';3const tag = 'pokertable';4const title = 'Poker Table';5const imgsrc = 'PokerTable.jpg';6const sound = 'PokerTable.ogg';7const description = `And then we were waiting, trying to figure out each other's hand one thing he didn't know, that the whole game was fixed ...`;8const PokerTable = [{9 title: title,10 tasks: [11 [decipher, decipher, improv_el],12 [tap, improv_el]13 ],14 inCountry: '',15 rewards: {16 gameCash: 250017 },18 losses: {19 gameCash: 250020 },21 imgsrc: imgsrc,22 sound: sound,23 description: description,24 agentLimit: 2,25 tier: 1,26 tag: tag27 }, {28 title: title,29 tasks: [30 [decipher, decipher, improv_el],31 [tap, improv_el, improv_op],32 [pursuit]33 ],34 inCountry: '',35 rewards: {36 gameCash: 1250037 },38 losses: {39 gameCash: 1250040 },41 imgsrc: imgsrc,42 sound: sound,43 description: description,44 agentLimit: 2,45 tier: 2,46 tag: tag47 }, {48 title: title,49 tasks: [50 [decipher, decipher, improv_el],51 [tap, improv_el, close_combat],52 [pursuit, improv_op]53 ],54 inCountry: '',55 rewards: {56 gameCash: 6250057 },58 losses: {59 gameCash: 6250060 },61 imgsrc: imgsrc,62 sound: sound,63 description: description,64 agentLimit: 2,65 tier: 3,66 tag: tag67 }, {68 title: title,69 tasks: [70 [decipher, decipher, improv_el],71 [tap, improv_el, close_combat, improv_op],72 [pursuit, improv_op],73 [infiltrate]74 ],75 inCountry: '',76 rewards: {77 gameCash: 12500078 },79 losses: {80 gameCash: 12500081 },82 imgsrc: imgsrc,83 sound: sound,84 description: description,85 agentLimit: 2,86 tag: tag,87 tier: 488 }, {89 title: title,90 tasks: [91 [decipher, decipher, improv_el],92 [tap, improv_el, close_combat, improv_op],93 [pursuit, improv_op, improv_op],94 [infiltrate]95 ],96 inCountry: '',97 rewards: {98 gameCash: 25000099 },100 losses: {101 gameCash: 250000102 },103 imgsrc: imgsrc,104 sound: sound,105 description: description,106 agentLimit: 2,107 tag: tag,108 tier: 5109 }];...

Full Screen

Full Screen

tap.js

Source:tap.js Github

copy

Full Screen

1var _IS_MOBILE = /mobile|table|ip(ad|hone|od)|android/i.test(navigator.userAgent);2var plugin = {3 bind: function(el, binding){4 el.binding_ref = binding;5 el.tapEventHandler = function(evt){6 if(el.disabled) return;7 evt.stopPropagation();8 evt.cancelBubble = true;9 var value = el.binding_ref.value;10 value.event = evt;11 value.methods.call(this, value);12 };13 el.tapEventHandler_nop = function(evt){};14 if(_IS_MOBILE){15 el.addEventListener("touchstart", el.tapEventHandler, true);16 el.addEventListener("touchend", el.tapEventHandler_nop, true);17 }else{18 el.addEventListener("click", el.tapEventHandler, true);19 }20 },21 unbind: function(el){22 if(_IS_MOBILE){23 el.removeEventListener("touchstart", el.tapEventHandler, true);24 el.removeEventListener("touchend", el.tapEventHandler_nop, true);25 }else{26 el.removeEventListener("click", el.tapEventHandler, true);27 }28 },29 update: function(el, binding){30 el.binding_ref = binding;31 }32};33var vueTap = {};34vueTap.install = function(Vue) {35 Vue.directive("tap", plugin);36};37if (typeof exports == "object") {38 module.exports = vueTap;39} else if (typeof define == "function" && define.amd) {40 define([], function(){ return vueTap; });41} else if (typeof window !== "undefined" && window.Vue) {42 window.vueTap = vueTap;43 Vue.use(vueTap);...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1import Vue from 'vue'2import App from './App.vue'3import 'amfe-flexible'4const _IS_MOBILE = /mobile|table|ip(ad|hone|od)|android/i.test(navigator.userAgent)5Vue.directive('tap', {6 bind: function (el, binding) {7 el.binding_ref = binding8 el.tapEventHandler = function (evt) {9 if (el.disabled) return10 evt.stopPropagation()11 evt.cancelBubble = true12 var value = el.binding_ref.value13 value.event = evt14 value.methods.call(this, value)15 }16 el.tapEventHandler_nop = function () {}17 if (_IS_MOBILE) {18 el.addEventListener('touchstart', el.tapEventHandler, true)19 el.addEventListener('touchend', el.tapEventHandler_nop, true)20 } else {21 el.addEventListener('click', el.tapEventHandler, true)22 }23 },24 unbind: function (el) {25 if (_IS_MOBILE) {26 el.removeEventListener('touchstart', el.tapEventHandler, true)27 el.removeEventListener('touchend', el.tapEventHandler_nop, true)28 } else {29 el.removeEventListener('click', el.tapEventHandler, true)30 }31 },32 update: function (el, binding) {33 el.binding_ref = binding34 }35})36new Vue({37 el: '#app',38 render: h => h(App)...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var el = driver.findElementByAccessibilityId("Button");2el.tap(1, 1);3var el = driver.findElementByAccessibilityId("Button");4el.click();5var el = driver.findElementByAccessibilityId("Button");6el.click();7var el = driver.findElementByAccessibilityId("Button");8el.click();9var el = driver.findElementByAccessibilityId("Button");10el.click();11var el = driver.findElementByAccessibilityId("Button");12el.click();13var el = driver.findElementByAccessibilityId("Button");14el.click();15var el = driver.findElementByAccessibilityId("Button");16el.click();17var el = driver.findElementByAccessibilityId("Button");18el.click();19var el = driver.findElementByAccessibilityId("Button");20el.click();21var el = driver.findElementByAccessibilityId("Button");22el.click();23var el = driver.findElementByAccessibilityId("Button");24el.click();25var el = driver.findElementByAccessibilityId("Button");26el.click();27var el = driver.findElementByAccessibilityId("Button");28el.click();

Full Screen

Using AI Code Generation

copy

Full Screen

1var el = driver.findElementByAccessibilityId("test");2el.tap(1, 1);3var el = driver.findElementByAccessibilityId("test");4el.tap(1);5var el = driver.findElementByAccessibilityId("test");6el.tap(1, 1);7var el = driver.findElementByAccessibilityId("test");8el.tap(1);9var el = driver.findElementByAccessibilityId("test");10el.tap(1, 1);11var el = driver.findElementByAccessibilityId("test");12el.tap(1);13var el = driver.findElementByAccessibilityId("test");14el.tap(1, 1);15var el = driver.findElementByAccessibilityId("test");16el.tap(1);17var el = driver.findElementByAccessibilityId("test");18el.tap(1, 1);19var el = driver.findElementByAccessibilityId("test");20el.tap(1);21var el = driver.findElementByAccessibilityId("test");22el.tap(1, 1);23var el = driver.findElementByAccessibilityId("test");24el.tap(1);25var el = driver.findElementByAccessibilityId("test");26el.tap(1, 1);

Full Screen

Using AI Code Generation

copy

Full Screen

1await el.tap();2await el.click();3await el.tap();4await el.click();5await el.tap();6await el.click();7await el.tap();8await el.click();9await el.tap();10await el.click();11await el.tap();12await el.click();13await el.tap();

Full Screen

Using AI Code Generation

copy

Full Screen

1var el = driver.elementById('MyButton');2el.tap(5,5);3var el = driver.elementById('MyButton');4el.click();5var el = driver.elementById('MyButton');6el.click();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var desired = {3};4var driver = wd.promiseChainRemote('localhost', 4723);5driver.init(desired).then(function() {6 return driver.elementByAccessibilityId('myButton');7}).then(function(el) {8 return el.tap();9}).then(function() {10 return driver.quit();11}).done();

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