How to use driver.installApp method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

index.js

Source:index.js Github

copy

Full Screen

...82 pathname = buildPath;83 }84 driver.uploadFileToRepository('media', 'PUBLIC:binaries', tar, pathname, function (err, result) {85 if (err) complete.call(self, new Error("Could not upload binary " + target), result);86 driver.installApp('PUBLIC:binaries/' + tar, function (err, result) {87 if (err) {88 soda.console.error("Could not install application " + tar);89 }90 else {91 soda.console.debug("Installed Successfully from repository");92 }93 if(complete) complete.call(self, result);94 });95 });96 }97 /**98 * Calls upload with overwrite but no install99 * @param {string} target The name of the target application100 * @param {string} buildPath The path to the application101 * @param {function=} complete A callback for completion102 */103 function uploadAppOnly(target, buildPath, complete) {104 var tar, pathname;105 if (soda.config.get("platform").toLowerCase() === "android" || soda.config.get("platform").toLowerCase() === "androidtab") {106 tar = target + '.apk';107 pathname = buildPath;108 }109 else {110 tar = target + '.ipa';111 pathname = buildPath;112 }113 driver.deleteRepositoryItem('media', 'PUBLIC:binaries', tar, function (err, result) {114 if (err) soda.console.error(err, result);115 setTimeout(function() {116 driver.uploadFileToRepository('media', 'PUBLIC:binaries', tar, pathname, function (err, result) {117 if (err) complete.call(self, new Error("Could not upload binary " + target), result);118 driver.installApp('PUBLIC:binaries/' + tar, function (err, result) {119 if (err) {120 soda.console.error("Could not install application " + tar);121 }122 else {123 soda.console.debug("Installed Successfully from repository");124 }125 if(complete) complete.call(self, result);126 });127 });128 }, 10000);129 });130 }131 /**132 * Calls install application133 * @param {string} target The name of the target application134 * @param {string} buildPath The path to the application135 * @param {function=} complete A callback for completion136 */137 function installAppOnly(target, buildPath, complete) {138 var tar;139 if (soda.config.get("platform").toLowerCase() === "android" || soda.config.get("platform").toLowerCase() === "androidtab") {140 tar = target + '.apk';141 }142 else {143 tar = target + '.ipa';144 }145 driver.beginExecutionBlock(function(err, result) {146 if (err) complete.call(self, new Error("Could not start execution block."), result);147 driver.openHandSet(function(err, result) {148 if (err) complete.call(self, new Error("Could not open device."), result);149 driver.installApp('PUBLIC:binaries/' + tar, function (err, result) {150 if (err) {151 soda.console.error("Could not install application " + tar);152 }153 else {154 soda.console.debug("Installed Successfully from repository");155 }156 if(complete) complete.call(self, result);157 });158 });159 });160 }161 /**162 * Launches an applciation on a device163 * @param {string} application The name of the applciation to launch164 * @param {array} devices The list of devices165 * @param {string} app The name of the app on screen166 * @param {string} target The name of the target application167 * @param {string} buildPath The path to the application168 * @param {function=} complete A callback for completion169 */170 function launchDevice(application, devices, app, target, buildPath, complete) {171 driver.listItems(settings.PERFECTO_IMAGE_AREA, settings.PERFECTO_IMAGE_REPOSITORY, function (err, items) {172 if (err) complete.call(self, new Error("Could not list items."), false);173 soda.console.debug("List Repository Successfull");174 var startDevice = function(complete) {175 driver.beginExecutionBlock(function(err, result) {176 if (err) complete.call(self, new Error("Could not start execution block."), result);177 driver.openHandSet(function(err, result) {178 if (err) complete.call(self, new Error("Could not open device."), result);179 driver.home({}, function(err, result) {180 setTimeout(function() {181 if (soda.config.get("platform").toLowerCase() === "android" || soda.config.get("platform").toLowerCase() === "androidtab") {182 driver.hideKeyboard(function(err, result) {183 if (err) complete.call(self, new Error("Could not hide keyboard."), result);184 self.launch(devices[application], app, function (err, result, instance) {185 if (!result) {186 uploadAppOnly(target, buildPath, function (err, result) {187 self.launch(devices[application], app, complete);188 });189 }190 else {191 if(complete) complete.call(self, err, result);192 }193 });194 });195 }196 else {197 self.launch(devices[application], app, function (err, result, instance) {198 if (!result) {199 uploadAppOnly(target, buildPath, function (err, result) {200 self.launch(devices[application], app, complete);201 });202 }203 else {204 if(complete) complete.call(self, err, result);205 }206 });207 }208 });209 });210 });211 });212 };213 if (items.length > 0) {214 for (var i = 1; i < items.length; i++) {215 var item = items[i];216 driver.deleteScreenShot(item, function(err, result) {217 });218 }219 startDevice(complete);220 }221 else {222 startDevice(complete);223 }224 });225 }226 /**227 * Launches an applciation by uninstalling then installing on a device228 * @param {string} application The name of the applciation to launch229 * @param {array} devices The list of devices230 * @param {string} app The name of the app on screen231 * @param {string} target The name of the target application232 * @param {string} buildPath The path to the application233 * @param {string} modifiedTarget This is here to support other implementations, not used234 * @param {function=} complete A callback for completion235 */236 function launchDeviceWithCleanApp(application, devices, app, target, buildPath, modifiedTarget, complete) {237 driver.listItems(settings.PERFECTO_IMAGE_AREA, settings.PERFECTO_IMAGE_REPOSITORY, function (err, items) {238 if (err) complete.call(self, new Error("Could not list items."), false);239 soda.console.debug("List Repository Successfull");240 var startDeviceWithClean = function(complete) {241 driver.beginExecutionBlock(function(err, result) {242 if (err) complete.call(self, new Error("Could not start execution block."), result);243 driver.openHandSet(function(err, result) {244 if (err) complete.call(self, new Error("Could not open device."), result);245 driver.home({}, function(err, result) {246 setTimeout(function() {247 if (soda.config.get("platform").toLowerCase() === "android" || soda.config.get("platform").toLowerCase() === "androidtab") {248 driver.hideKeyboard(function(err, result) {249 if (err) complete.call(self, new Error("Could not hide keyboard."), result);250 driver.uninstallApp(app, function(err, result) {251 uploadAppOnly(target, buildPath, function (err, result) {252 self.launch(devices[application], app, complete);253 });254 });255 });256 }257 else {258 driver.uninstallApp(app, function(err, result) {259 uploadAppOnly(target, buildPath, function (err, result) {260 self.launch(devices[application], app, complete);261 });262 });263 }264 }, 4000);265 });266 });267 });268 };269 if (items.length > 0) {270 for (var i = 1; i < items.length; i++) {271 var item = items[i];272 driver.deleteScreenShot(item, function(err, result) {273 });274 }275 startDeviceWithClean(complete);276 }277 else {278 startDeviceWithClean(complete);279 }280 });281 }282 /**283 * Launches an applciation by overwriting app on a device284 * @param {string} application The name of the applciation to launch285 * @param {array} devices The list of devices286 * @param {string} app The name of the app on screen287 * @param {string} target The name of the target application288 * @param {string} buildPath The path to the application289 * @param {string} modifiedTarget This is here to support other implementations, not used290 * @param {function=} complete A callback for completion291 */292 function launchDeviceWithUpdateApp(application, devices, app, target, buildPath, modifiedTarget, complete) {293 driver.listItems(settings.PERFECTO_IMAGE_AREA, settings.PERFECTO_IMAGE_REPOSITORY, function (err, items) {294 if (err) complete.call(self, new Error("Could not list items."), false);295 soda.console.debug("List Repository Successfull");296 var startDeviceWithUpdate = function(complete) {297 driver.beginExecutionBlock(function(err, result) {298 if (err) complete.call(self, new Error("Could not start execution block."), result);299 driver.openHandSet(function(err, result) {300 if (err) complete.call(self, new Error("Could not open device."), result);301 driver.home({}, function(err, result) {302 setTimeout(function() {303 if (soda.config.get("platform").toLowerCase() === "android" || soda.config.get("platform").toLowerCase() === "androidtab") {304 driver.hideKeyboard(function(err, result) {305 if (err) complete.call(self, new Error("Could not hide keyboard."), result);306 uploadAppOverwrite(target, buildPath, function (err, result) {307 self.launch(devices[application], app, function (err, result) {308 soda.Tree.findElementsByLabel('Allow', function(err, result) {309 soda.console.debug(result);310 complete.call(self, null, true);311 });312 });313 });314 });315 }316 else {317 uploadAppOverwrite(target, buildPath, function (err, result) {318 self.launch(devices[application], app, function (err, result) {319 soda.Tree.findElementsByLabel('Allow', function(err, result) {320 soda.console.debug(result);321 complete.call(self, null, true);322 });323 });324 });325 }326 }, 4000);327 });328 });329 });330 };331 if (items.length > 0) {332 for (var i = 1; i < items.length; i++) {333 var item = items[i];334 driver.deleteScreenShot(item, function(err, result) {335 });336 }337 startDeviceWithUpdate(complete);338 }339 else {340 startDeviceWithUpdate(complete);341 }342 });343 }344 /**345 * Installs an application on a device by uploading it then installing it then closing the device346 * @param {object} target The name of the application to install347 * @param {string} buildPath The path to the application to install348 * @param {function} complete A callback for completion349 */350 function installApp(target, buildPath, complete) {351 var binaryExtension = '.ipa';352 if (soda.config.get("platform").toLowerCase() === "android" || soda.config.get("platform").toLowerCase() === "androidtab") {353 binaryExtension = '.apk';354 }355 driver.beginExecutionBlock(function(err, result) {356 if (err) complete.call(self, new Error("Could not start execution block."), result);357 driver.uploadFileToRepository('media', 'PUBLIC:binaries', target + binaryExtension, buildPath + '/' + target + binaryExtension, function (err, result) {358 if (err) complete.call(self, new Error("Could not upload binary " + target + binaryExtension), result);359 soda.console.debug('binary uploaded and overwritten successfully');360 driver.openHandSet(function(err, result) {361 if (err) complete.call(self, new Error("Could not open device."), result);362 soda.console.debug('device started successfully');363 driver.installApp('PUBLIC:binaries/' + target + binaryExtension, function (err, result) {364 if (err) {365 soda.console.error("Could not install application " + target + binaryExtension);366 }367 else {368 soda.console.debug("Installed Successfully from repository");369 }370 driver.closeHandSet(function(err, result) {371 if (err) soda.console.error("Could not close device.");372 driver.endExecutionBlock(function(err, result) {373 if (err) complete.call(self, new Error("Could not end execution block."), result);374 if(complete) complete.call(self, result);375 });376 });377 });378 });379 });380 });381 }382 /**383 * Installs an application on a device by uploading it then installing it then leaving the execution context open384 * @param {object} target The name of the application to install385 * @param {string} buildPath The path to the application to install386 * @param {function} complete A callback for completion387 */388 function installAppAndLeaveOpen(target, buildPath, complete) {389 var binaryExtension = '.ipa';390 if (soda.config.get("platform").toLowerCase() === "android" || soda.config.get("platform").toLowerCase() === "androidtab") {391 binaryExtension = '.apk';392 }393 driver.beginExecutionBlock(function(err, result) {394 if (err) complete.call(self, new Error("Could not start execution block."), result);395 driver.uploadFileToRepository('media', 'PUBLIC:binaries', target + binaryExtension, buildPath + '/' + target + binaryExtension, function (err, result) {396 if (err) complete.call(self, new Error("Could not upload binary " + target + binaryExtension), result);397 soda.console.debug('binary uploaded and overwritten successfully');398 driver.openHandSet(function(err, result) {399 if (err) complete.call(self, new Error("Could not open device."), result);400 soda.console.debug('device started successfully');401 driver.installApp('PUBLIC:binaries/' + target + binaryExtension, function (err, result) {402 if (err) {403 soda.console.error("Could not install application " + target + binaryExtension);404 }405 else {406 soda.console.debug("Installed Successfully from repository");407 }408 if(complete) complete.call(self, result);409 });410 });411 });412 });413 }414 /**415 * Builds an XCode Project or WorkSpace and installs it onto target simulator....

Full Screen

Full Screen

Device.test.js

Source:Device.test.js Github

copy

Full Screen

1const _ = require('lodash');2const path = require('path');3const configurationsMock = require('../configurations.mock');4const validScheme = configurationsMock.validOneDeviceAndSession;5const invalidDeviceNoBinary = configurationsMock.invalidDeviceNoBinary;6const invalidDeviceNoDeviceName = configurationsMock.invalidDeviceNoDeviceName;7describe('Device', () => {8 let fs;9 let DeviceDriverBase;10 let SimulatorDriver;11 let Device;12 let argparse;13 let Client;14 let client;15 let driverMock;16 beforeEach(async () => {17 jest.mock('fs');18 jest.mock('../utils/logger');19 fs = require('fs');20 jest.mock('../utils/argparse');21 argparse = require('../utils/argparse');22 jest.mock('./drivers/DeviceDriverBase');23 DeviceDriverBase = require('./drivers/DeviceDriverBase');24 SimulatorDriver = require('./drivers/SimulatorDriver');25 jest.mock('../client/Client');26 Client = require('../client/Client');27 Device = require('./Device');28 });29 beforeEach(async () => {30 fs.existsSync.mockReturnValue(true);31 client = new Client(validScheme.session);32 await client.connect();33 driverMock = new DeviceDriverMock();34 });35 class DeviceDriverMock {36 constructor() {37 this.driver = new DeviceDriverBase(client);38 }39 expectLaunchCalled(device, expectedArgs, languageAndLocale) {40 expect(this.driver.launchApp).toHaveBeenCalledWith(device._deviceId, device._bundleId, expectedArgs, languageAndLocale);41 }42 expectReinstallCalled() {43 expect(this.driver.uninstallApp).toHaveBeenCalled();44 expect(this.driver.installApp).toHaveBeenCalled();45 }46 expectReinstallNotCalled() {47 expect(this.driver.uninstallApp).not.toHaveBeenCalled();48 expect(this.driver.installApp).not.toHaveBeenCalled();49 }50 expectTerminateCalled() {51 expect(this.driver.terminate).toHaveBeenCalled();52 }53 expectTerminateNotCalled() {54 expect(this.driver.terminate).not.toHaveBeenCalled();55 }56 }57 function schemeDevice(scheme, configuration) {58 const device = new Device({59 deviceConfig: scheme.configurations[configuration],60 deviceDriver: driverMock.driver,61 sessionConfig: scheme.session,62 });63 device.deviceDriver.acquireFreeDevice.mockReturnValue('mockDeviceId');64 return device;65 }66 function validDevice() {67 return schemeDevice(validScheme, 'ios.sim.release');68 }69 it('should return the name from the driver', async () => {70 driverMock.driver.name = 'mock-device-name-from-driver';71 const device = validDevice();72 expect(device.name).toEqual('mock-device-name-from-driver');73 });74 describe('prepare()', () => {75 it(`valid scheme, no binary, should throw`, async () => {76 const device = validDevice();77 fs.existsSync.mockReturnValue(false);78 try {79 await device.prepare();80 fail('should throw')81 } catch (ex) {82 expect(ex.message).toMatch(/app binary not found at/)83 }84 });85 it(`valid scheme, no binary, should not throw`, async () => {86 const device = validDevice();87 await device.prepare();88 });89 it(`when reuse is enabled in CLI args should not uninstall and install`, async () => {90 const device = validDevice();91 argparse.getArgValue.mockReturnValue(true);92 await device.prepare();93 expect(driverMock.driver.uninstallApp).not.toHaveBeenCalled();94 expect(driverMock.driver.installApp).not.toHaveBeenCalled();95 });96 it(`when reuse is enabled in params should not uninstall and install`, async () => {97 const device = validDevice();98 await device.prepare({reuse: true});99 expect(driverMock.driver.uninstallApp).not.toHaveBeenCalled();100 expect(driverMock.driver.installApp).not.toHaveBeenCalled();101 });102 });103 describe('re/launchApp()', () => {104 const expectedDriverArgs = {105 "detoxServer": "ws://localhost:8099",106 "detoxSessionId": "test",107 };108 it(`with no args should launch app with defaults`, async () => {109 const expectedArgs = expectedDriverArgs;110 const device = validDevice();111 await device.launchApp();112 driverMock.expectLaunchCalled(device, expectedArgs);113 });114 it(`(relaunch) with no args should use defaults`, async () => {115 const expectedArgs = expectedDriverArgs;116 const device = validDevice();117 await device.relaunchApp();118 driverMock.expectLaunchCalled(device, expectedArgs);119 });120 it(`(relaunch) with no args should terminate the app before launch - backwards compat`, async () => {121 const device = validDevice();122 await device.relaunchApp();123 driverMock.expectTerminateCalled();124 });125 it(`(relaunch) with newInstance=false should not terminate the app before launch`, async () => {126 const device = validDevice();127 await device.relaunchApp({newInstance: false});128 driverMock.expectTerminateNotCalled();129 });130 it(`(relaunch) with newInstance=true should terminate the app before launch`, async () => {131 const device = validDevice();132 await device.relaunchApp({newInstance: true});133 driverMock.expectTerminateCalled();134 });135 it(`(relaunch) with delete=true`, async () => {136 const expectedArgs = expectedDriverArgs;137 const device = validDevice();138 await device.relaunchApp({delete: true});139 driverMock.expectReinstallCalled();140 driverMock.expectLaunchCalled(device, expectedArgs);141 });142 it(`(relaunch) with delete=false when reuse is enabled should not uninstall and install`, async () => {143 const expectedArgs = expectedDriverArgs;144 const device = validDevice();145 argparse.getArgValue.mockReturnValue(true);146 await device.relaunchApp();147 driverMock.expectReinstallNotCalled();148 driverMock.expectLaunchCalled(device, expectedArgs);149 });150 it(`(relaunch) with url should send the url as a param in launchParams`, async () => {151 const expectedArgs = {...expectedDriverArgs, "detoxURLOverride": "scheme://some.url"};152 const device = await validDevice();153 await device.relaunchApp({url: `scheme://some.url`});154 driverMock.expectLaunchCalled(device, expectedArgs);155 });156 it(`(relaunch) with url should send the url as a param in launchParams`, async () => {157 const expectedArgs = {158 ...expectedDriverArgs,159 "detoxURLOverride": "scheme://some.url",160 "detoxSourceAppOverride": "sourceAppBundleId",161 };162 const device = await validDevice();163 await device.relaunchApp({url: `scheme://some.url`, sourceApp: 'sourceAppBundleId'});164 driverMock.expectLaunchCalled(device, expectedArgs);165 });166 it(`(relaunch) with userNofitication should send the userNotification as a param in launchParams`, async () => {167 const expectedArgs = {168 ...expectedDriverArgs,169 "detoxUserNotificationDataURL": "url",170 };171 const device = validDevice();172 device.deviceDriver.createPayloadFile = jest.fn(() => 'url');173 await device.relaunchApp({userNotification: 'json'});174 driverMock.expectLaunchCalled(device, expectedArgs);175 });176 it(`(relaunch) with url and userNofitication should throw`, async () => {177 const device = validDevice();178 try {179 await device.relaunchApp({url: "scheme://some.url", userNotification: 'notif'});180 fail('should fail');181 } catch (ex) {182 expect(ex).toBeDefined();183 }184 });185 it(`(relaunch) with permissions should send trigger setpermissions before app starts`, async () => {186 const device = await validDevice();187 await device.relaunchApp({permissions: {calendar: "YES"}});188 expect(driverMock.driver.setPermissions).toHaveBeenCalledWith(device._deviceId, device._bundleId, {calendar: "YES"});189 });190 it('with languageAndLocale should launch app with a specific language/locale', async () => {191 const expectedArgs = expectedDriverArgs;192 const device = validDevice();193 const languageAndLocale = {194 language: 'es-MX',195 locale: 'es-MX'196 };197 await device.launchApp({languageAndLocale});198 driverMock.expectLaunchCalled(device, expectedArgs, languageAndLocale);199 });200 it(`with disableTouchIndicators should send a boolean switch as a param in launchParams`, async () => {201 const expectedArgs = {...expectedDriverArgs, "detoxDisableTouchIndicators": true};202 const device = await validDevice();203 await device.launchApp({disableTouchIndicators: true});204 driverMock.expectLaunchCalled(device, expectedArgs);205 });206 it(`with custom launchArgs should pass to native as launch args`, async () => {207 const launchArgs = {208 arg1: "1",209 arg2: 2,210 };211 const expectedArgs = {212 "detoxServer": "ws://localhost:8099",213 "detoxSessionId": "test",214 "arg1": "1",215 "arg2": 2,216 };217 const device = validDevice();218 await device.launchApp({launchArgs});219 driverMock.expectLaunchCalled(device, expectedArgs);220 });221 it(`with newInstance=false should check if process is in background and reopen it`, async () => {222 const processId = 1;223 const device = validDevice();224 device.deviceDriver.getBundleIdFromBinary.mockReturnValue('test.bundle');225 device.deviceDriver.launchApp.mockReturnValue(processId);226 await device.prepare({launchApp: true});227 await device.launchApp({newInstance: false});228 expect(driverMock.driver.deliverPayload).not.toHaveBeenCalled();229 });230 it(`with a url should check if process is in background and use openURL() instead of launch args`, async () => {231 const processId = 1;232 const device = validDevice();233 device.deviceDriver.getBundleIdFromBinary.mockReturnValue('test.bundle');234 device.deviceDriver.launchApp.mockReturnValue(processId);235 await device.prepare({launchApp: true});236 await device.launchApp({url: 'url://me'});237 expect(driverMock.driver.deliverPayload).toHaveBeenCalledTimes(1);238 });239 it(`with a url should check if process is in background and if not use launch args`, async () => {240 const launchParams = {url: 'url://me'};241 const processId = 1;242 const newProcessId = 2;243 const device = validDevice();244 device.deviceDriver.getBundleIdFromBinary.mockReturnValue('test.bundle');245 device.deviceDriver.launchApp.mockReturnValueOnce(processId).mockReturnValueOnce(newProcessId);246 await device.prepare();247 await device.launchApp(launchParams);248 expect(driverMock.driver.deliverPayload).not.toHaveBeenCalled();249 });250 it(`with a url should check if process is in background and use openURL() instead of launch args`, async () => {251 const launchParams = {url: 'url://me'};252 const processId = 1;253 const device = validDevice();254 device.deviceDriver.getBundleIdFromBinary.mockReturnValue('test.bundle');255 device.deviceDriver.launchApp.mockReturnValue(processId);256 await device.prepare({launchApp: true});257 await device.launchApp(launchParams);258 expect(driverMock.driver.deliverPayload).toHaveBeenCalledWith({delayPayload: true, url: 'url://me'});259 });260 it(`should keep user params unmodified`, async () => {261 const params = {262 url: 'some.url',263 launchArgs: {264 some: 'userArg',265 }266 };267 const paramsClone = _.cloneDeep(params);268 const device = validDevice();269 await device.launchApp(params);270 expect(params).toEqual(paramsClone);271 });272 it('with userActivity should check if process is in background and if it is use deliverPayload', async () => {273 const launchParams = {userActivity: 'userActivity'};274 const processId = 1;275 const device = validDevice();276 device.deviceDriver.getBundleIdFromBinary.mockReturnValue('test.bundle');277 device.deviceDriver.launchApp.mockReturnValueOnce(processId).mockReturnValueOnce(processId);278 device.deviceDriver.createPayloadFile = () => 'url';279 await device.prepare({launchApp: true});280 await device.launchApp(launchParams);281 expect(driverMock.driver.deliverPayload).toHaveBeenCalledWith({delayPayload: true, detoxUserActivityDataURL: 'url'});282 });283 it('with userNotification should check if process is in background and if it is use deliverPayload', async () => {284 const launchParams = {userNotification: 'notification'};285 const processId = 1;286 const device = validDevice();287 device.deviceDriver.getBundleIdFromBinary.mockReturnValue('test.bundle');288 device.deviceDriver.launchApp.mockReturnValueOnce(processId).mockReturnValueOnce(processId);289 device.deviceDriver.createPayloadFile = () => 'url';290 await device.prepare({launchApp: true});291 await device.launchApp(launchParams);292 expect(driverMock.driver.deliverPayload).toHaveBeenCalledTimes(1);293 });294 it(`with userNotification should check if process is in background and if not use launch args`, async () => {295 const launchParams = {userNotification: 'notification'};296 const processId = 1;297 const newProcessId = 2;298 const device = validDevice();299 device.deviceDriver.getBundleIdFromBinary.mockReturnValue('test.bundle');300 device.deviceDriver.launchApp.mockReturnValueOnce(processId).mockReturnValueOnce(newProcessId);301 await device.prepare();302 await device.launchApp(launchParams);303 expect(driverMock.driver.deliverPayload).not.toHaveBeenCalled();304 });305 it(`with userNotification and url should fail`, async () => {306 const launchParams = {userNotification: 'notification', url: 'url://me'};307 const processId = 1;308 driverMock.driver.getBundleIdFromBinary.mockReturnValue('test.bundle');309 driverMock.driver.launchApp.mockReturnValueOnce(processId).mockReturnValueOnce(processId);310 const device = validDevice();311 await device.prepare();312 try {313 await device.launchApp(launchParams);314 fail('should throw');315 } catch (ex) {316 expect(ex).toBeDefined();317 }318 expect(device.deviceDriver.deliverPayload).not.toHaveBeenCalled();319 });320 });321 describe('installApp()', () => {322 it(`with a custom app path should use custom app path`, async () => {323 const device = validDevice();324 await device.installApp('newAppPath');325 expect(driverMock.driver.installApp).toHaveBeenCalledWith(device._deviceId, 'newAppPath', undefined);326 });327 it(`with a custom test app path should use custom test app path`, async () => {328 const device = validDevice();329 await device.installApp('newAppPath', 'newTestAppPath');330 expect(driverMock.driver.installApp).toHaveBeenCalledWith(device._deviceId, 'newAppPath', 'newTestAppPath');331 });332 it(`with no args should use the default path given in configuration`, async () => {333 const device = validDevice();334 await device.installApp();335 expect(driverMock.driver.installApp).toHaveBeenCalledWith(device._deviceId, device._binaryPath, device._testBinaryPath);336 });337 });338 describe('uninstallApp()', () => {339 it(`with a custom app path should use custom app path`, async () => {340 const device = validDevice();341 await device.uninstallApp('newBundleId');342 expect(driverMock.driver.uninstallApp).toHaveBeenCalledWith(device._deviceId, 'newBundleId');343 });344 it(`with no args should use the default path given in configuration`, async () => {345 const device = validDevice();346 await device.uninstallApp();347 expect(driverMock.driver.uninstallApp).toHaveBeenCalledWith(device._deviceId, device._binaryPath);348 });349 });350 it(`sendToHome() should pass to device driver`, async () => {351 const device = validDevice();352 await device.sendToHome();353 expect(driverMock.driver.sendToHome).toHaveBeenCalledTimes(1);354 });355 it(`setBiometricEnrollment(true) should pass YES to device driver`, async () => {356 const device = validDevice();357 await device.setBiometricEnrollment(true);358 expect(driverMock.driver.setBiometricEnrollment).toHaveBeenCalledWith(device._deviceId, 'YES');359 expect(driverMock.driver.setBiometricEnrollment).toHaveBeenCalledTimes(1);360 });361 it(`setBiometricEnrollment(false) should pass NO to device driver`, async () => {362 const device = validDevice();363 await device.setBiometricEnrollment(false);364 expect(driverMock.driver.setBiometricEnrollment).toHaveBeenCalledWith(device._deviceId, 'NO');365 expect(driverMock.driver.setBiometricEnrollment).toHaveBeenCalledTimes(1);366 });367 it(`matchFace() should pass to device driver`, async () => {368 const device = validDevice();369 await device.matchFace();370 expect(driverMock.driver.matchFace).toHaveBeenCalledTimes(1);371 });372 it(`unmatchFace() should pass to device driver`, async () => {373 const device = validDevice();374 await device.unmatchFace();375 expect(driverMock.driver.unmatchFace).toHaveBeenCalledTimes(1);376 });377 it(`matchFinger() should pass to device driver`, async () => {378 const device = validDevice();379 await device.matchFinger();380 expect(driverMock.driver.matchFinger).toHaveBeenCalledTimes(1);381 });382 it(`unmatchFinger() should pass to device driver`, async () => {383 const device = validDevice();384 await device.unmatchFinger();385 expect(driverMock.driver.unmatchFinger).toHaveBeenCalledTimes(1);386 });387 it(`shake() should pass to device driver`, async () => {388 const device = validDevice();389 await device.shake();390 expect(driverMock.driver.shake).toHaveBeenCalledTimes(1);391 });392 it(`terminateApp() should pass to device driver`, async () => {393 const device = validDevice();394 await device.terminateApp();395 expect(driverMock.driver.terminate).toHaveBeenCalledTimes(1);396 });397 it(`shutdown() should pass to device driver`, async () => {398 const device = validDevice();399 await device.shutdown();400 expect(driverMock.driver.shutdown).toHaveBeenCalledTimes(1);401 });402 it(`openURL({url:url}) should pass to device driver`, async () => {403 const device = validDevice();404 await device.openURL({url: 'url'});405 expect(driverMock.driver.deliverPayload).toHaveBeenCalledWith({url: 'url'});406 });407 it(`openURL(notAnObject) should pass to device driver`, async () => {408 const device = validDevice();409 try {410 await device.openURL('url');411 fail('should throw');412 } catch (ex) {413 expect(ex).toBeDefined();414 }415 });416 it(`reloadReactNative() should pass to device driver`, async () => {417 const device = validDevice();418 await device.reloadReactNative();419 expect(driverMock.driver.reloadReactNative).toHaveBeenCalledTimes(1);420 });421 it(`setOrientation() should pass to device driver`, async () => {422 const device = validDevice();423 await device.setOrientation('param');424 expect(driverMock.driver.setOrientation).toHaveBeenCalledWith(device._deviceId, 'param');425 });426 it(`sendUserNotification() should pass to device driver`, async () => {427 const device = validDevice();428 await device.sendUserNotification('notif');429 expect(driverMock.driver.createPayloadFile).toHaveBeenCalledTimes(1);430 expect(driverMock.driver.deliverPayload).toHaveBeenCalledTimes(1);431 });432 it(`sendUserActivity() should pass to device driver`, async () => {433 const device = validDevice();434 await device.sendUserActivity('notif');435 expect(driverMock.driver.createPayloadFile).toHaveBeenCalledTimes(1);436 expect(driverMock.driver.deliverPayload).toHaveBeenCalledTimes(1);437 });438 it(`setLocation() should pass to device driver`, async () => {439 const device = validDevice();440 await device.setLocation(30.1, 30.2);441 expect(driverMock.driver.setLocation).toHaveBeenCalledWith(device._deviceId, '30.1', '30.2');442 });443 it(`setURLBlacklist() should pass to device driver`, async () => {444 const device = validDevice();445 await device.setURLBlacklist();446 expect(driverMock.driver.setURLBlacklist).toHaveBeenCalledTimes(1);447 });448 it(`enableSynchronization() should pass to device driver`, async () => {449 const device = validDevice();450 await device.enableSynchronization();451 expect(driverMock.driver.enableSynchronization).toHaveBeenCalledTimes(1);452 });453 it(`disableSynchronization() should pass to device driver`, async () => {454 const device = validDevice();455 await device.disableSynchronization();456 expect(driverMock.driver.disableSynchronization).toHaveBeenCalledTimes(1);457 });458 it(`resetContentAndSettings() should pass to device driver`, async () => {459 const device = validDevice();460 await device.resetContentAndSettings();461 expect(driverMock.driver.resetContentAndSettings).toHaveBeenCalledTimes(1);462 });463 it(`getPlatform() should pass to device driver`, async () => {464 const device = validDevice();465 device.getPlatform();466 expect(driverMock.driver.getPlatform).toHaveBeenCalledTimes(1);467 });468 it(`_cleanup() should pass to device driver`, async () => {469 const device = validDevice();470 await device._cleanup();471 expect(driverMock.driver.cleanup).toHaveBeenCalledTimes(1);472 });473 it(`new Device() with invalid device config (no binary) should throw`, () => {474 // TODO: this is an invalid test, because it will pass only on SimulatorDriver475 expect(() => new Device({476 deviceConfig: invalidDeviceNoBinary.configurations['ios.sim.release'],477 deviceDriver: new SimulatorDriver(client),478 sessionConfig: validScheme.session,479 })).toThrowError(/binaryPath.* is missing/);480 });481 it(`should accept absolute path for binary`, async () => {482 const actualPath = await launchAndTestBinaryPath('absolutePath');483 expect(actualPath).toEqual(process.platform === 'win32' ? 'C:\\Temp\\abcdef\\123' : '/tmp/abcdef/123');484 });485 it(`should accept relative path for binary`, async () => {486 const actualPath = await launchAndTestBinaryPath('relativePath');487 expect(actualPath).toEqual(path.join(process.cwd(), 'abcdef/123'));488 });489 it(`pressBack() should invoke driver's pressBack()`, async () => {490 const device = validDevice();491 await device.pressBack();492 expect(driverMock.driver.pressBack).toHaveBeenCalledWith(device._deviceId);493 });494 it(`clearKeychain() should invoke driver's clearKeychain()`, async () => {495 const device = validDevice();496 await device.clearKeychain();497 expect(driverMock.driver.clearKeychain).toHaveBeenCalledWith(device._deviceId);498 });499 describe('get ui device', () => {500 it(`getUiDevice should invoke driver's getUiDevice`, async () => {501 const device = validDevice();502 await device.getUiDevice();503 expect(driverMock.driver.getUiDevice).toHaveBeenCalled();504 });505 it('should call return UiDevice when call getUiDevice', async () => {506 const uiDevice = {507 uidevice: true,508 };509 const device = validDevice();510 driverMock.driver.getUiDevice = () => uiDevice;511 const result = await device.getUiDevice();512 expect(result).toEqual(uiDevice);513 })514 });515 it('takeScreenshot(name) should throw an exception if given name is empty', async () => {516 await expect(validDevice().takeScreenshot()).rejects.toThrowError(/empty name/);517 });518 it('takeScreenshot(name) should delegate the work to the driver', async () => {519 device = validDevice();520 await device.takeScreenshot('name');521 expect(device.deviceDriver.takeScreenshot).toHaveBeenCalledWith('name');522 });523 async function launchAndTestBinaryPath(configuration) {524 const device = schemeDevice(configurationsMock.pathsTests, configuration);525 await device.prepare();526 await device.launchApp();527 return driverMock.driver.installApp.mock.calls[0][1];528 }...

Full Screen

Full Screen

general-specs.js

Source:general-specs.js Github

copy

Full Screen

...188 sandbox.stub(driver.helpers, 'configureApp').withArgs(app, '.apk')189 .returns(app);190 sandbox.stub(fs, 'rimraf').returns();191 sandbox.stub(driver.adb, 'install').returns(true);192 await driver.installApp(app);193 driver.helpers.configureApp.calledOnce.should.be.true;194 fs.rimraf.notCalled.should.be.true;195 driver.adb.install.calledOnce.should.be.true;196 });197 it('should throw an error if APK does not exist', async function () {198 await driver.installApp('non/existent/app.apk').should.be199 .rejectedWith(/does not exist or is not accessible/);200 });201 });202 describe('background', function () {203 it('should bring app to background and back', async function () {204 const appPackage = 'wpkg';205 const appActivity = 'wacv';206 driver.opts = {appPackage, appActivity, intentAction: 'act',207 intentCategory: 'cat', intentFlags: 'flgs',208 optionalIntentArguments: 'opt'};209 sandbox.stub(driver.adb, 'goToHome');210 sandbox.stub(driver.adb, 'getFocusedPackageAndActivity')211 .returns({appPackage, appActivity});212 sandbox.stub(B, 'delay');...

Full Screen

Full Screen

Device.js

Source:Device.js Github

copy

Full Screen

1const _ = require('lodash');2const fs = require('fs');3const path = require('path');4const argparse = require('../utils/argparse');5const debug = require('../utils/debug'); //debug utils, leave here even if unused6class Device {7 constructor({ deviceConfig, deviceDriver, sessionConfig }) {8 this._deviceConfig = deviceConfig;9 this._sessionConfig = sessionConfig;10 this._processes = {};11 this.deviceDriver = deviceDriver;12 this.deviceDriver.validateDeviceConfig(deviceConfig);13 this.debug = debug;14 }15 async prepare(params = {}) {16 this._binaryPath = this._getAbsolutePath(this._deviceConfig.binaryPath);17 this._testBinaryPath = this._deviceConfig.testBinaryPath ? this._getAbsolutePath(this._deviceConfig.testBinaryPath) : null;18 this._deviceId = await this.deviceDriver.acquireFreeDevice(this._deviceConfig.device || this._deviceConfig.name);19 this._bundleId = await this.deviceDriver.getBundleIdFromBinary(this._binaryPath);20 await this.deviceDriver.prepare();21 if (!argparse.getArgValue('reuse') && !params.reuse) {22 await this.deviceDriver.uninstallApp(this._deviceId, this._bundleId);23 await this.deviceDriver.installApp(this._deviceId, this._binaryPath, this._testBinaryPath);24 }25 if (params.launchApp) {26 await this.launchApp({newInstance: true});27 }28 }29 createPayloadFileAndUpdatesParamsObject(key, launchKey, params, baseLaunchArgs) {30 const payloadFilePath = this.deviceDriver.createPayloadFile(params[key]);31 baseLaunchArgs[launchKey] = payloadFilePath;32 //`params` will be used later for `deliverPayload`, so remove the actual notification and add the file URL33 delete params[key];34 params[launchKey] = payloadFilePath;35 }36 async launchApp(params = {newInstance: false}, bundleId) {37 const payloadParams = ['url', 'userNotification', 'userActivity'];38 const hasPayload = this._assertHasSingleParam(payloadParams, params);39 if (params.delete) {40 await this._terminateApp();41 await this._reinstallApp();42 } else if (params.newInstance) {43 await this._terminateApp();44 }45 const baseLaunchArgs = {46 ...params.launchArgs,47 };48 if (params.url) {49 baseLaunchArgs['detoxURLOverride'] = params.url;50 if (params.sourceApp) {51 baseLaunchArgs['detoxSourceAppOverride'] = params.sourceApp;52 }53 } else if (params.userNotification) {54 this.createPayloadFileAndUpdatesParamsObject('userNotification', 'detoxUserNotificationDataURL', params, baseLaunchArgs);55 } else if (params.userActivity) {56 this.createPayloadFileAndUpdatesParamsObject('userActivity', 'detoxUserActivityDataURL', params, baseLaunchArgs);57 }58 if (params.permissions) {59 await this.deviceDriver.setPermissions(this._deviceId, this._bundleId, params.permissions);60 }61 if (params.disableTouchIndicators) {62 baseLaunchArgs['detoxDisableTouchIndicators'] = true;63 }64 const _bundleId = bundleId || this._bundleId;65 if (this._isAppInBackground(params, _bundleId)) {66 if (hasPayload) {67 await this.deviceDriver.deliverPayload({...params, delayPayload: true});68 }69 }70 const processId = await this.deviceDriver.launchApp(this._deviceId, _bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);71 this._processes[_bundleId] = processId;72 await this.deviceDriver.waitUntilReady();73 await this.deviceDriver.waitForActive();74 if(params.detoxUserNotificationDataURL) {75 await this.deviceDriver.cleanupRandomDirectory(params.detoxUserNotificationDataURL);76 }77 if(params.detoxUserActivityDataURL) {78 await this.deviceDriver.cleanupRandomDirectory(params.detoxUserActivityDataURL);79 }80 }81 get name() {82 return this.deviceDriver.name;83 }84 async takeScreenshot(name) {85 if (!name) {86 throw new Error('Cannot take a screenshot with an empty name.');87 }88 return this.deviceDriver.takeScreenshot(name);89 }90 _isAppInBackground(params, _bundleId) {91 return !params.delete && !params.newInstance && this._processes[_bundleId];92 }93 _assertHasSingleParam(singleParams, params) {94 let paramsCounter = 0;95 singleParams.forEach((item) => {96 if(params[item]) {97 paramsCounter += 1;98 }99 });100 if (paramsCounter > 1) {101 throw new Error(`Call to 'launchApp(${JSON.stringify(params)})' must contain only one of ${JSON.stringify(singleParams)}.`);102 }103 return (paramsCounter === 1);104 }105 /**deprecated */106 async relaunchApp(params = {}, bundleId) {107 if (params.newInstance === undefined) {108 params['newInstance'] = true;109 }110 await this.launchApp(params, bundleId);111 }112 async sendToHome() {113 await this.deviceDriver.sendToHome(this._deviceId);114 await this.deviceDriver.waitForBackground();115 }116 async setBiometricEnrollment(toggle) {117 let yesOrNo = toggle ? 'YES' : 'NO'118 await this.deviceDriver.setBiometricEnrollment(this._deviceId, yesOrNo);119 }120 async matchFace() {121 await this.deviceDriver.matchFace(this._deviceId);122 await this.deviceDriver.waitForActive();123 }124 async unmatchFace() {125 await this.deviceDriver.unmatchFace(this._deviceId);126 await this.deviceDriver.waitForActive();127 }128 async matchFinger() {129 await this.deviceDriver.matchFinger(this._deviceId);130 await this.deviceDriver.waitForActive();131 }132 async unmatchFinger() {133 await this.deviceDriver.unmatchFinger(this._deviceId);134 await this.deviceDriver.waitForActive();135 }136 async shake() {137 await this.deviceDriver.shake(this._deviceId);138 }139 async terminateApp(bundleId) {140 const _bundleId = bundleId || this._bundleId;141 await this.deviceDriver.terminate(this._deviceId, _bundleId);142 }143 async installApp(binaryPath, testBinaryPath) {144 const _binaryPath = binaryPath || this._binaryPath;145 const _testBinaryPath = testBinaryPath || this._testBinaryPath;146 await this.deviceDriver.installApp(this._deviceId, _binaryPath, _testBinaryPath);147 }148 async uninstallApp(bundleId) {149 const _bundleId = bundleId || this._bundleId;150 await this.deviceDriver.uninstallApp(this._deviceId, _bundleId);151 }152 async reloadReactNative() {153 await this.deviceDriver.reloadReactNative();154 }155 async openURL(params) {156 if (typeof params !== 'object' || !params.url) {157 throw new Error(`openURL must be called with JSON params, and a value for 'url' key must be provided. example: await device.openURL({url: "url", sourceApp[optional]: "sourceAppBundleID"}`);158 }159 await this.deviceDriver.deliverPayload(params);160 }161 async shutdown() {162 await this.deviceDriver.shutdown(this._deviceId);163 }164 async setOrientation(orientation) {165 await this.deviceDriver.setOrientation(this._deviceId, orientation);166 }167 async setLocation(lat, lon) {168 lat = String(lat);169 lon = String(lon);170 await this.deviceDriver.setLocation(this._deviceId, lat, lon);171 }172 async clearKeychain() {173 await this.deviceDriver.clearKeychain(this._deviceId);174 }175 async _sendPayload(key, params) {176 const payloadFilePath = this.deviceDriver.createPayloadFile(params);177 let payload = {};178 payload[key] = payloadFilePath;179 await this.deviceDriver.deliverPayload(payload);180 this.deviceDriver.cleanupRandomDirectory(payloadFilePath);181 }182 async sendUserActivity(params) {183 await this._sendPayload('detoxUserActivityDataURL', params);184 }185 async sendUserNotification(params) {186 await this._sendPayload('detoxUserNotificationDataURL', params);187 }188 async setURLBlacklist(urlList) {189 await this.deviceDriver.setURLBlacklist(urlList);190 }191 async enableSynchronization() {192 await this.deviceDriver.enableSynchronization();193 }194 async disableSynchronization() {195 await this.deviceDriver.disableSynchronization();196 }197 async resetContentAndSettings() {198 await this.deviceDriver.resetContentAndSettings(this._deviceId);199 }200 getPlatform() {201 return this.deviceDriver.getPlatform(this._deviceId);202 }203 async _cleanup() {204 await this.deviceDriver.cleanup(this._deviceId, this._bundleId);205 }206 async pressBack() {207 await this.deviceDriver.pressBack(this._deviceId);208 }209 getUiDevice() {210 return this.deviceDriver.getUiDevice();211 }212 _defaultLaunchArgs() {213 return {214 'detoxServer': this._sessionConfig.server,215 'detoxSessionId': this._sessionConfig.sessionId216 };217 }218 _prepareLaunchArgs(additionalLaunchArgs) {219 const launchArgs = _.merge(this._defaultLaunchArgs(), additionalLaunchArgs);220 return launchArgs;221 }222 _getAbsolutePath(appPath) {223 if (path.isAbsolute(appPath)) {224 return appPath;225 }226 const absPath = path.join(process.cwd(), appPath);227 if (fs.existsSync(absPath)) {228 return absPath;229 } else {230 throw new Error(`app binary not found at '${absPath}', did you build it?`);231 }232 }233 async _terminateApp() {234 await this.deviceDriver.terminate(this._deviceId, this._bundleId);235 this._processes[this._bundleId] = undefined;236 }237 async _reinstallApp() {238 await this.deviceDriver.uninstallApp(this._deviceId, this._bundleId);239 await this.deviceDriver.installApp(this._deviceId, this._binaryPath, this._testBinaryPath);240 }241}...

