Best JavaScript code snippet using appium-xcuitest-driver
debug-port-handler-tests.js
Source:debug-port-handler-tests.js
1'use strict';2const mockery = require('mockery');3const sinon = require('sinon');4const expect = require('chai').expect;5describe('lib/runner/test-runner/debug-port-handler.js', function() {6 describe('getPort', function() {7 let debugPortHandler;8 let callback;9 let configHandler;10 beforeEach(function() {11 mockery.enable({useCleanCache: true});12 mockery.registerAllowable('../../../../../lib/runner/test-runner/debug-port-handler.js');13 callback = sinon.stub();14 configHandler = {15 get: sinon.stub(),16 };17 mockery.registerMock('portscanner', {});18 mockery.registerMock('../../util/config/config-handler.js', configHandler);19 debugPortHandler = require('../../../../../lib/runner/test-runner/debug-port-handler.js');20 debugPortHandler._findPort = sinon.stub();21 debugPortHandler._startPort = 3000;22 });23 afterEach(function() {24 mockery.resetCache();25 mockery.deregisterAll();26 mockery.disable();27 delete process.env.DEBUG_PORT;28 });29 it('should push the passed in callback to debugPortHandler._portsToGet', function() {30 const callback2 = sinon.stub();31 debugPortHandler._portsToGet = [callback2];32 debugPortHandler.getPort(callback);33 expect(debugPortHandler._portsToGet).to.deep.equal([callback2, callback]);34 });35 describe('if debugPortHandler._startPort is not set', function() {36 it('should call configHandler.get with \'debugPort\'', function() {37 delete debugPortHandler._startPort;38 debugPortHandler.getPort(callback);39 expect(configHandler.get.args).to.deep.equal([['debugPort']]);40 });41 describe('if the config contains debugPort', function() {42 it('should set ._currentPort to the configs debugPort', function() {43 configHandler.get.returns(2121);44 delete debugPortHandler._startPort;45 debugPortHandler.getPort(callback);46 expect(debugPortHandler._currentPort).to.equal(2121);47 });48 it('should set ._startPort to the configs debugPort', function() {49 configHandler.get.returns(2121);50 delete debugPortHandler._startPort;51 debugPortHandler.getPort(callback);52 expect(debugPortHandler._startPort).to.equal(2121);53 });54 });55 describe('if process.env.DEBUG_PORT is NOT an int', function() {56 it('should set ._currentPort to the default of 32489', function() {57 delete debugPortHandler._startPort;58 debugPortHandler.getPort(callback);59 expect(debugPortHandler._currentPort).to.equal(32489);60 });61 it('should set ._startPort to the default of 32489', function() {62 delete debugPortHandler._startPort;63 debugPortHandler.getPort(callback);64 expect(debugPortHandler._startPort).to.equal(32489);65 });66 });67 });68 describe('if debugPortHandler._currentlyGettingPort is false', function() {69 it('should set debugPortHandler._currentlyGettingPort to true', function() {70 debugPortHandler.getPort(callback);71 expect(debugPortHandler._currentlyGettingPort).to.equal(true);72 });73 it('should call debugPortHandler._findPort once with no args', function() {74 debugPortHandler.getPort(callback);75 expect(debugPortHandler._findPort.args).to.deep.equal([[]]);76 });77 });78 describe('if debugPortHandler._currentlyGettingPort is true', function() {79 it('should not call debugPortHanlder._findPort', function() {80 debugPortHandler._currentlyGettingPort = true;81 debugPortHandler.getPort(callback);82 expect(debugPortHandler._findPort.callCount).to.equal(0);83 });84 });85 });86 describe('_findPort', function() {87 let debugPortHandler;88 let portscanner;89 let callback;90 let _findPort;91 beforeEach(function() {92 mockery.enable({useCleanCache: true});93 mockery.registerAllowable('../../../../../lib/runner/test-runner/debug-port-handler.js');94 portscanner = {95 findAPortNotInUse: sinon.stub(),96 };97 callback = sinon.stub();98 global.SimulatoError = {99 RUNNER: {100 CHILD_SPAWN_ERROR: sinon.stub(),101 },102 };103 mockery.registerMock('portscanner', portscanner);104 mockery.registerMock('../../util/config/config-handler.js', {});105 debugPortHandler = require('../../../../../lib/runner/test-runner/debug-port-handler.js');106 debugPortHandler._portsToGet = [callback];107 debugPortHandler._sendPort = sinon.stub();108 debugPortHandler._startPort = 1000;109 debugPortHandler._currentPort = 1000;110 _findPort = debugPortHandler._findPort;111 debugPortHandler._findPort = sinon.stub();112 });113 afterEach(function() {114 mockery.resetCache();115 mockery.deregisterAll();116 mockery.disable();117 delete global.SimulatoError;118 });119 it('should call portscanner.findAPortNotInUse once', function() {120 _findPort();121 expect(portscanner.findAPortNotInUse.callCount).to.equal(1);122 });123 it('should call portscanner.findAPortNotInUse with ' +124 '._currentPort, ._maxPort, and \'127.0.0.1\' as the first 3 params', function() {125 _findPort();126 expect(portscanner.findAPortNotInUse.args[0].slice(0, 3)).to.deep.equal([127 1000,128 65535,129 '127.0.0.1',130 ]);131 });132 it('should call portscanner.findAPortNotInUse with a function as the 4th param', function() {133 _findPort();134 expect(portscanner.findAPortNotInUse.args[0][3]).to.be.a('function');135 });136 describe('when the callback for portscanner.findAPortNotInUse is called', function() {137 describe('if there was an error returned', function() {138 it('should throw simulato CHILD_SPAWN_ERROR', function() {139 const message = `Error was thrown`;140 SimulatoError.RUNNER.CHILD_SPAWN_ERROR.throws(141 {message},142 );143 const err = new Error('im an error being thrown');144 portscanner.findAPortNotInUse.callsArgWith(3, err);145 expect(_findPort.bind(null)).to.throw('Error was thrown');146 });147 });148 describe('if the returned port is 65535', function() {149 it('should set debugPortHandler._currentPort to debugPortHandler._startPort', function() {150 portscanner.findAPortNotInUse.callsArgWith(3, null, 65535);151 debugPortHandler._currentPort = 33333;152 _findPort();153 expect(debugPortHandler._currentPort).to.equal(1000);154 });155 });156 describe('if the returned port is NOT 65535', function() {157 it('should set debugPortHandler._currentPort to the returned port + 1', function() {158 portscanner.findAPortNotInUse.callsArgWith(3, null, 1004);159 debugPortHandler._currentPort = 33333;160 _findPort();161 expect(debugPortHandler._currentPort).to.equal(1005);162 });163 });164 it('shoudl call debugPortHandler._sendPort with the returned port ' +165 'and the callback in debugPortHandler._portsToGet[0]', function() {166 portscanner.findAPortNotInUse.callsArgWith(3, null, 5000);167 _findPort();168 expect(debugPortHandler._sendPort.args).to.deep.equal([[5000, callback]]);169 });170 describe('if debugPortHandler._portsToGet is NOT empty', function() {171 it('shoudl call debugPortHandler._findPort with no args', function() {172 portscanner.findAPortNotInUse.callsArgWith(3, null, 5000);173 debugPortHandler._portsToGet.push(sinon.stub());174 _findPort();175 expect(debugPortHandler._findPort.args).to.deep.equal([[]]);176 });177 });178 describe('if debugPortHandler._portsToGet is empty', function() {179 it('should set debugPortHandler._currentlyGettingPort to false', function() {180 portscanner.findAPortNotInUse.callsArgWith(3, null, 5000);181 _findPort();182 expect(debugPortHandler._currentlyGettingPort).to.equal(false);183 });184 });185 });186 });187 describe('_sendPort', function() {188 let debugPortHandler;189 let callback;190 beforeEach(function() {191 mockery.enable({useCleanCache: true});192 mockery.registerAllowable('../../../../../lib/runner/test-runner/debug-port-handler.js');193 callback = sinon.stub();194 mockery.registerMock('portscanner', {});195 mockery.registerMock('../../util/config/config-handler.js', {});196 debugPortHandler = require('../../../../../lib/runner/test-runner/debug-port-handler.js');197 });198 afterEach(function() {199 mockery.resetCache();200 mockery.deregisterAll();201 mockery.disable();202 });203 it('should call the passed in callback with the passed in port', function() {204 debugPortHandler._sendPort(3402, callback);205 expect(callback.args).to.deep.equal([[3402]]);206 });207 });...
index.test.js
Source:index.test.js
1const test = require('ava');2const sinon = require('sinon');3const portscanner = require('portscanner');4const winston = require('winston');5const wsServer = require('../../coinstac-images/coinstac-base/server-ws2');6const mocks = require('../helpers/mocks');7const Manager = require('../src');8const {9 getImages,10 getStatus,11 pullImages,12 pullImagesFromList,13 pruneImages,14 removeImage,15 setLogger,16 startService,17 stopService,18 stopAllServices,19 docker,20} = Manager;21const { ALL_IMAGES, COMPUTATIONS, getRandomPort } = mocks;22const { transports: { Console } } = winston;23const WS_SERVER_PORT = 3223;24process.LOGLEVEL = 'info';25test.before(() => wsServer.start({ port: WS_SERVER_PORT }));26test('getImages, pruneImages and removeImage', async (t) => {27 /* getImages */28 sinon.stub(docker, 'listImages').resolves(ALL_IMAGES);29 let res = await getImages();30 t.is(res.length, ALL_IMAGES.length);31 docker.listImages.restore();32 /* pruneImages */33 sinon.stub(docker, 'listImages').yields(null, ALL_IMAGES);34 const getImageSuccessCallback = { remove: sinon.stub().yields(null, 'success') };35 const getImageFailCallback = { remove: sinon.stub().yields('error') };36 sinon.stub(docker, 'getImage')37 .onFirstCall()38 .returns(getImageFailCallback)39 .returns(getImageSuccessCallback);40 res = await pruneImages();41 t.is(res.filter(elem => elem === 'success').length, 9);42 docker.listImages.restore();43 sinon.stub(docker, 'listImages').yields(new Error('error'), null);44 try {45 res = await pruneImages();46 } catch (e) {47 t.is(e.message, 'error');48 }49 docker.listImages.restore();50 docker.getImage.restore();51 /* removeImage */52 sinon.stub(docker, 'getImage').returns({53 remove: () => Promise.resolve(),54 });55 const image = COMPUTATIONS[0].img;56 res = await removeImage(image);57 t.is(res, undefined);58 docker.getImage.restore();59});60test('getStatus', async (t) => {61 sinon.stub(docker, 'ping').resolves('OK');62 const status = await getStatus();63 t.is(status, 'OK');64 docker.ping.restore();65});66test('pullImages and pullImagesFromList', async (t) => {67 /* pullImages */68 sinon.stub(docker, 'pull').yields(null, 'stream');69 let images = await pullImages(COMPUTATIONS);70 t.deepEqual(71 images.map(image => image.compId),72 COMPUTATIONS.map(comp => comp.compId)73 );74 docker.pull.restore();75 sinon.stub(docker, 'pull').yields('error', null);76 images = await pullImages(COMPUTATIONS);77 t.deepEqual(78 images.map(image => image.compId),79 COMPUTATIONS.map(comp => comp.compId)80 );81 docker.pull.restore();82 sinon.stub(docker, 'pull').yields(null, 'stream');83 const compList = COMPUTATIONS.map(comp => comp.img);84 images = await pullImagesFromList(compList);85 t.is(compList.length, images.length);86 docker.pull.restore();87});88test('setLogger', async (t) => {89 const logger = winston.createLogger({90 level: 'silly',91 transports: [new Console()],92 });93 const res = setLogger(logger);94 t.deepEqual(res, logger);95});96test('startService, stopService, stopAllServices', async (t) => {97 /* startService1 */98 const container = {99 inspect: () => { },100 };101 sinon.stub(portscanner, 'findAPortNotInUse').returns(getRandomPort());102 sinon.stub(docker, 'createContainer').resolves({103 start: sinon.stub().resolves(container),104 stop: () => { },105 inspect: sinon.stub().yields(null, { State: { Running: true } }),106 });107 let opts = {108 docker: { CMD: [] },109 };110 let res = await startService('service-1', 'test-1', 'docker', opts);111 t.is(typeof res, 'function');112 portscanner.findAPortNotInUse.restore();113 docker.createContainer.restore();114 /* startService2 */115 sinon.stub(portscanner, 'findAPortNotInUse').returns(getRandomPort());116 sinon.stub(docker, 'createContainer').resolves({117 start: sinon.stub().resolves(container),118 stop: () => { },119 inspect: sinon.stub().yields('error', null),120 });121 await startService('service-2', 'test-2', 'docker', opts);122 try {123 await startService('service-2', 'test-2', 'docker', opts);124 } catch (error) {125 t.is(error, 'error');126 }127 portscanner.findAPortNotInUse.restore();128 docker.createContainer.restore();129 /* startService3 */130 sinon.stub(portscanner, 'findAPortNotInUse').returns(getRandomPort());131 sinon.stub(docker, 'createContainer').resolves({132 start: sinon.stub().resolves(container),133 stop: () => { },134 inspect: sinon.stub().yields(null, { State: { Running: true } }),135 });136 res = await startService('service-3', 'test-3', 'docker', opts);137 t.is(typeof res, 'function');138 res = await startService('service-3', 'test-3', 'docker', opts);139 t.is(typeof res, 'function');140 portscanner.findAPortNotInUse.restore();141 docker.createContainer.restore();142 /* startService4 */143 sinon.stub(portscanner, 'findAPortNotInUse').returns(getRandomPort());144 sinon.stub(docker, 'createContainer').resolves({145 start: sinon.stub().resolves(container),146 stop: () => { },147 inspect: sinon.stub().yields(null, { State: { Running: false } }),148 });149 res = await startService('service-4', 'test-4', 'docker', opts);150 t.is(typeof res, 'function');151 portscanner.findAPortNotInUse.restore();152 docker.createContainer.restore();153 /* startService5 */154 sinon.stub(portscanner, 'findAPortNotInUse').returns(WS_SERVER_PORT);155 sinon.stub(docker, 'createContainer').resolves({156 start: sinon.stub().resolves(container),157 stop: () => { },158 inspect: sinon.stub().yields(null, { State: { Running: true } }),159 });160 const service = await startService('service-5', 'test-5', 'docker', opts);161 try {162 const res = await service(['echo', '{"passed": true}', ''], 'test-5');163 t.deepEqual(res, { passed: true });164 } catch (error) {165 t.is(error.code, undefined);166 }167 portscanner.findAPortNotInUse.restore();168 docker.createContainer.restore();169 /* stopService1 */170 opts = {171 docker: { CMD: [] },172 };173 sinon.stub(portscanner, 'findAPortNotInUse').returns(getRandomPort());174 sinon.stub(docker, 'createContainer').resolves({175 start: sinon.stub().resolves(container),176 stop: sinon.stub().resolves(),177 inspect: sinon.stub().yields(null, { State: { Running: true } }),178 });179 await startService('service', 'test', 'docker', opts);180 res = await stopService('service', 'test');181 t.is(res, 'service');182 portscanner.findAPortNotInUse.restore();183 docker.createContainer.restore();184 /* stopService2 */185 sinon.stub(portscanner, 'findAPortNotInUse').returns(getRandomPort());186 sinon.stub(docker, 'createContainer').resolves({187 start: sinon.stub().resolves(container),188 stop: sinon.stub().rejects('error'),189 inspect: sinon.stub().yields(null, { State: { Running: true } }),190 });191 await startService('service', 'test', 'docker', opts);192 res = await stopService('service', 'test');193 t.is(res, 'service');194 portscanner.findAPortNotInUse.restore();195 docker.createContainer.restore();196 /* stopAllServices */197 sinon.stub(portscanner, 'findAPortNotInUse').returns(getRandomPort());198 sinon.stub(docker, 'createContainer').resolves({199 start: sinon.stub().resolves(container),200 stop: () => { },201 inspect: sinon.stub().yields(null, { State: { Running: true } }),202 });203 await startService('service', 'test-1', 'docker', opts);204 await stopAllServices();205 const services = Manager.getServices();206 t.deepEqual(services, {});207 portscanner.findAPortNotInUse.restore();208 docker.createContainer.restore();209});210test.after.always('cleanup stubs', () => {211 return new Promise((resolve) => {212 resolve();213 });...
portscanner.js
Source:portscanner.js
...45 host: string,46 opts: Options,47 checkPortCallback: StatusCallback48 ): void;49 declare export function findAPortNotInUse(50 portList: number[]51 ): Promise<number>;52 declare export function findAPortNotInUse(startPort: number): Promise<number>;53 declare export function findAPortNotInUse(54 portList: number[],55 findPortCallback: PortCallback56 ): void;57 declare export function findAPortNotInUse(58 portList: number[],59 host: string60 ): Promise<number>;61 declare export function findAPortNotInUse(62 startPort: number,63 findPortCallback: PortCallback64 ): void;65 declare export function findAPortNotInUse(66 startPort: number,67 host: string68 ): Promise<number>;69 declare export function findAPortNotInUse(70 startPort: number,71 endPort: number72 ): Promise<number>;73 declare export function findAPortNotInUse(74 startPort: number,75 endPort: number,76 host: string77 ): Promise<number>;78 declare export function findAPortNotInUse(79 startPort: number,80 endPort: number,81 findPortCallback: PortCallback82 ): void;83 declare export function findAPortNotInUse(84 startPort: number,85 endPort: number,86 host: string,87 findPortCallback: PortCallback88 ): void;89 declare export function findAPortInUse(portList: number[]): Promise<number>;90 declare export function findAPortInUse(startPort: number): Promise<number>;91 declare export function findAPortInUse(92 portList: number[],93 findPortCallback: PortCallback94 ): void;95 declare export function findAPortInUse(96 portList: number[],97 host: string...
test.js
Source:test.js
...43});44/* findPortNotInUse */45test('findAPortNotInUse - start from free port', t => {46 t.plan(2);47 portScanner.findAPortNotInUse(3001, 3010, '127.0.0.1', (error, port) => {48 t.is(error, null);49 t.true(port >= 3001 && port <= 3010);50 });51});52test('findAPortNotInUse - start from taken port', t => {53 t.plan(2);54 portScanner.findAPortNotInUse(3000, 3010, '127.0.0.1', (error, port) => {55 t.is(error, null);56 t.true(port >= 3001 && port <= 3010);57 });58});59test('findAPortNotInUse - all ports in range taken', t => {60 t.plan(2);61 portScanner.findAPortNotInUse(2999, 3000, '127.0.0.1', (error, port) => {62 t.is(error, null);63 t.false(port);64 });65});66test('checkPortStatus - taken (port as a string)', t => {67 t.plan(2)68 portScanner.checkPortStatus('3000', '127.0.0.1', (error, port) => {69 t.is(error, null)70 t.is(port, 'open')71 })72})73test('checkPortStatus - free (port as a string)', t => {74 t.plan(2)75 portScanner.checkPortStatus('3001', '127.0.0.1', (error, port) => {76 t.is(error, null)77 t.is(port, 'closed')78 })79})80test('findPortInUse - taken port in range (startPort as a string)', t => {81 t.plan(2)82 portScanner.findAPortInUse('3000', 3010, '127.0.0.1', (error, port) => {83 t.is(error, null)84 t.is(port, '3000')85 })86})87test('findPortInUse - taken port in range (endPort as a string)', t => {88 t.plan(2)89 portScanner.findAPortInUse(3000, '3010', '127.0.0.1', (error, port) => {90 t.is(error, null)91 t.is(port, 3000)92 })93})94test('findPortInUse - taken port in range (startPort and endPort as strings)', t => {95 t.plan(2)96 portScanner.findAPortInUse('3000', '3010', '127.0.0.1', (error, port) => {97 t.is(error, null)98 t.is(port, '3000')99 })100})101// test('findAPortNotInUse - start from free port (startPort as a string)', t => {102// t.plan(2);103// portScanner.findAPortNotInUse('3001', 3010, '127.0.0.1', (error, port) => {104// t.is(error, null);105// t.true(port !== '3001');106// });...
test_portscanner.js
Source:test_portscanner.js
...28const assertPort = (port: number) => {29 assert(port === 3005);30};31// one argument32findAPortNotInUse([3000, 3005, 3006]).then(assertPort);33findAPortNotInUse(3000).then(assertPort);34// two arguments35findAPortNotInUse([3000, 3005, 3006], findPortCallback);36findAPortNotInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);37findAPortNotInUse(3000, findPortCallback);38findAPortNotInUse(3000, '127.0.0.1').then(assertPort);39findAPortNotInUse(3000, 3010).then(assertPort);40// three arguments41findAPortNotInUse(3000, 3010, '127.0.0.1').then(assertPort);42findAPortNotInUse(3000, 3010, findPortCallback);43// four argumentss44findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);45// one argument46findAPortInUse([3000, 3005, 3006]).then(assertPort);47findAPortInUse(3000).then(assertPort);48// two arguments49findAPortInUse([3000, 3005, 3006], findPortCallback);50findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);51findAPortInUse(3000, findPortCallback);52findAPortInUse(3000, '127.0.0.1').then(assertPort);53findAPortInUse(3000, 3010).then(assertPort);54// three arguments55findAPortInUse(3000, 3010, '127.0.0.1').then(assertPort);56findAPortInUse(3000, 3010, findPortCallback);57// four argumentss58findAPortInUse(3000, 3010, '127.0.0.1', findPortCallback);
config-handler.js
Source:config-handler.js
...24 }25};26var findAPortNotInUse = deasync(portscanner.findAPortNotInUse);27function findPort(port) {28 return findAPortNotInUse(port, port + 1000, '127.0.0.1');29}30function extendConfig(config) {31 config = assign({}, defaultConfig, config);32 config.basePath = path.resolve(config.basePath);33 config.viewFolder = path.resolve(config.basePath, config.viewFolder);34 config.mockFolder = path.resolve(config.basePath, config.mockFolder);35 config.publicFolder = path.resolve(config.basePath, config.publicFolder);36 config.routeFile = path.resolve(config.basePath, config.routeFile);37 if (config.enableJava) {38 config.javaServerPort = findPort(defaultJavaPort);39 }40 if (config.livereload) {41 config.livereloadPort = findPort(defaultLivereloadPort);42 }...
index.js
Source:index.js
...13 } = {14 ...defaultOptions,15 ...userOptions16 };17 return findAPortNotInUse(minPort, maxPort, host).then((port) => {18 log(String(port));19 return callback(port);20 });21 };...
OptionUtil.js
Source:OptionUtil.js
1import {promisify} from 'bluebird';2import {findAPortNotInUse} from 'portscanner';3const findAPortNotInUseAsync = promisify(findAPortNotInUse);4export function getAvailablePort() {5 return findAPortNotInUseAsync(3000, 65535, '127.0.0.1');...
Using AI Code Generation
1var wd = require('wd');2var serverConfigs = {3};4var desiredCaps = {5};6var driver = wd.promiseChainRemote(serverConfigs);7 .init(desiredCaps)8 .then(function () {9 return driver.execute('mobile: findAPortNotInUse', {portRange: '1000-10000'});10 })11 .then(function (port) {12 console.log('Found port: ' + port);13 })14 .fin(function () { return driver.quit(); })15 .done();16from appium import webdriver17from selenium.webdriver.common.by import By18from selenium.webdriver.support.ui import WebDriverWait19from selenium.webdriver.support import expected_conditions as EC20server_config = {21}22desired_caps = {23}24WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'UIAButton')))25port = driver.execute_script('mobile: findAPortNotInUse', {'portRange': '1000-10000'})26print('Found port: ' + port)27driver.quit()28server_config = {29}30desired_caps = {31}32driver = Appium::Driver.new(desired_caps)33wait = Selenium::WebDriver::Wait.new(:timeout => 10)34wait.until { driver.find_element(:class_name, 'UIAButton') }35port = driver.execute_script('mobile: findAPortNotInUse', {'portRange': '1000-10000'})
Using AI Code Generation
1const appium = require('appium');2const appiumXCUITestDriver = require('appium-xcuitest-driver');3const driver = new appiumXCUITestDriver.Driver();4const port = await driver.findAPortNotInUse(4723, 4729);5console.log(port);6const appium = require('appium');7const appiumBaseDriver = require('appium-base-driver');8const driver = new appiumBaseDriver.Driver();9const port = await driver.findAPortNotInUse(4723, 4729);10console.log(port);11const appium = require('appium');12const appiumSupport = require('appium-support');13const port = await appiumSupport.findAPortNotInUse(4723, 4729);14console.log(port);15const appium = require('appium');16const appiumSupport = require('appium-support');17const port = await appiumSupport.findAPortNotInUse(4723, 4729);18console.log(port);19const appium = require('appium');20const appiumSupport = require('appium-support');21const port = await appiumSupport.findAPortNotInUse(4723, 4729);22console.log(port);23const appium = require('appium');24const appiumSupport = require('appium-support');25const port = await appiumSupport.findAPortNotInUse(4723, 4729);26console.log(port);27const appium = require('appium');28const appiumSupport = require('appium-support');29const port = await appiumSupport.findAPortNotInUse(4723, 4729);30console.log(port);31const appium = require('appium');32const appiumSupport = require('appium-support');33const port = await appiumSupport.findAPortNotInUse(4723, 4729);
Using AI Code Generation
1const wd = require('wd');2const assert = require('assert');3const { findAPortNotInUse } = require('appium-xcuitest-driver');4async function main () {5 const port = await findAPortNotInUse(8100);6 console.log(port);7 const caps = {
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!