Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules/*
/lib/*
/ui/*
/ui/*
/test/*
2 changes: 1 addition & 1 deletion dashboard-frontend
4 changes: 2 additions & 2 deletions src/CapabilityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export async function iOSCapabilities(
delete caps.firstMatch[0]['appium:wdaLocalPort'];
}
}
if(!freeDevice.realDevice) {
caps.firstMatch[0]['appium:derivedDataPath'] =`${freeDevice.derivedDataPath}`;
if (!freeDevice.realDevice) {
caps.firstMatch[0]['appium:derivedDataPath'] = `${freeDevice.derivedDataPath}`;
}

const deleteMatch = [
Expand Down
2 changes: 1 addition & 1 deletion src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { registerAuthenticationRoutes } from '../auth/routers';
import { userService } from '../auth/services/user.service';
import { IPluginArgs } from '../interfaces/IPluginArgs';

let dashboardPluginUrl: any = null;
const dashboardPluginUrl: any = null;

const ASYNC_LOCK = new AsyncLock();

Expand Down
2 changes: 1 addition & 1 deletion src/app/routers/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function getSavedDevices(request: Request, response: Response) {
async function getDevices(request: Request, response: Response) {
const { user } = request as AuthenticatedRequest;
const filterOptions = user?.role === 'admin' ? {} : { userId: user?.userId };
let devices = await getAllDevices(filterOptions as any);
const devices = await getAllDevices(filterOptions as any);
const { sessionId } = request.query;
if (sessionId) {
return response.json(devices.find((value) => value.session_id === sessionId));
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getDeviceFarmHome() {

export function getServerMetadata() {
const metaFile = path.join(getDeviceFarmHome(), 'metadata.json');
let defaultMetadata = {
const defaultMetadata = {
id: uuid(),
};
if (fs.existsSync(metaFile)) {
Expand Down
2 changes: 1 addition & 1 deletion src/data-service/node-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class NodeService {
}
}

static async getAllNodes(secure: boolean = true) {
static async getAllNodes(secure = true) {
return prisma.node.findMany({
select: {
id: true,
Expand Down
22 changes: 11 additions & 11 deletions src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/* eslint-disable no-prototype-builtins */
import os from 'os';
import path from 'path';
import tcpPortUsed from 'tcp-port-used';
import getPort from 'get-port';
import AsyncLock from 'async-lock';
import { IDevice } from './interfaces/IDevice';
import asyncWait from 'async-wait-until';
import axios from 'axios';
import getPort from 'get-port';
import _ from 'lodash';
import log from './logger';
import Cloud from './enums/Cloud';
import normalizeUrl from 'normalize-url';
import ora from 'ora';
import asyncWait from 'async-wait-until';
import axios from 'axios';
import os from 'os';
import path from 'path';
import tcpPortUsed from 'tcp-port-used';
import Cloud from './enums/Cloud';
import { FakeModuleLoader } from './fake-module-loader';
import { IDevice } from './interfaces/IDevice';
import { IExternalModuleLoader } from './interfaces/IExternalModule';
import log from './logger';

const APPIUM_VENDOR_PREFIX = 'appium:';

Expand All @@ -35,8 +35,8 @@ class PortManager {
*/
async getAndAllocateFreePort(portRange?: string): Promise<number> {
return this.lock.acquire('port-allocation', async () => {
// eslint-disable-next-line no-constant-condition
while (true) {
let port: number;
let portOptions: number[] | undefined;

// Determine which ports to try
Expand All @@ -59,7 +59,7 @@ class PortManager {
}

// Get a free port from the system
port = portOptions ? await getPort({ port: portOptions }) : await getPort();
const port = portOptions ? await getPort({ port: portOptions }) : await getPort();

// Atomically allocate it (we're in the lock, so this is safe)
if (!this.allocatedPorts.has(port)) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules
4 changes: 3 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,9 @@ class DevicePlugin extends BasePlugin {
let jwt = '';
if (this.pluginArgs.enableAuthentication) {
const user = await getUserFromCapabilities(mergedCapabilites);
jwt = await generateTokenForNode(device.nodeId!, user?.id!);
if (user) {
jwt = await generateTokenForNode(device.nodeId!, user.id);
}
}
if (capabilitiesToCreateSession.capabilities.alwaysMatch) {
capabilitiesToCreateSession.capabilities.alwaysMatch['df:udid'] = device.udid;
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/ios-sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const execAsync = util.promisify(exec);
const WDA_BUILD_PATH = '/appium_wda_ios/Build/Products/Debug-iphoneos';
let bundleIdName: { uuid: string; name: string }[] | null = null;
let freeBundleID: { uuid: string; name: string } | null = null;
let isFreeAccount: boolean = false;
let isFreeAccount = false;
async function getXcodeMajorVersion(): Promise<number> {
const { stdout } = await execAsync('xcodebuild -version');
const match = stdout.match(/Xcode (\d+)\./);
Expand Down Expand Up @@ -235,7 +235,7 @@ async function zipPayloadDirectory(
// Replace CFBundleIdentifier
infoPlistContent = infoPlistContent.replace(
/<key>CFBundleIdentifier<\/key>\n\s*<string>(.*?)<\/string>/,
`<key>CFBundleIdentifier<\/key>\n<string>${bundleId}<\/string>`,
`<key>CFBundleIdentifier</key>\n<string>${bundleId}</string>`,
);

// Write Info.plist
Expand Down
6 changes: 3 additions & 3 deletions src/usbmux.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
import * as net from 'net';
import * as util from 'util';
import { EventEmitter } from 'events';
import * as Q from 'q';
import * as plist from 'plist';
Expand Down Expand Up @@ -218,8 +218,8 @@ class UsbmuxdError extends Error {
this.number = number;
this.message += ', Err #' + number;
}
if (number === 2) this.message += ": Device isn't connected";
if (number === 3) this.message += ": Port isn't available or open";
if (number === 2) this.message += ': Device is not connected';
if (number === 3) this.message += ': Port is not available or open';
if (number === 5) this.message += ': Malformed request';
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/android/cloud/confIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Plugin Test', () => {

it('Vertical swipe test', async () => {
console.log(await driver.capabilities.deviceUDID);
let textButton = await driver.$('~Text Button');
const textButton = await driver.$('~Text Button');
await textButton.waitForDisplayed({ timeout: 30000 });
await textButton.click();
});
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/plugin-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function pluginE2EHarness(opts: E2ESetupOpts & { enableGoIos?: boolean })
enableGoIos,
} = opts;

let server: AppiumServer | undefined = undefined;
const server: AppiumServer | undefined = undefined;

async function goIosPath() {
const appium_path = path.dirname(require.resolve('appium'));
Expand Down
4 changes: 2 additions & 2 deletions test/unit/DeviceModel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { IDevice } from '../../src/interfaces/IDevice';
import { prisma } from '../../src/prisma';
import { deviceMock } from './fixtures/devices';
var sandbox = sinon.createSandbox();
const sandbox = sinon.createSandbox();

describe('Model Test', async () => {
before('Add device collection', async () => {
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('Model Test', async () => {

it('Should handle concurrent update to device list', async () => {
// create bunch of devices using loop
let newDeviceList = [] as unknown as IDevice[];
const newDeviceList = [] as unknown as IDevice[];
for (let i = 0; i < 10; i++) {
newDeviceList.push({
id: `dev-loop-${i}`,
Expand Down
2 changes: 1 addition & 1 deletion typings/appium-xcuitest-driver/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
declare module 'appium-xcuitest-driver';
declare module 'appium-xcuitest-driver';
Loading