Full Screen

Full Screen

js-wdio.js

Source:js-wdio.js Github

copy

Full Screen

...81 codeFor_getCurrentPackage () {82 return `let packageName = await driver.currentPackage();`;83 }84 codeFor_installAppOnDevice (varNameIgnore, varIndexIgnore, app) {85 return `await driver.installApp('${app}');`;86 }87 codeFor_isAppInstalledOnDevice (varNameIgnore, varIndexIgnore, app) {88 return `let isAppInstalled = await driver.isAppInstalled("${app}");`;89 }90 codeFor_launchApp () {91 return `await driver.launch();`;92 }93 codeFor_backgroundApp (varNameIgnore, varIndexIgnore, timeout) {94 return `await driver.background(${timeout});`;95 }96 codeFor_closeApp () {97 return `await driver.close_app();`;98 }99 codeFor_resetApp () {...

Full Screen

Full Screen

xctest-e2e-specs.js

Source:xctest-e2e-specs.js Github

copy

Full Screen

...22 await deleteSession();23 });24 it('should install an XC test bundle and then run it', async function () {25 // Install the test runner app26 await driver.installApp(TEST_BUNDLE_PATH);27 // Install the xctest bundle28 await driver.execute('mobile: installXCTestBundle', {xctestApp: XCTEST_BUNDLE_PATH});29 // Get list of xctest bundles30 const xcTestBundleList = await driver.execute('mobile: listXCTestBundles');31 const bundleTest = 'io.appium.XCTesterAppUITests';32 xcTestBundleList.should.includes(bundleTest);33 // Get list of xctests within bundle34 const xcTestsInBundle = await driver.execute('mobile: listXCTestsInTestBundle', {bundle: bundleTest});35 xcTestsInBundle.should.eql([36 'XCTesterAppUITests.XCTesterAppUITests/testExample',37 'XCTesterAppUITests.XCTesterAppUITests/testLaunchPerformance',38 ]);39 // Now run the tests40 const bundleApp = 'io.appium.XCTesterApp';...

Full Screen

Full Screen

TC_001_Login.js

Source:TC_001_Login.js Github

copy

Full Screen

...5 console.log("Application Test Starts")6 });7// Specify for a test case8 it('Install WebDriverIO Application', function () {9 driver.installApp('D:\\TCSTraining\\AppiumPOM\\apk\\Android-NativeDemoApp-0.4.0.apk');10 console.log("Installation Of App Completed")11 });12 it('Run WebDriverIO App', function () {13 console.log("Launching App");14 driver.activateApp('com.wdiodemoapp');15 });16 it('Login to Appplication',()=>{17 //1. Click on Login Icon on Home Screen18 const LOGIN_ICON_HOME_SCREEN='~Login';19 $(LOGIN_ICON_HOME_SCREEN).click();20 //2. Login to Application21 LoginPage.email_txt_field.setValue(configdata.username);22 LoginPage.password_txt_field.setValue(configdata.password);23 LoginPage.login_btn.click();...

Full Screen

Full Screen

First.js

Source:First.js Github

copy

Full Screen

...9console.log("Hello Ritzz", driver.getCurrentActivity());10//--To get Current Package11driver.getCurrentPackage();12//--To install Application into Device13driver.installApp(c://rit/flipkart.apk)14 //to check whether this app is installed or not package 15 driver.isAppInstalled(appId)16//to Terminate app17driver.terminateApp(appId)18//--To hide keyword 19driver.hideKeyboard()20//--To check keyboard is open or not true/false21driver.isKeyboardShown()22//--To open activity and start application23driver.startActivity(appPackage, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset)24//To get device time25driver.getDeviceTime()2613: 45 >> instagram open 27search >> mark ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const {remote} = require('webdriverio');2(async () => {3 const browser = await remote({4 capabilities: {5 }6 })7 await browser.installApp('/Users/username/Desktop/MyApp.app')8 await browser.closeApp()9 await browser.launchApp()10 await browser.deleteSession()11})().catch(async (e) => {12 console.error(e)13})14[debug] [WD Proxy] Got response with status 200: {"value":{},"sessionId":"1D9E9E7A-4B2B-4C1F-A8C4-C4E4F4D4B4B9","status":0}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3driver.init({4})5 .then(function() {6 return driver.quit();7 })8 .done();9var wd = require('wd');10var assert = require('assert');11driver.init({12})13 .then(function() {14 return driver.quit();15 })16 .done();17var wd = require('wd');18var assert = require('assert');19driver.init({20})21 .then(function() {22 return driver.quit();23 })24 .done();25var wd = require('wd');26var assert = require('assert');27driver.init({28})29 .then(function() {30 return driver.quit();31 })32 .done();

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const assert = require('assert');3const path = require('path');4const {exec} = require('child_process');5const app = path.resolve(__dirname, 'TestApp.app.zip');6const bundleId = 'com.example.apple-samplecode.UICatalog';7const testApp = 'com.example.apple-samplecode.UICatalog';8const testAppVersion = '2.5.0';9const testAppBundleId = 'com.example.apple-samplecode.UICatalog';10async function main() {11 await driver.init({12 });13 const appInfo = await driver.installApp(testApp, testAppVersion, testAppBundleId);14 console.log(appInfo);15 await driver.quit();16}17main();18Appium version (or git revision) that exhibits the issue: 1.18.0-beta.219Last Appium version that did not exhibit the issue (if applicable):20Node.js version (unless using Appium.app|exe): 12.16.2

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