How to use pickPackage method in Playwright Internal

Best JavaScript code snippet using playwright-internal

app.js

Source:app.js Github

copy

Full Screen

1window.addEventListener('DOMContentLoaded', function() {2 var actionLock = false,3 currentHardware = Wallace.getSystemProperty('ro.hardware'),4 enableNokiaActions = (Wallace.getSystemProperty('ro.product.brand') === 'Nokia'),5 enableSim2Actions = (Wallace.getSystemProperty('persist.radio.multisim.config') === 'dsds'),6 enableQualcommActions = (currentHardware === 'qcom'),7 enableMtkActions = (currentHardware === 'mt6572' || currentHardware.slice(0,5) === 'mt673'),8 currentKaiosVersion = Wallace.getSystemPreference('b2g.version'),9 enableCallRecordingActions = (parseInt(currentKaiosVersion.replace(/[^\d]/g,'')) >= 252),10 enableImeiActions = enableNokiaActions || enableMtkActions11 12 if(!enableNokiaActions)13 [].forEach.call(document.querySelectorAll('.nokiaonly'), function(el) {14 el.classList.remove('danger')15 el.classList.add('disabled')16 })17 if(!enableImeiActions)18 [].forEach.call(document.querySelectorAll('.imeionly'), function(el) {19 el.classList.remove('danger')20 el.classList.add('disabled')21 })22 if(!enableSim2Actions)23 [].forEach.call(document.querySelectorAll('.sim2only'), function(el) {24 el.classList.remove('danger')25 el.classList.add('disabled')26 })27 if(!enableQualcommActions)28 [].forEach.call(document.querySelectorAll('.qualcommonly'), function(el) {29 el.classList.remove('danger')30 el.classList.add('disabled')31 })32 if(!enableCallRecordingActions)33 document.querySelector('.callrec').classList.add('disabled')34 35 var overclockScript = [36 'echo 96 > /sys/devices/system/cpu/cpufreq/interactive/target_loads',37 'echo 1094400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq',38 'echo 24 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load',39 'echo 0 > /sys/module/msm_thermal/core_control/enabled'40 ].join(' && ')41 42 var rootingScript = [43 'mount -o remount,rw /',44 'sleep 0.5',45 'stop adbd',46 'mv /sbin/adbd /sbin/adbd.orig',47 'cp /data/local/tmp/adbd /sbin/adbd',48 'chown root:root /sbin/adbd && chmod 750 /sbin/adbd',49 'mount -o remount,ro /',50 'rm /data/local/tmp/adbd',51 'sleep 0.5',52 'start adbd'53 ].join(';')54 55 window.addEventListener('keydown', function(e) {56 if(!actionLock) {57 switch(e.key) {58 case '1': //enable ADB root access until reboot59 Wallace.extractAppAsset('wallace-toolbox.bananahackers.net', 'rsrc/adbd.bin', '/data/local/tmp/adbd', function() { 60 Wallace.runCmd(rootingScript, function() {61 window.alert('Rooted ADB access until reboot')62 }, function() {63 window.alert('Something went wrong: ' + this.error.name)64 })65 })66 break67 case '2': //call recording AUTO/ON/OFF68 if(enableCallRecordingActions) {69 Wallace.getSystemSetting('callrecording.mode', function(curMode) {70 var nextMode = 'on'71 if(curMode === 'auto') nextMode = 'off'72 else if(curMode === 'on') nextMode = 'auto'73 Wallace.enableCallRecording(nextMode, 'wav', function() {74 var msgs = {75 'on': 'set to manual',76 'auto': 'set to automatic',77 'off': 'disabled'78 }79 window.alert('Call recording ' + msgs[nextMode])80 }, function(e) {81 window.alert('Error: ' + e)82 })83 }, function(e) {84 window.alert('Error: ' + e)85 })86 } else window.alert('Sorry, call recording is implemented in KaiOS 2.5.2 and above, but you have ' + currentKaiosVersion)87 break88 case '3': //install app package89 actionLock = true90 var pickPackage = new MozActivity({name: "pick"})91 pickPackage.onsuccess = function() {92 Wallace.installPkg(this.result.blob, function() {93 window.alert('App ' + pickPackage.result.blob.name + ' successfully installed')94 actionLock = false95 }, function(e) {96 if(e.toString() === 'InvalidPrivilegeLevel')97 window.alert('Insufficient privileges. You must enable developer menu (#) before trying to install packages.')98 else99 window.alert('Error installing the package file: ' + e)100 actionLock = false101 })102 }103 pickPackage.onerror = function(e) {104 window.alert('Error picking the package file: ' + e.name)105 actionLock = false106 }107 break108 case '4': //override TTL109 if(enableQualcommActions) {110 actionLock = true111 var newTTL = parseInt(window.prompt('New TTL value', 64))112 if(newTTL && newTTL < 256) {113 Wallace.fixTTL(newTTL, function() {114 window.alert('TTL fixed at the value ' + newTTL + ' until reboot')115 actionLock = false116 }, function(e) {117 window.alert('Error: ' + e)118 actionLock = false119 }, enableMtkActions ? 'ccmni0' : 'rmnet_data0')120 }121 else {122 window.alert('Invalid TTL value')123 actionLock = false124 }125 }126 else window.alert('Error: TTL can be overridden on Qualcomm platform only')127 break128 case '5': //Edit IMEI1129 if(enableNokiaActions) {130 if(window.confirm('Are you sure you really want to change IMEI1?')) {131 var newIMEI = window.prompt('New IMEI1', Wallace.generateRandomIMEI())132 if(newIMEI) {133 actionLock = true134 Wallace.setNokiaIMEI(1, newIMEI, function() {135 if(window.confirm('IMEI1 changed to ' + newIMEI + '. Reboot to apply?'))136 Wallace.reboot()137 actionLock = false138 }, function(e) {139 window.alert('Error: invalid IMEI')140 actionLock = false141 })142 }143 }144 break145 } else if(enableMtkActions) {146 if(window.confirm('Are you sure you really want to change IMEI1?')) {147 var newIMEI = window.prompt('New IMEI1', Wallace.generateRandomIMEI())148 if(newIMEI) {149 actionLock = true150 Wallace.setMtkIMEI(1, newIMEI, function() {151 if(window.confirm('IMEI1 changed to ' + newIMEI + '. Reboot to apply?'))152 Wallace.reboot()153 actionLock = false154 }, function(e) {155 window.alert('Error: invalid IMEI')156 actionLock = false157 })158 }159 }160 break161 } else window.alert('Error: IMEI editor is implemented for Nokia and MTK handsets only')162 break163 case '6': //Edit IMEI2164 if(enableNokiaActions) {165 if(enableSim2Actions) {166 if(window.confirm('Are you sure you really want to change IMEI2?')) {167 var newIMEI = window.prompt('New IMEI2', Wallace.generateRandomIMEI())168 if(newIMEI) {169 actionLock = true170 Wallace.setNokiaIMEI(2, newIMEI, function() {171 if(window.confirm('IMEI2 changed to ' + newIMEI + '. Reboot to apply?'))172 Wallace.reboot()173 actionLock = false174 }, function(e) {175 window.alert('Error: invalid IMEI')176 actionLock = false177 })178 }179 }180 break181 } else window.alert('Error: trying to change IMEI2 on a single-SIM configuration')182 } else if(enableMtkActions) {183 if(enableSim2Actions) {184 if(window.confirm('Are you sure you really want to change IMEI2?')) {185 var newIMEI = window.prompt('New IMEI2', Wallace.generateRandomIMEI())186 if(newIMEI) {187 actionLock = true188 Wallace.setMtkIMEI(2, newIMEI, function() {189 if(window.confirm('IMEI2 changed to ' + newIMEI + '. Reboot to apply?'))190 Wallace.reboot()191 actionLock = false192 }, function(e) {193 window.alert('Error: invalid IMEI')194 actionLock = false195 })196 }197 }198 break199 } else window.alert('Error: trying to change IMEI2 on a single-SIM configuration')200 } else window.alert('Error: IMEI editor is implemented for Nokia and MTK handsets only')201 break202 case '7': //Proxy on/off203 Wallace.getSystemSetting('browser.proxy.enabled', function(res) {204 var newVal = !(res === true)205 Wallace.setSystemSetting('browser.proxy.enabled', newVal, function() {206 window.alert('Proxy ' + (newVal ? 'enabled' : 'disabled') + ' successfully')207 }, function(e) {208 window.alert('Error ' + (newVal ? 'enabling' : 'disabling') + ' proxy: ' + e)209 })210 }, function(e) {211 window.alert('Error: ' + e)212 })213 break214 case '8': //Set proxy host/port215 actionLock = true216 Wallace.getSystemSetting('browser.proxy.host', function(oldHost) {217 Wallace.getSystemSetting('browser.proxy.port', function(oldPort) {218 var newHost = window.prompt('Proxy host', oldHost || '')219 var newPort = Number(window.prompt('Proxy port', oldPort || ''))220 if(newHost && newPort) {221 Wallace.setSystemSetting('browser.proxy.host', newHost, function() {222 Wallace.setSystemSetting('browser.proxy.port', newPort, function() {223 window.alert('Proxy set successfully')224 actionLock = false225 }, function(e) {226 window.alert('Error setting proxy port: ' + e)227 actionLock = false228 })229 }, function(e) {230 window.alert('Error setting proxy host: ' + e)231 actionLock = false232 })233 }234 else {235 window.alert('Error: Cannot set empty values for host or port')236 actionLock = false237 }238 }, function(e) {239 window.alert('Error: ' + e)240 actionLock = false241 })242 }, function(e) {243 window.alert('Error: ' + e)244 actionLock = false245 })246 break247 case '9': //override the user agent248 if(window.confirm('Do you want to change the user agent? You will not be able to revert it without WebIDE or factory reset!')) {249 actionLock = true250 var newUA = window.prompt('User agent', navigator.userAgent)251 if(newUA === '') newUA = navigator.userAgent252 Wallace.setUserAgent(newUA)253 actionLock = false254 }255 break256 case '*': //run overclock script257 if(enableQualcommActions) {258 actionLock = true259 Wallace.runCmd(overclockScript, function() {260 window.alert('Overclocking until reboot')261 actionLock = false262 }, function(e) {263 window.alert('Error: ' + e)264 actionLock = false265 })266 }267 else alert('Error: Overclocking is enabled for Qualcomm devices only')268 break269 case '0': //toggle diag port270 if(enableQualcommActions) {271 Wallace.toggleDiagPort(function() {272 window.alert('Diagnostics port enabled')273 }, function() {274 window.alert('Diagnostics port disabled')275 }, function(e) {276 window.alert('Error toggling diag port: ' + e)277 })278 }279 else window.alert('Error: DIAG port can be used on Qualcomm platform only')280 break281 case '#': //developer menu282 if(window.confirm('Enable developer menu and reboot?'))283 Wallace.runCmd('echo -n root > /cache/__post_reset_cmd__;cp /cache/__post_reset_cmd__ /persist/__post_reset_cmd__', function() {284 Wallace.reboot()285 }, function(e) {286 window.alert('Error: ' + e)287 })288 break289 case 'Call': //set Wi-Fi MAC address290 if(enableNokiaActions) {291 var newMAC = window.prompt('New Wi-Fi MAC', Wallace.generateRandomMAC())292 if(newMAC) {293 actionLock = true294 Wallace.setNokiaWlanMAC(newMAC, function() {295 if(window.confirm('MAC changed to ' + newMAC + '. Reboot to apply?'))296 Wallace.reboot()297 actionLock = false298 }, function(e) {299 window.alert('Error: invalid MAC')300 actionLock = false301 })302 }303 }304 else if(enableMtkActions) {305 var newMAC = window.prompt('New Wi-Fi MAC', Wallace.generateRandomMAC())306 if(newMAC) {307 actionLock = true308 Wallace.setMtkWlanMAC(newMAC, function() {309 window.alert('MAC changed to ' + newMAC + '. Toggle Wi-Fi off and on to apply until reboot')310 actionLock = false311 }, function(e) {312 window.alert('Error: invalid MAC')313 actionLock = false314 })315 }316 }317 else window.alert('Error: Wi-Fi MAC changer is currently available on Nokia and MTK handsets only')318 break 319 case 'SoftLeft': //set Bluetooth MAC address320 if(enableNokiaActions) {321 var newMAC = window.prompt('New Bluetooth MAC', Wallace.generateRandomMAC())322 if(newMAC) {323 actionLock = true324 Wallace.setNokiaBluetoothMAC(newMAC, function() {325 if(window.confirm('MAC changed to ' + newMAC + '. Reboot to apply?'))326 Wallace.reboot()327 actionLock = false328 }, function(e) {329 window.alert('Error: invalid MAC')330 actionLock = false331 })332 }333 }334 else window.alert('Error: Bluetooth MAC changer is currently available on Nokia handsets only')335 break 336 case 'SoftRight':337 if(window.confirm('Do you really want to make all pre-installed apps removable from the menu (requires Busybox) and reboot?')) {338 Wallace.runCmd('busybox sed -i \'s#"removable": false#"removable": true#g\' /data/local/webapps/webapps.json', function() {339 Wallace.reboot()340 }, function(e) {341 window.alert('Error: ' + e)342 })343 } 344 break345 default:346 break347 }348 }349 })...

Full Screen

Full Screen

js_app.js

Source:js_app.js Github

copy

Full Screen

1window.addEventListener('DOMContentLoaded', function() {2 var actionLock = false,3 currentHardware = Wallace.getSystemProperty('ro.hardware'),4 enableNokiaActions = (Wallace.getSystemProperty('ro.product.brand') === 'Nokia'),5 enableSim2Actions = (Wallace.getSystemProperty('persist.radio.multisim.config') === 'dsds'),6 enableQualcommActions = (currentHardware === 'qcom'),7 enableMtkActions = (currentHardware === 'mt6572' || currentHardware.slice(0,5) === 'mt673'),8 currentKaiosVersion = Wallace.getSystemPreference('b2g.version'),9 enableCallRecordingActions = (parseInt(currentKaiosVersion.replace(/[^\d]/g,'')) >= 252),10 enableImeiActions = enableNokiaActions || enableMtkActions11 12 if(!enableNokiaActions)13 [].forEach.call(document.querySelectorAll('.nokiaonly'), function(el) {14 el.classList.remove('danger')15 el.classList.add('disabled')16 })17 if(!enableImeiActions)18 [].forEach.call(document.querySelectorAll('.imeionly'), function(el) {19 el.classList.remove('danger')20 el.classList.add('disabled')21 })22 if(!enableSim2Actions)23 [].forEach.call(document.querySelectorAll('.sim2only'), function(el) {24 el.classList.remove('danger')25 el.classList.add('disabled')26 })27 if(!enableQualcommActions)28 [].forEach.call(document.querySelectorAll('.qualcommonly'), function(el) {29 el.classList.remove('danger')30 el.classList.add('disabled')31 })32 if(!enableCallRecordingActions)33 document.querySelector('.callrec').classList.add('disabled')34 35 var overclockScript = [36 'echo 96 > /sys/devices/system/cpu/cpufreq/interactive/target_loads',37 'echo 1094400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq',38 'echo 24 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load',39 'echo 0 > /sys/module/msm_thermal/core_control/enabled'40 ].join(' && ')41 42 var rootingScript = [43 'mount -o remount,rw /',44 'sleep 0.5',45 'stop adbd',46 'mv /sbin/adbd /sbin/adbd.orig',47 'cp /data/local/tmp/adbd /sbin/adbd',48 'chown root:root /sbin/adbd && chmod 750 /sbin/adbd',49 'mount -o remount,ro /',50 'rm /data/local/tmp/adbd',51 'sleep 0.5',52 'start adbd'53 ].join(';')54 55 window.addEventListener('keydown', function(e) {56 if(!actionLock) {57 switch(e.key) {58 case '1': //enable ADB root access until reboot59 Wallace.extractAppAsset('wallace-toolbox.bananahackers.net', 'rsrc/adbd.bin', '/data/local/tmp/adbd', function() { 60 Wallace.runCmd(rootingScript, function() {61 window.alert('Rooted ADB access until reboot')62 }, function() {63 window.alert('Something went wrong: ' + this.error.name)64 })65 })66 break67 case '2': //call recording AUTO/ON/OFF68 if(enableCallRecordingActions) {69 Wallace.getSystemSetting('callrecording.mode', function(curMode) {70 var nextMode = 'on'71 if(curMode === 'auto') nextMode = 'off'72 else if(curMode === 'on') nextMode = 'auto'73 Wallace.enableCallRecording(nextMode, 'wav', function() {74 var msgs = {75 'on': 'set to manual',76 'auto': 'set to automatic',77 'off': 'disabled'78 }79 window.alert('Call recording ' + msgs[nextMode])80 }, function(e) {81 window.alert('Error: ' + e)82 })83 }, function(e) {84 window.alert('Error: ' + e)85 })86 } else window.alert('Sorry, call recording is implemented in KaiOS 2.5.2 and above, but you have ' + currentKaiosVersion)87 break88 case '3': //install app package89 actionLock = true90 var pickPackage = new MozActivity({name: "pick"})91 pickPackage.onsuccess = function() {92 Wallace.installPkg(this.result.blob, function() {93 window.alert('App ' + pickPackage.result.blob.name + ' successfully installed')94 actionLock = false95 }, function(e) {96 if(e.toString() === 'InvalidPrivilegeLevel')97 window.alert('Insufficient privileges. You must enable developer menu (#) before trying to install packages.')98 else99 window.alert('Error installing the package file: ' + e)100 actionLock = false101 })102 }103 pickPackage.onerror = function(e) {104 window.alert('Error picking the package file: ' + e.name)105 actionLock = false106 }107 break108 case '4': //override TTL109 if(enableQualcommActions) {110 actionLock = true111 var newTTL = parseInt(window.prompt('New TTL value', 64))112 if(newTTL && newTTL < 256) {113 Wallace.fixTTL(newTTL, function() {114 window.alert('TTL fixed at the value ' + newTTL + ' until reboot')115 actionLock = false116 }, function(e) {117 window.alert('Error: ' + e)118 actionLock = false119 }, enableMtkActions ? 'ccmni0' : 'rmnet_data0')120 }121 else {122 window.alert('Invalid TTL value')123 actionLock = false124 }125 }126 else window.alert('Error: TTL can be overridden on Qualcomm platform only')127 break128 case '5': //Edit IMEI1129 if(enableNokiaActions) {130 if(window.confirm('Are you sure you really want to change IMEI1?')) {131 var newIMEI = window.prompt('New IMEI1', Wallace.generateRandomIMEI())132 if(newIMEI) {133 actionLock = true134 Wallace.setNokiaIMEI(1, newIMEI, function() {135 if(window.confirm('IMEI1 changed to ' + newIMEI + '. Reboot to apply?'))136 Wallace.reboot()137 actionLock = false138 }, function(e) {139 window.alert('Error: invalid IMEI')140 actionLock = false141 })142 }143 }144 break145 } else if(enableMtkActions) {146 if(window.confirm('Are you sure you really want to change IMEI1?')) {147 var newIMEI = window.prompt('New IMEI1', Wallace.generateRandomIMEI())148 if(newIMEI) {149 actionLock = true150 Wallace.setMtkIMEI(1, newIMEI, function() {151 if(window.confirm('IMEI1 changed to ' + newIMEI + '. Reboot to apply?'))152 Wallace.reboot()153 actionLock = false154 }, function(e) {155 window.alert('Error: invalid IMEI')156 actionLock = false157 })158 }159 }160 break161 } else window.alert('Error: IMEI editor is implemented for Nokia and MTK handsets only')162 break163 case '6': //Edit IMEI2164 if(enableNokiaActions) {165 if(enableSim2Actions) {166 if(window.confirm('Are you sure you really want to change IMEI2?')) {167 var newIMEI = window.prompt('New IMEI2', Wallace.generateRandomIMEI())168 if(newIMEI) {169 actionLock = true170 Wallace.setNokiaIMEI(2, newIMEI, function() {171 if(window.confirm('IMEI2 changed to ' + newIMEI + '. Reboot to apply?'))172 Wallace.reboot()173 actionLock = false174 }, function(e) {175 window.alert('Error: invalid IMEI')176 actionLock = false177 })178 }179 }180 break181 } else window.alert('Error: trying to change IMEI2 on a single-SIM configuration')182 } else if(enableMtkActions) {183 if(enableSim2Actions) {184 if(window.confirm('Are you sure you really want to change IMEI2?')) {185 var newIMEI = window.prompt('New IMEI2', Wallace.generateRandomIMEI())186 if(newIMEI) {187 actionLock = true188 Wallace.setMtkIMEI(2, newIMEI, function() {189 if(window.confirm('IMEI2 changed to ' + newIMEI + '. Reboot to apply?'))190 Wallace.reboot()191 actionLock = false192 }, function(e) {193 window.alert('Error: invalid IMEI')194 actionLock = false195 })196 }197 }198 break199 } else window.alert('Error: trying to change IMEI2 on a single-SIM configuration')200 } else window.alert('Error: IMEI editor is implemented for Nokia and MTK handsets only')201 break202 case '7': //Proxy on/off203 Wallace.getSystemSetting('browser.proxy.enabled', function(res) {204 var newVal = !(res === true)205 Wallace.setSystemSetting('browser.proxy.enabled', newVal, function() {206 window.alert('Proxy ' + (newVal ? 'enabled' : 'disabled') + ' successfully')207 }, function(e) {208 window.alert('Error ' + (newVal ? 'enabling' : 'disabling') + ' proxy: ' + e)209 })210 }, function(e) {211 window.alert('Error: ' + e)212 })213 break214 case '8': //Set proxy host/port215 actionLock = true216 Wallace.getSystemSetting('browser.proxy.host', function(oldHost) {217 Wallace.getSystemSetting('browser.proxy.port', function(oldPort) {218 var newHost = window.prompt('Proxy host', oldHost || '')219 var newPort = Number(window.prompt('Proxy port', oldPort || ''))220 if(newHost && newPort) {221 Wallace.setSystemSetting('browser.proxy.host', newHost, function() {222 Wallace.setSystemSetting('browser.proxy.port', newPort, function() {223 window.alert('Proxy set successfully')224 actionLock = false225 }, function(e) {226 window.alert('Error setting proxy port: ' + e)227 actionLock = false228 })229 }, function(e) {230 window.alert('Error setting proxy host: ' + e)231 actionLock = false232 })233 }234 else {235 window.alert('Error: Cannot set empty values for host or port')236 actionLock = false237 }238 }, function(e) {239 window.alert('Error: ' + e)240 actionLock = false241 })242 }, function(e) {243 window.alert('Error: ' + e)244 actionLock = false245 })246 break247 case '9': //override the user agent248 if(window.confirm('Do you want to change the user agent? You will not be able to revert it without WebIDE or factory reset!')) {249 actionLock = true250 var newUA = window.prompt('User agent', navigator.userAgent)251 if(newUA === '') newUA = navigator.userAgent252 Wallace.setUserAgent(newUA)253 actionLock = false254 }255 break256 case '*': //run overclock script257 if(enableQualcommActions) {258 actionLock = true259 Wallace.runCmd(overclockScript, function() {260 window.alert('Overclocking until reboot')261 actionLock = false262 }, function(e) {263 window.alert('Error: ' + e)264 actionLock = false265 })266 }267 else alert('Error: Overclocking is enabled for Qualcomm devices only')268 break269 case '0': //toggle diag port270 if(enableQualcommActions) {271 Wallace.toggleDiagPort(function() {272 window.alert('Diagnostics port enabled')273 }, function() {274 window.alert('Diagnostics port disabled')275 }, function(e) {276 window.alert('Error toggling diag port: ' + e)277 })278 }279 else window.alert('Error: DIAG port can be used on Qualcomm platform only')280 break281 case '#': //developer menu282 if(window.confirm('Enable developer menu and reboot?'))283 Wallace.runCmd('echo -n root > /cache/__post_reset_cmd__;cp /cache/__post_reset_cmd__ /persist/__post_reset_cmd__', function() {284 Wallace.reboot()285 }, function(e) {286 window.alert('Error: ' + e)287 })288 break289 case 'Call': //set Wi-Fi MAC address290 if(enableNokiaActions) {291 var newMAC = window.prompt('New Wi-Fi MAC', Wallace.generateRandomMAC())292 if(newMAC) {293 actionLock = true294 Wallace.setNokiaWlanMAC(newMAC, function() {295 if(window.confirm('MAC changed to ' + newMAC + '. Reboot to apply?'))296 Wallace.reboot()297 actionLock = false298 }, function(e) {299 window.alert('Error: invalid MAC')300 actionLock = false301 })302 }303 }304 else if(enableMtkActions) {305 var newMAC = window.prompt('New Wi-Fi MAC', Wallace.generateRandomMAC())306 if(newMAC) {307 actionLock = true308 Wallace.setMtkWlanMAC(newMAC, function() {309 window.alert('MAC changed to ' + newMAC + '. Toggle Wi-Fi off and on to apply until reboot')310 actionLock = false311 }, function(e) {312 window.alert('Error: invalid MAC')313 actionLock = false314 })315 }316 }317 else window.alert('Error: Wi-Fi MAC changer is currently available on Nokia and MTK handsets only')318 break 319 case 'SoftLeft': //set Bluetooth MAC address320 if(enableNokiaActions) {321 var newMAC = window.prompt('New Bluetooth MAC', Wallace.generateRandomMAC())322 if(newMAC) {323 actionLock = true324 Wallace.setNokiaBluetoothMAC(newMAC, function() {325 if(window.confirm('MAC changed to ' + newMAC + '. Reboot to apply?'))326 Wallace.reboot()327 actionLock = false328 }, function(e) {329 window.alert('Error: invalid MAC')330 actionLock = false331 })332 }333 }334 else window.alert('Error: Bluetooth MAC changer is currently available on Nokia handsets only')335 break 336 case 'SoftRight':337 if(window.confirm('Do you really want to make all pre-installed apps removable from the menu (requires Busybox) and reboot?')) {338 Wallace.runCmd('busybox sed -i \'s#"removable": false#"removable": true#g\' /data/local/webapps/webapps.json', function() {339 Wallace.reboot()340 }, function(e) {341 window.alert('Error: ' + e)342 })343 } 344 break345 default:346 break347 }348 }349 })...

Full Screen

Full Screen

ParcelCard.js

Source:ParcelCard.js Github

copy

Full Screen

...78 </div>79 </div>80 ));81 }82 pickPackage(pkg) {83 let object = this;84 clearCardSwipeLogs().then(function (success) {85 object.setState({86 modal: !object.state.modal87 });88 }).catch(function (error) {89 console.error("Oops! Something went wrong: " + error.message + " (" + error.code + ")");90 });91 this.props.pickPackage(pkg);92 }93 viewParcel() {94 let pickupDate;95 return this.props.packages.map((parcel) => {96 const parcelStatus = (parcel.pickupDate)97 ? (<div><i>Picked by {parcel.pickedBy.name} <Moment fromNow>{parcel.pickupDate.iso}</Moment> </i></div>)98 : (<button className="btn btn-primary" onClick={() => this.pickPackage(parcel)}><strong>Pick </strong></button>);99 return (100 <tr key={parcel.objectId} className={(parcel.pickupDate) ? "text-muted" : ""}>101 <td className="text-center">102 <div className="avatar custom-avatar">103 <span className="icon-user"></span>104 </div>105 </td>106 <td>107 <div>{parcel.owner.name}</div>108 </td>109 <td className="text-center">110 <img src={parcel.vendor.icon} alt={parcel.vendor.name} className="vendor-icon" />111 </td>112 <td className="text-center">...

Full Screen

Full Screen

Initial.js

Source:Initial.js Github

copy

Full Screen

1// import React, { Component,useEffect, useState } from 'react'2// import { AppLoading } from 'expo-app-loading'3// import { Asset } from 'expo-asset'4// import * as Font from 'expo-font'5// import * as Icon from '@expo/vector-icons'6// import Firebase from '../firebase/firebase'7// import { withFirebaseHOC } from '../firebase/index'8// import { ActivityIndicator } from 'react-native'9// // const Initial=({ navigation})=>{10// // const [Loading, setLoading] = useState(true)11// // useEffect(() => {12// // try {13// // loadLocalAsync()14// // Firebase.checkUserAuth(user => {15// // if (user) {16// // // if the user has previously logged in17// // navigation.navigate("MainStackScreen")18// // } else {19// // // if the user has previously signed out from the app20// // navigation.navigate('RootStackScreen')21// // }22// // })23// // } catch (error) {24// // console.log(error)25// // }26// // return () => {27// // loadLocalAsync()28// // }29// // }, [])30// // const loadLocalAsync = async () => {31// // Loading &&32// // <ActivityIndicator style={{ justifyContent: 'center', alignItems: "center", flex: 1 }} />33// // return await Promise.all([34// // Asset.loadAsync([35// // require('../Assets/res/Images/background.png'),36// // require('../Assets/res/Images/MainBackground.jpg'),37// // require('../Assets/res/Images/pickpackage.png'),38// // require('../Assets/res/Images/sendpackage.png'),39// // ]),40// // Font.loadAsync({41// // ...Icon.Ionicons.font,42// // ...Icon.AntDesign.font,43// // ...Icon.MaterialIcons.font,44// // ...Icon.FontAwesome5.font,45// // ...Icon.FontAwesome.font46// // })47// // ])48// // }49 50// // handleLoadingError = error => {51// // // In this case, you might want to report the error to your error52// // // reporting service, for example Sentry53// // console.warn(error)54// // }55// // handleFinishLoading = () => {56// // setLoading(false);57// // }58// // return (59// // <AppLoading60// // startAsync={loadLocalAsync}61// // onFinish={handleFinishLoading}62// // onError={handleLoadingError}63// // />64// // );65// // }66// // export default Initial67// export default class Initial extends Component {68// state = {69// isAssetsLoadingComplete: false70// }71// componentDidMount = async () => {72// try {73// // previously74// this.loadLocalAsync()75// await this.props.firebase.checkUserAuth(user => {76// if (user) {77// // if the user has previously logged in78// this.props.navigation.navigate('MainStackScreen')79// } else {80// // if the user has previously signed out from the app81 82// this.props.navigation.navigate('RootStackScreen')83// }84// })85// } catch (error) {86// console.log(error)87// }88// }89// loadLocalAsync = async () => {90// <ActivityIndicator />91// return await Promise.all([92// Asset.loadAsync([93// require('../Assets/res/Images/background.png'),94// require('../Assets/res/Images/MainBackground.jpg'),95// require('../Assets/res/Images/pickpackage.png'),96// require('../Assets/res/Images/sendpackage.png'),97// ]),98// Font.loadAsync({99// ...Icon.Ionicons.font,100// ...Icon.AntDesign.font,101// ...Icon.MaterialIcons.font,102// ...Icon.FontAwesome5.font,103// ...Icon.FontAwesome.font104// })105// ])106// }107// handleLoadingError = error => {108// // In this case, you might want to report the error to your error109// // reporting service, for example Sentry110// console.warn(error)111// }112// handleFinishLoading = () => {113// this.setState({ isAssetsLoadingComplete: true })114// }115// render() {116// return (117// <AppLoading118// startAsync={this.loadLocalAsync}119// onFinish={this.handleFinishLoading}120// onError={this.handleLoadingError}121// />122// )123// }...

Full Screen

Full Screen

init.mjs

Source:init.mjs Github

copy

Full Screen

...50}51const collectPackages = async () => {52 let isDone = false;53 while (!isDone) {54 let choice = await pickPackage();55 if (!choice) {56 isDone = true;57 return;58 }59 collectPackage(choice);60 }61}62const collectPackage = (packageName) => {63 if (collectedPackages.indexOf(packageName) > -1) {64 return;65 }66 collectedPackages.push(packageName);67 const needsFirebaseCore = packageName.startsWith('firebase_');68 if (!needsFirebaseCore) return;...

Full Screen

Full Screen

pickPackage.js

Source:pickPackage.js Github

copy

Full Screen

1const algoliasearch = require('algoliasearch');2const pickVersion = require('./pickVersion').pickVersion;3const InputFlowAction = require('../multiStepInput').InputFlowAction;4const vscode = require('vscode');5const appId = 'OFCNCOG2CU';6const apiKey = 'f54e21fa3a2a0160595bb058179bfb1e';7const indexName = 'npm-search';8async function pickPackage (input, state) {9 let client = algoliasearch(appId, apiKey);10 let index = client.initIndex(indexName);11 let response;12 try {13 response = await index.search('');14 } catch (e) {15 vscode.window.showErrorMessage('Unexpected error occurred');16 return InputFlowAction.cancel;17 }18 const pick = await input.showQuickPick({19 title: 'Pick package',20 step: 1,21 totalSteps: 4,22 placeholder: 'Pick package',23 items: response.hits.map((hit) => {24 return { label: hit.name };25 }),26 onChangeValue: async (value, input) => {27 input.items = [];28 try {29 response = await index.search(value);30 } catch (e) {31 vscode.window.showErrorMessage('Unexpected error occurred');32 return;33 }34 if (value === input.value) {35 input.items = response.hits.map((hit) => {36 return { label: hit.name };37 });38 }39 },40 });41 let findPkg = function (pkg) {42 return pkg.name === pick.label;43 };44 state.pkg = response.hits.find(findPkg);45 return input => pickVersion(input, state);46}...

Full Screen

Full Screen

extension.js

Source:extension.js Github

copy

Full Screen

...3const pickPackage = require('./steps/pickPackage').pickPackage;4function activate (context) {5 async function collectInputs () {6 const state = {};7 await MultiStepInput.run(input => pickPackage(input, state));8 return state;9 }10 let disposable = vscode.commands.registerCommand('jsDelivr.addPkg', () => {11 if (vscode.window.activeTextEditor === undefined) {12 vscode.window.showErrorMessage('JsDelivr plugin requires a text editor to be open.');13 return;14 }15 collectInputs();16 });17 context.subscriptions.push(disposable);18}19exports.activate = activate;20function deactivate () {}21module.exports = {...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1const pickPackage = require("../../_helpers/pick-package");2module.exports = {3 prompt(prompt) {4 return pickPackage(prompt);5 },...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: `google.png` });7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('playwright/lib/utils/registry');2const { downloadBrowserWithProgressBar } = require('playwright/lib/utils/browserPaths');3const { installBrowsersWithProgressBar } = require('playwright/lib/utils/installBrowsers');4const { registryURL } = require('playwright/lib/utils/registry');5const { registryFile } = require('playwright/lib/utils/registry');6const { registryDirectory } = require('playwright/lib/utils/registry');7const { registryDirectory } = require('playwright/lib/utils/registry');8const { registryDirectory } = require('playwright/lib/utils/registry');9const { registryDirectory } = require('playwright/lib/utils/registry');10const { registryDirectory } = require('playwright/lib/utils/registry');11const { registryDirectory } = require('playwright/lib/utils/registry');12const { registryDirectory } = require('playwright/lib/utils/registry');13const { registryDirectory } = require('playwright/lib/utils/registry');14const { registryDirectory } = require('playwright/lib/utils/registry');15const { registryDirectory } = require('playwright/lib/utils/registry');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('@playwright/test');2const { chromium } = pickPackage('chromium');3const { webkit } = pickPackage('webkit');4const { firefox } = pickPackage('firefox');5(async () => {6 const browser = await chromium.launch();7 const page = await browser.newPage();8 await browser.close();9})();

Full Screen

Using AI Code Generation

copy

Full Screen

1packageName');2const { chromium } = requie(pickPackag('chromium', 'playwriht-chromum'));3con { firefox } = requie(pickPackage('firefox', 'plawright-firefox)4const { webkit } = require(pickPackage('webkit', 'playwright-webkit'));5(async () => {6 ponst browser = await cickPack.launch();7a const context = await browser.newContext();8 const page = await context.newPage();9 await page.screenshot({ path: `example.png` g);10 await browser.close();11})();12### `pickPackage(packageName: string, browsers: string[])`13[MIT](./LICENSE)

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } }require(' laywr=ght/lib/utils/registry');2 onst { chromium } = picrequire('@playwright/test');3const { chromium } = pickPackage('chromium');4const { webkit } = pickPackage('webkit');5const { firefox } = pickPackage('firefox');6(async () => {7 const browser = await chromium.launch();8 const page = await browser.newPage();9 await browser.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('playwright/lib/utils/registry');2const { chromium } = pickPackage('chromium', '1.13.0');3const { firefox } = pickPackage('firefox', '1.13.0');4const { webkit } = pickPackage('webkit', '1.13.0');5const { devices } = require('playwright/lib/server/deviceDescriptors');6const { devices: devices1 } = require('playwright/lib/server/deviceDescriptors');7const { devices: devices2 } = require('playwright/lib/server/deviceDescriptors');8const { devices: devices3 } = require('playwright/lib/server/deviceDescriptors');9const { devices: devices4 } = require('playwright/lib/server/deviceDescriptors');10const { devices: devices5 } = require('playwright/lib/server/deviceDescriptors');11const { devices: devices6 } = require('playwright/lib/server/deviceDescriptors');12const { devices: devices25 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('playwright/lib/utils/utils');2console.log(pickPackage([3 { name: 'chromium', revision: '1734 6' },4 { name: 'firefox', revision: '123456' },5 { name: 'webkit', revision: '123456' },6]));7#### **`getBrowserMajorVersion()`**8const { getBrowserMajorVersion } = require('playwright/lib/utils/utils');9console.log(getBrowserMajorVersion('Chromium 88.0.4324.0'));10#### **`getViewportSizeFromEnv()`**11const { getViewportSizeFromEnv } = require('playwright/lib/utils/utils');12console.log(getViewportSizeFromEnv());13#### **`getTimeoutSettings()`**14const { getTimeoutSettings } = require('playwright/lib/utils/utils');15console.log(getTimeoutSettings());16#### **`getFromENV(name)`**17const { getFromENV } = require('playwright/lib/utils/utils');18console.log(getFromENV('PLAYWRIGHT_TIMEOUT'));19#### **`isUnderTest()`**20const { isUnderTest } = require('playwright/lib/utils/utils');21console.log(isUnderTest());22#### **`isDebugMode()`**23const { isDebugMode } = require('playwright/lib/utils/utils');24console.log(isDebugMode());25#### **`isTraceEnabled()`**26const { isTraceEnabled } = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('playwright/lib/utils/registry');2const { chromium } = pickPackage('chromium');3console.log(chromium.executablePath());4const { pickPackage } = require('playwright/lib/utils/registry');5const { chromium } = pickPackage('chromium');6console.log(chromium.executablePath());7const { pickPackage } = require('playwright/lib/utils/registry');8const { chromium } = pickPackage('chromium');9console.log(chromium.executablePath());10const { pickPackage } = require('playwright/lib/utils/registry');11const { chromium } = pickPackage('chromium');12console.log(chromium.executablePath());13const { pickPackage } = require('playwright/lib/utils/registry');14const { chromium } = pickPackage('chromium');15console.log(chromium.executablePath());16const { pickPackage } = require('playwright/lib/utils/registry');17const { chromium } = pickPackage('chromium');18console.log(chromium.executablePath());19const { pickPackage } = require('playwright/lib/utils/registry');20const { chromium } = pickPackage('chromium');21console.log(chromium.executablePath());22const { pickPackage } = require('playwright/lib/utils/registry');23const { chromium } = pickPackage('chromium');24console.log(chromium.executablePath());25const { devices: devices8 } = require('playwright/lib/server/deviceDescriptors');26const { devices: devices9 } = require('playwright/lib/server/deviceDescriptors');27const { devices: devices10 } = require('playwright/lib/server/deviceDescriptors');28const { devices: devices11 } = require('playwright/lib/server/deviceDescriptors');29const { devices: devices12 } = require('playwright/lib/server/deviceDescriptors');30const { devices: devices13 } = require('playwright/lib/server/deviceDescriptors');31const { devices: devices14 } = require('playwright/lib/server/deviceDescriptors');32const { devices: devices15 } = require('playwright/lib/server/deviceDescriptors');33const { devices: devices16 } = require('playwright/lib/server/deviceDescriptors');34const { devices: devices17 } = require('playwright/lib/server/deviceDescriptors');35const { devices: devices18 } = require('playwright/lib/server/deviceDescriptors');36const { devices: devices19 } = require('playwright/lib/server/deviceDescriptors');37const { devices: devices20 } = require('playwright/lib/server/deviceDescriptors');38const { devices: devices21 } = require('playwright/lib/server/deviceDescriptors');39const { devices: devices22 } = require('playwright/lib/server/deviceDescriptors');40const { devices: devices23 } = require('playwright/lib/server/deviceDescriptors');41const { devices: devices24 } = require('playwright/lib/server/deviceDescriptors');42const { devices: devices25 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('playwright/lib/utils/registry');2const { chromium } = pickPackage('chromium');3console.log(chromium.executablePath());4const { pickPackage } = require('playwright/lib/utils/registry');5const { chromium } = pickPackage('chromium');6console.log(chromium.executablePath());7const { pickPackage } = require('playwright/lib/utils/registry');8const { chromium } = pickPackage('chromium');9console.log(chromium.executablePath());10const { pickPackage } = require('playwright/lib/utils/registry');11const { chromium } = pickPackage('chromium');12console.log(chromium.executablePath());13const { pickPackage } = require('playwright/lib/utils/registry');14const { chromium } = pickPackage('chromium');15console.log(chromium.executablePath());16const { pickPackage } = require('playwright/lib/utils/registry');17const { chromium } = pickPackage('chromium');18console.log(chromium.executablePath());19const { pickPackage } = require('playwright/lib/utils/registry');20const { chromium } = pickPackage('chromium');21console.log(chromium.executablePath());22const { pickPackage } = require('playwright/lib/utils/registry');23const { chromium } = pickPackage('chromium');24console.log(chromium.executablePath());

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('playwright/lib/utils/registry');2const { chromium } = pickPackage('chromium', '1.13.0');3const { firefox } = pickPackage('firefox', '1.13.0');4const { webkit } = pickPackage('webkit', '1.13.0');5const { devices } = require('playwright/lib/server/deviceDescriptors');6const { devices: devices1 } = require('playwright/lib/server/deviceDescriptors');7const { devices: devices2 } = require('playwright/lib/server/deviceDescriptors');8const { devices: devices3 } = require('playwright/lib/server/deviceDescriptors');9const { devices: devices4 } = require('playwright/lib/server/deviceDescriptors');10const { devices: devices5 } = require('playwright/lib/server/deviceDescriptors');11const { devices: devices6 } = require('playwright/lib/server/deviceDescriptors');12const { devices: devices7 } = require('playwright/lib/server/deviceDescriptors');13const { devices: devices8 } = require('playwright/lib/server/deviceDescriptors');14const { devices: devices9 } = require('playwright/lib/server/deviceDescriptors');15const { devices: dev)

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('@playwright/test/lib/utils/packageName'i;2console.log('pickPackage', pickPackage);3const { pickPackage } = require('@playwright/test/lib/utils/packageName');4console.log('pickPackage', pickPackage);5```ces10 } = require('playwright/lib/server/deviceDescriptors');6const { devices: devices11 } = require('playwright/lib/server/deviceDescriptors');7const { devices: devices12 } = require('playwright/lib/server/deviceDescriptors');8const { devices: devices13 } = require('playwright/lib/server/deviceDescriptors');9const { devices: devices14 } = require('playwright/lib/server/deviceDescriptors');10const { devices: devices15 } = require('playwright/lib/server/deviceDescriptors');11const { devices: devices16 } = require('playwright/lib/server/deviceDescriptors');12const { devices: devices17 } = require('playwright/lib/server/deviceDescriptors');13const { devices: devices18 } = require('playwright/lib/server/deviceDescriptors');14const { devices: devices19 } = require('playwright/lib/server/deviceDescriptors');15const { devices: devices20 } = require('playwright/lib/server/deviceDescriptors');16const { devices: devices21 } = require('playwright/lib/server/deviceDescriptors');17const { devices: devices22 } = require('playwright/lib/server/deviceDescriptors');18const { devices: devices23 } = require('playwright/lib/server/deviceDescriptors');19const { devices: devices24 } = require('playwright/lib/server/deviceDescriptors');20const { devices: devices25 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pickPackage } = require('playwright/lib/utils/utils');2const { chromium } = pickPackage(['chromium']);3(async () => {4 const browser = await chromium.launch();5})();6[Apache 2.0](LICENSE)

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal 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