How to use this.initAUT method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

WhatsAppController.js

Source:WhatsAppController.js Github

copy

Full Screen

1import ExtendsHtmlFunctions from './../util/ExtendsHtmlFunctions'2import {Format} from './../util/Format'3import {CameraController} from './../controller/CameraController'4import {DocumentPreviewController} from './../controller/DocumentPreviewController'5import {MicrophoneController} from './../controller/MicrophoneController'6import {Firebase} from './../util/Firebase'7import {User} from './../model/User'8import {Chat} from "../model/Chat";9import {Message} from "../model/Message";10import {Base64} from "../util/Base64";11import {ContactsController} from './../controller/ContactsController'12import {Upload} from "../util/Upload";13export default class WhatsAppController{14 constructor(){15 console.log('class WhatsAppController ok')16 this._firebase = new Firebase()17 this.initAut()18 // elementsPrototype()19 this.loadElements()20 this.initEvents()21 }22 initAut(){23 this._firebase.initAuth().then(response=>{24 console.log('_firebase.initAuth ',response)25 this._user = new User(response.user.email)26 this._user.on('datachange', data=>{27 console.log('user-datachange')28 document.querySelector('title').innerHTML = data.name + ' - WhatsApp Clone'29 this.el.inputNamePanelEditProfile.innerHTML = data.name30 if(data.photo){31 let photo = this.el.imgPanelEditProfile32 photo.src = data.photo33 photo.show()34 this.el.imgDefaultPanelEditProfile.hide()35 let photo2 = this.el.myPhoto.querySelector('img')36 photo2.src = data.photo37 photo2.show()38 }39 this.initContacts()40 })41 this._user.name = response.user.displayName42 this._user.email = response.user.email43 this._user.photo = response.user.photoURL44 this._user.save().then(()=>{45 this.el.appContent.css({46 display:'flex'47 })48 })49 // let userRef = User.findByEmail(response.user.email)50 //51 // userRef.set({52 // name: response.user.displayName,53 // email: response.user.email,54 // photo: response.user.photoURL55 // }).then(()=>{56 //57 // }).catch(error=>{58 // console.log(error)59 // })60 //61 // this._token = response.token62 }).catch(error=>{63 console.log(error)64 })65 }66 initContacts(){67 this._user.on('contactschange', docs=>{68 console.log('user-on-contactschange ', docs)69 this.el.contactsMessagesList.innerHTML = ''70 docs.forEach(doc =>{71 let contact = doc.data()72 let div = document.createElement('div')73 div.className = 'contact-item'74 div.innerHTML = ` 75 <div class="dIyEr">76 <div class="_1WliW" style="height: 49px; width: 49px;">77 <img src="#" class="Qgzj8 gqwaM photo" style="display:none;">78 <div class="_3ZW2E">79 <span data-icon="default-user" class="">80 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 212 212" width="212" height="212">81 <path fill="#DFE5E7" d="M106.251.5C164.653.5 212 47.846 212 106.25S164.653 212 106.25 212C47.846 212 .5 164.654.5 106.25S47.846.5 106.251.5z"></path>82 <g fill="#FFF">83 <path d="M173.561 171.615a62.767 62.767 0 0 0-2.065-2.955 67.7 67.7 0 0 0-2.608-3.299 70.112 70.112 0 0 0-3.184-3.527 71.097 71.097 0 0 0-5.924-5.47 72.458 72.458 0 0 0-10.204-7.026 75.2 75.2 0 0 0-5.98-3.055c-.062-.028-.118-.059-.18-.087-9.792-4.44-22.106-7.529-37.416-7.529s-27.624 3.089-37.416 7.529c-.338.153-.653.318-.985.474a75.37 75.37 0 0 0-6.229 3.298 72.589 72.589 0 0 0-9.15 6.395 71.243 71.243 0 0 0-5.924 5.47 70.064 70.064 0 0 0-3.184 3.527 67.142 67.142 0 0 0-2.609 3.299 63.292 63.292 0 0 0-2.065 2.955 56.33 56.33 0 0 0-1.447 2.324c-.033.056-.073.119-.104.174a47.92 47.92 0 0 0-1.07 1.926c-.559 1.068-.818 1.678-.818 1.678v.398c18.285 17.927 43.322 28.985 70.945 28.985 27.678 0 52.761-11.103 71.055-29.095v-.289s-.619-1.45-1.992-3.778a58.346 58.346 0 0 0-1.446-2.322zM106.002 125.5c2.645 0 5.212-.253 7.68-.737a38.272 38.272 0 0 0 3.624-.896 37.124 37.124 0 0 0 5.12-1.958 36.307 36.307 0 0 0 6.15-3.67 35.923 35.923 0 0 0 9.489-10.48 36.558 36.558 0 0 0 2.422-4.84 37.051 37.051 0 0 0 1.716-5.25c.299-1.208.542-2.443.725-3.701.275-1.887.417-3.827.417-5.811s-.142-3.925-.417-5.811a38.734 38.734 0 0 0-1.215-5.494 36.68 36.68 0 0 0-3.648-8.298 35.923 35.923 0 0 0-9.489-10.48 36.347 36.347 0 0 0-6.15-3.67 37.124 37.124 0 0 0-5.12-1.958 37.67 37.67 0 0 0-3.624-.896 39.875 39.875 0 0 0-7.68-.737c-21.162 0-37.345 16.183-37.345 37.345 0 21.159 16.183 37.342 37.345 37.342z"></path>84 </g>85 </svg>86 </span>87 </div>88 </div>89 </div>90 <div class="_3j7s9">91 <div class="_2FBdJ">92 <div class="_25Ooe">93 <span dir="auto" title="${contact.name}" class="_1wjpf">${contact.name}</span>94 </div>95 <div class="_3Bxar">96 <span class="_3T2VG">${Format.timeStampToTime(contact.lastMessageTime)}</span>97 </div>98 </div>99 <div class="_1AwDx">100 <div class="_itDl">101 <span title="digitando…" class="vdXUe _1wjpf typing" style="display:none">digitando…</span>102 103 <span class="_2_LEW last-message">104 <div class="_1VfKB">105 <span data-icon="status-dblcheck" class="">106 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18">107 <path fill="#263238" fill-opacity=".4" d="M17.394 5.035l-.57-.444a.434.434 0 0 0-.609.076l-6.39 8.198a.38.38 0 0 1-.577.039l-.427-.388a.381.381 0 0 0-.578.038l-.451.576a.497.497 0 0 0 .043.645l1.575 1.51a.38.38 0 0 0 .577-.039l7.483-9.602a.436.436 0 0 0-.076-.609zm-4.892 0l-.57-.444a.434.434 0 0 0-.609.076l-6.39 8.198a.38.38 0 0 1-.577.039l-2.614-2.556a.435.435 0 0 0-.614.007l-.505.516a.435.435 0 0 0 .007.614l3.887 3.8a.38.38 0 0 0 .577-.039l7.483-9.602a.435.435 0 0 0-.075-.609z"></path>108 </svg>109 </span>110 </div>111 <span dir="ltr" class="_1wjpf _3NFp9">${contact.lastMessage}</span>112 <div class="_3Bxar">113 <span>114 <div class="_15G96">115 <span class="OUeyt messages-count-new" style="display:none;">1</span>116 </div>117 </span></div>118 </span>119 </div>120 </div>121 </div> 122 `123 if(contact.photo){124 let img = div.querySelector('.photo')125 img.src = contact.photo126 img.show()127 }128 div.on('click', e=>{129 this.setActiveChat(contact)130 })131 this.el.contactsMessagesList.appendChild(div)132 })133 })134 this._user.getContacts()135 }136 setActiveChat(contact){137 console.log('chatid ', contact.chatId)138 if (this._contactAtive){139 Message.getRef(this._contactAtive.chatId).onSnapshot(()=>{})140 }141 this._contactAtive = contact142 this.el.activeName.innerHTML = contact.name143 this.el.activeStatus.innerHTML = contact.status144 if(contact.photo){145 let img = this.el.activePhoto146 img.src = contact.photo147 img.show()148 }149 this.el.home.hide()150 this.el.main.css({151 display: 'flex'152 })153 this.el.panelMessagesContainer.innerHTML = ''154 Message.getRef(this._contactAtive.chatId).orderBy('timeStamp').onSnapshot(docs=>{155 let scrollTop = this.el.panelMessagesContainer.scrollTop156 let scrollTopMax = (this.el.panelMessagesContainer.scrollHeight - this.el.panelMessagesContainer.offsetHeight)157 // let autoScroll = (scrollTop >= scrollTopMax)158 let autoScroll = (scrollTop >= (scrollTopMax - 1))159 docs.forEach(doc =>{160 let data = doc.data()161 data.id = doc.id162 let message = new Message()163 message.fromJSON(data)164 let me = (data.from === this._user.email)165 let view = message.getViewElement(me)166 if(!this.el.panelMessagesContainer.querySelector('#_'+data.id)){167 console.log(scrollTop, scrollTopMax)168 if(!me){169 doc.ref.set({170 status: 'read'171 },{172 merge:true173 })174 }175 this.el.panelMessagesContainer.appendChild(view)176 }else {177 //178 let parent = this.el.panelMessagesContainer.querySelector('#_'+data.id).parentNode179 //troca o conteudo sem apagar eventos pre-programados180 parent.replaceChild(view, this.el.panelMessagesContainer.querySelector('#_'+data.id) )181 // this.el.panelMessagesContainer.querySelector('#_'+data.id).innerHTML = view.innerHTML182 }183 if(this.el.panelMessagesContainer.querySelector('#_'+data.id) && me){184 let msgEl = this.el.panelMessagesContainer.querySelector('#_'+data.id)185 msgEl.querySelector(".message-status").innerHTML = message.getStatusViewElement().outerHTML186 }187 if(message.type === 'contact'){188 view.querySelector(".btn-message-send").on('click', e=>{189 console.log('enviar mensagem')190 Chat.createIfNotExists(this._user.email, message.content.email).then(chat =>{191 console.log('createIfNotExists-then ', chat)192 let contact = new User(message.content.email)193 contact.on('datachange', e=>{194 contact.chatId = chat.id195 this._user.addContact(contact)196 this._user.chatId = chat.id197 contact.addContact(this._user)198 this.setActiveChat(contact)199 })200 })201 })202 }203 })204 if(autoScroll){205 this.el.panelMessagesContainer.scrollTop = (this.el.panelMessagesContainer.scrollHeight - this.el.panelMessagesContainer.offsetHeight)206 }else{207 this.el.panelMessagesContainer.scrollTop = scrollTop208 }209 })210 }211 loadElements(){212 this.el = {}213 let sizeFields = document.querySelectorAll('[id]').length214 console.log('quantidade de campos na tela: ', sizeFields)215 document.querySelectorAll('[id]').forEach(element=>{216 let name = Format.getCamelCase(element.id)217 console.log('linha-suprema: ', name, element.id)218 this.el[name]= element219 })220 }221 initEvents(){222 this.el.inputSearchContacts.on('keyup',e=>{223 if( this.el.inputSearchContacts.value.length > 0){224 this.el.inputSearchContactsPlaceholder.hide()225 }else{226 this.el.inputSearchContactsPlaceholder.show()227 }228 this._user.getContacts(this.el.inputSearchContacts.value)229 })230 this.el.myPhoto.on('click', e=>{231 this.closeAllLeftPanel()232 this.el.panelEditProfile.show()233 setTimeout(()=>{ this.el.panelEditProfile.addClass('open') }, 300)234 })235 this.el.btnClosePanelEditProfile.on('click', e=>{236 this.el.panelEditProfile.removeClass('open')237 })238 this.el.btnNewContact.on('click', e=>{239 this.closeAllLeftPanel()240 this.el.panelAddContact.show()241 setTimeout(()=>{ this.el.panelAddContact.addClass('open') }, 300)242 })243 this.el.btnClosePanelAddContact.on('click', e=>{244 this.el.panelAddContact.removeClass('open')245 })246 this.el.photoContainerEditProfile.on('click', e=>{247 this.el.inputProfilePhoto.click()248 })249 this.el.inputProfilePhoto.on('change', e=>{250 if(this.el.inputProfilePhoto.files.length > 0){251 let file = this.el.inputProfilePhoto.files[0]252 Upload.send(file, this._user.email ).then((downloadURLPhotoProfile)=>{253 this._user.photo = downloadURLPhotoProfile254 this._user.save().then(()=>{255 this.el.btnClosePanelEditProfile.click()256 })257 })258 }259 })260 this.el.inputNamePanelEditProfile.on('keypress', e=>{261 if(e.key === 'Enter'){262 e.preventDefault()263 this.el.btnSavePanelEditProfile.click()264 }265 })266 this.el.btnSavePanelEditProfile.on('click', e=>{267 console.log(this.el.inputNamePanelEditProfile.innerHTML)268 this.el.btnSavePanelEditProfile.disabled = true269 this._user.name = this.el.inputNamePanelEditProfile.innerHTML270 this._user.save().then(()=>{271 this.el.btnSavePanelEditProfile.disabled = false272 })273 })274 this.el.formPanelAddContact.on('submit', e=>{275 e.preventDefault()276 let formData = new FormData(this.el.formPanelAddContact)277 let contact = new User(formData.get('email'))278 contact.on('datachange', data =>{279 console.log('formPanelAddContact-datachange ', data)280 if(data.name){281 Chat.createIfNotExists(this._user.email, contact.email).then(chat =>{282 console.log('createIfNotExists-then ', chat)283 contact.chatId = chat.id284 this._user.chatId = chat.id285 contact.addContact(this._user)286 this._user.addContact(contact).then(()=>{287 console.log('contato adicionado')288 this.el.btnClosePanelAddContact.click()289 })290 })291 }else{292 console.log('error usuario nao encontrado')293 }294 })295 })296 this.el.contactsMessagesList.querySelectorAll('.contact-item').forEach(item=>{297 item.on('click', e=>{298 this.el.home.hide()299 this.el.main.css({300 display: 'flex'301 })302 })303 })304 this.el.btnAttach.on('click',e=>{305 e.stopPropagation()306 this.el.menuAttach.addClass('open')307 document.addEventListener('click',this.closeMenuAttach.bind(this))308 })309 this.el.btnAttachPhoto.on('click',e=>{310 console.log('photo')311 this.el.inputPhoto.click()312 })313 this.el.inputPhoto.on('change', e=>{314 console.log(this.el.inputPhoto.files)315 console.dir(this.el.inputPhoto.files)316 console.log(this.el.inputPhoto.files.toArray())317 this.el.inputPhoto.files.toArray().forEach( file=>{318 console.log('file ', file)319 Message.sendImage(this._contactAtive.chatId, this._user.email, file).then(resp=>{320 console.log('Message.sendImage-then->> ',resp)321 }).catch(error=>{322 console.log('Message.sendImage-error->> ',error)323 })324 })325 })326 this.el.btnAttachCamera.on('click',e=>{327 console.log('camera')328 this.closeAllMainPanel()329 this.el.panelCamera.addClass('open')330 this.el.panelCamera.css({331 "height":"calc(100% - 120px)",332 })333 this._camera = new CameraController(this.el.videoCamera)334 })335 this.el.btnClosePanelCamera.on('click', e=>{336 this.closeAllMainPanel()337 this.el.panelMessagesContainer.show()338 this._camera.stop()339 })340 this.el.btnTakePicture.on('click', e=>{341 console.log('btnTakePictore')342 let dataUrl = this._camera.takePicture()343 this.el.pictureCamera.src = dataUrl344 this.el.pictureCamera.show()345 this.el.videoCamera.hide()346 this.el.btnReshootPanelCamera.show()347 this.el.containerTakePicture.hide()348 this.el.containerSendPicture.show()349 })350 this.el.btnReshootPanelCamera.on('click', e=>{351 this.el.pictureCamera.hide()352 this.el.videoCamera.show()353 this.el.btnReshootPanelCamera.hide()354 this.el.containerTakePicture.show()355 this.el.containerSendPicture.hide()356 })357 this.el.btnSendPicture.on('click', e=>{358 console.log('btnSendPicture')359 console.log('this.el.pictureCamera ', this.el.pictureCamera.src)360 this.el.btnSendPicture.disabled = true361 let regex = /^data:(.+);base64,(.*)$/362 let result = this.el.pictureCamera.src.match(regex)363 console.log('result ',result)364 let mimeType = result[1]365 let ext = mimeType.split('/')[1]366 let filename = `camera${Date.now()}.${ext}`367 let picture = new Image()368 picture.src = this.el.pictureCamera.src369 picture.onload = e =>{370 let canvas = document.createElement('canvas')371 let context = canvas.getContext('2d')372 canvas.width = picture.width373 canvas.height = picture.height374 context.translate(picture.width, 0)375 context.scale(-1,1)376 context.drawImage(picture,0,0, canvas.width, canvas.height)377 // fetch(this.el.pictureCamera.src)378 fetch(canvas.toDataURL(mimeType))379 .then( res=>{ return res.arrayBuffer() })380 .then(buffer=>{ return new File([buffer], filename, {type:mimeType})})381 .then(file=>{382 Message.sendImage(this._contactAtive.chatId, this._user.email, file)383 this.el.btnSendPicture.disabled = true384 this.closeAllMainPanel()385 this._camera.stop()386 this.el.btnReshootPanelCamera.hide()387 this.el.pictureCamera.hide()388 this.el.videoCamera.show()389 this.el.containerSendPicture.hide()390 this.el.containerTakePicture.show()391 this.el.panelMessagesContainer.show()392 })393 }394 })395 this.el.btnAttachDocument.on('click',e=>{396 console.log('Document')397 this.closeAllMainPanel()398 this.el.panelDocumentPreview.addClass('open')399 this.el.panelDocumentPreview.css({400 "height":"calc(100% - 120px)",401 })402 this.el.inputDocument.click()403 })404 this.el.inputDocument.on('change',e=>{405 console.log('inputDocument-change->')406 if(this.el.inputDocument.files.length){407 this.el.panelDocumentPreview.css({408 "height":"1%",409 })410 let file = this.el.inputDocument.files[0]411 console.log(file)412 this._documentPreviewController = new DocumentPreviewController(file)413 this._documentPreviewController.getPreviewData().then(data=>{414 console.log('ok', data)415 this.el.imgPanelDocumentPreview.src = data.src416 this.el.infoPanelDocumentPreview.innerHTML = data.info417 this.el.imagePanelDocumentPreview.show()418 this.el.filePanelDocumentPreview.hide()419 this.el.panelDocumentPreview.css({420 "height":"calc(100% - 120px)",421 })422 this.el.imagePanelDocumentPreview.css({423 "height":"80%",424 "width":"75%"425 })426 }).catch(error=>{427 this.el.panelDocumentPreview.css({428 "height":"calc(100% - 120px)",429 })430 console.log('nok', error)431 switch (file.type) {432 default:433 console.log('default')434 this.el.iconPanelDocumentPreview.className = 'jcxhw icon-doc-generic'435 }436 this.el.filenamePanelDocumentPreview.innerHTML = file.name437 this.el.imagePanelDocumentPreview.hide()438 this.el.filePanelDocumentPreview.show()439 })440 }441 })442 this.el.btnClosePanelDocumentPreview.on('click', e=>{443 this.closeAllMainPanel()444 this.el.panelMessagesContainer.show()445 })446 this.el.btnSendDocument.on('click', e=>{447 console.log('btnSendDocument')448 let file = this.el.inputDocument.files[0]449 let base64 = this.el.imgPanelDocumentPreview.src450 if(file.type === 'application/pdf'){451 Base64.toFile(base64).then(filePreview =>{452 Message.sendDocument(453 this._contactAtive.chatId,454 this._user.email,455 file,456 filePreview,457 this.el.infoPanelDocumentPreview.innerHTML458 )459 })460 }else{461 Message.sendDocument(462 this._contactAtive.chatId,463 this._user.email,464 file465 )466 }467 this.el.btnClosePanelDocumentPreview.click()468 })469 this.el.btnAttachContact.on('click',e=>{470 console.log('Contact')471 this._contactsController = new ContactsController(this.el.modalContacts , this._user)472 this._contactsController.on('select', (contact) =>{473 Message.sendContact(474 this._contactAtive.chatId,475 this._user.email,476 contact477 )478 })479 this._contactsController.open()480 })481 this.el.btnCloseModalContacts.on('click',e=>{482 console.log('btnCloseModalContacts')483 this._contactsController.close()484 })485 this.el.btnSendMicrophone.on('click', e=>{486 console.log('btnSendMicrophone')487 this.el.recordMicrophone.show()488 this.el.btnSendMicrophone.hide()489 this._microphoneController = new MicrophoneController()490 this._microphoneController.on('ready', (audio)=>{491 console.log('on-ready ', audio)492 this._microphoneController.startRecorder()493 })494 this._microphoneController.on('recordtimer', (duration)=>{495 this.el.recordMicrophoneTimer.innerHTML = Format.toTime(duration)496 })497 })498 this.el.btnCancelMicrophone.on('click', e=>{499 console.log('btnCanceldMicrophone')500 this._microphoneController.stoptRecorder()501 this.closeRecordMicrophone()502 })503 this.el.btnFinishMicrophone.on('click', e=>{504 console.log('btnFinishMicrophone')505 this._microphoneController.on('recorded', (file, metadata)=>{506 Message.sendAudio(507 this._contactAtive.chatId,508 this._user.email,509 file,510 metadata,511 this._user.photo512 )513 })514 this._microphoneController.stoptRecorder()515 this.closeRecordMicrophone()516 })517 this.el.inputText.on('keypress', e=>{518 if(e.key === "Enter" && !e.ctrlKey){519 e.preventDefault()520 this.el.btnSend.click()521 }522 })523 this.el.inputText.on('keyup', e=>{524 if( this.el.inputText.innerHTML.length ){525 this.el.inputPlaceholder.hide()526 this.el.btnSendMicrophone.hide()527 this.el.btnSend.show()528 }else{529 this.el.inputPlaceholder.show()530 this.el.btnSendMicrophone.show()531 this.el.btnSend.hide()532 }533 })534 this.el.btnSend.on('click', e=>{535 console.log('btnSend')536 Message.send(537 this._contactAtive.chatId,538 this._user.email,539 'text',540 this.el.inputText.innerHTML541 )542 this.el.inputText.innerHTML=''543 this.el.panelEmojis.removeClass('open')544 })545 this.el.btnEmojis.on('click', e=>{546 console.log('btnEmojis')547 this.el.panelEmojis.toggleClass('open')548 })549 this.el.panelEmojis.querySelectorAll('.emojik').forEach( emoji=>{550 emoji.on('click', e=>{551 console.log('e ', emoji.dataset.unicode)552 let img = this.el.imgEmojiDefault.cloneNode()553 img.style.cssText = emoji.dataset.cssText554 img.style.unicode = emoji.dataset.unicode555 img.alt = emoji.dataset.unicode556 emoji.classList.forEach( name=>{557 img.classList.add(name)558 })559 // this.el.inputText.append(img)560 let cursor = window.getSelection()561 if(!cursor.focusNode || !cursor.focusNode.id == 'input-text'){562 this.el.inputText.focus()563 cursor = window.getSelection()564 }565 let range = document.createRange()566 range = cursor.getRangeAt(0)567 range.deleteContents()568 let frag = document.createDocumentFragment()569 frag.appendChild(img)570 range.insertNode(frag)571 range.setStartAfter(img)572 // provocar um evento real573 this.el.inputText.dispatchEvent(new Event('keyup'))574 })575 })576 }577 closeRecordMicrophone(){578 this.el.recordMicrophone.hide()579 this.el.btnSendMicrophone.hide()580 this.el.btnSendMicrophone.show()581 console.log('this._recordMicrophoneInterval ', this._recordMicrophoneInterval)582 }583 closeAllMainPanel(){584 this.el.panelMessagesContainer.hide()585 this.el.panelDocumentPreview.removeClass('open')586 this.el.panelCamera.removeClass('open')587 }588 closeMenuAttach(event){589 document.removeEventListener('click',this.closeMenuAttach)590 this.el.menuAttach.removeClass('open')591 console.log('remove')592 }593 closeAllLeftPanel(){594 this.el.panelAddContact.hide()595 this.el.panelEditProfile.hide()596 }...

Full Screen

Full Screen

driver.js

Source:driver.js Github

copy

Full Screen

...134 await helpers.initDevice(this.adb, this.opts);135 // Further prepare the device by forwarding the Selendroid port136 await this.adb.forwardPort(this.opts.systemPort, DEVICE_PORT);137 // prepare our actual AUT, get it on the device, etc...138 await this.initAUT();139 // unlock the device to prepare it for testing140 await helpers.unlock(this, this.adb, this.caps);141 // launch selendroid and wait till its online and we have a session142 await this.selendroid.startSession(this.caps);143 // rescue selendroid if it fails to start our AUT144 await this.ensureAppStarts();145 // if we want to immediately get into a webview, set our context146 // appropriately147 if (this.opts.autoWebview) {148 await retryInterval(20, this.opts.autoWebviewTimeout || 2000, async () => {149 await this.setContext(this.defaultWebviewName());150 });151 }152 // now that everything has started successfully, turn on proxying so all...

Full Screen

Full Screen

general.js

Source:general.js Github

copy

Full Screen

...153 await this.bootstrap.sendAction('updateStrings');154 return this.apkStrings[language];155};156commands.launchApp = async function () {157 await this.initAUT();158 await this.startAUT();159};160commands.startActivity = async function (appPackage, appActivity,161 appWaitPackage, appWaitActivity,162 intentAction, intentCategory,163 intentFlags, optionalIntentArguments,164 dontStopAppOnReset) {165 log.debug(`Starting package '${appPackage}' and activity '${appActivity}'`);166 // dontStopAppOnReset is both an argument here, and a desired capability167 // if the argument is set, use it, otherwise use the cap168 if (!util.hasValue(dontStopAppOnReset)) {169 dontStopAppOnReset = !!this.opts.dontStopAppOnReset;170 }171 let args = {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var chai = require('chai');4var chaiAsPromised = require('chai-as-promised');5chai.use(chaiAsPromised);6var should = chai.should();7var expect = chai.expect;8var fs = require('fs');9var path = require('path');10var desiredCaps = {11};

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var driver = wd.promiseChainRemote('localhost', 4723);3var desired = {4};5 .init(desired)6 .setImplicitWaitTimeout(3000)7 .then(function() {8 .elementByName('Button')

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var serverConfig = {4};5var desiredCaps = {6};7var driver = wd.promiseChainRemote(serverConfig);8driver.init(desiredCaps)9 .then(function() {10 return driver.initAUT('com.android.calculator2', 'com.android.calculator2.Calculator');11 })12 .then(function() {13 return driver.quit();14 })15 .done();16var wd = require('wd');17var assert = require('assert');18var serverConfig = {19};20var desiredCaps = {21};22var driver = wd.promiseChainRemote(serverConfig);23driver.init(desiredCaps)24 .then(function() {25 return driver.initAUT('com.apple.mobilecal', 'com.apple.mobilecal.Calculator');26 })27 .then(function() {28 return driver.quit();29 })30 .done();31var wd = require('wd');32var assert = require('assert');33var serverConfig = {34};35var desiredCaps = {36};37var driver = wd.promiseChainRemote(serverConfig);38driver.init(desiredCaps)39 .then(function() {40 return driver.initAUT('com.apple.mobilecal', 'com.apple.mobilecal.Calculator');41 })42 .then(function() {43 return driver.quit();44 })45 .done();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var chai = require('chai');4var should = chai.should();5var expect = chai.expect;6var capabilities = {7};8var driver = wd.promiseChainRemote("

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var desiredCaps = {3};4 .init(desiredCaps)5 .then(function () {6 return driver.initAUT(desiredCaps.app);7 })8 .then(function () {9 return driver.quit();10 })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 Android Driver automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful