Skip to content

Commit 26a67d7

Browse files
Merge branch 'main' into environmentSecrets
2 parents 9e8f5a4 + 31e38f6 commit 26a67d7

File tree

25 files changed

+720
-579
lines changed

25 files changed

+720
-579
lines changed

app/common/public/locales/ko/translation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"appiumInspector": "",
2+
"appiumInspector": "Appium Inspector",
33
"Edit": "변경",
44
"Redo": "재실행",
55
"Cut": "자르기",

app/common/renderer/actions/Inspector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ export function setLocatorTestElement(elementId) {
570570
location: {x: commandRes.x, y: commandRes.y},
571571
size: {width: commandRes.width, height: commandRes.height},
572572
});
573-
} catch (ign) {}
573+
} catch {}
574574
}
575575
};
576576
}
@@ -825,7 +825,7 @@ export function runKeepAliveLoop() {
825825
log.info('Pinging Appium server to keep session active');
826826
try {
827827
await driver.getTimeouts(); // Pings the Appium server to keep it alive
828-
} catch (ign) {}
828+
} catch {}
829829
const now = Date.now();
830830

831831
// If the new command limit has been surpassed, prompt user if they want to keep session going
@@ -963,7 +963,7 @@ export function uploadGesturesFromFile(fileList) {
963963

964964
gesture.description = gesture.description || i18n.t('gestureImportedFrom', {fileName});
965965
parsedGestures.push(_.omit(gesture, ['id']));
966-
} catch (e) {
966+
} catch {
967967
invalidGestures[fileName] = [i18n.t('gestureInvalidJsonError')];
968968
}
969969
}

app/common/renderer/actions/Session.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {notification} from 'antd';
2-
import {includes, isPlainObject, isUndefined, toPairs, union, values, without} from 'lodash';
2+
import _ from 'lodash';
33
import moment from 'moment';
44
import {Web2Driver} from 'web2driver';
55

@@ -117,7 +117,7 @@ export function getCapsObject(caps) {
117117
try {
118118
let obj = JSON.parse(cap.value);
119119
return {[cap.name]: obj};
120-
} catch (ign) {}
120+
} catch {}
121121
}
122122
return {[cap.name]: cap.value};
123123
}),
@@ -141,7 +141,7 @@ export function showError(e, params = {methodName: null, secs: 5, url: null}) {
141141
} else if (e.data) {
142142
try {
143143
e.data = JSON.parse(e.data);
144-
} catch (ign) {}
144+
} catch {}
145145
if (e.data.value && e.data.value.message) {
146146
errMessage = e.data.value.message;
147147
} else {
@@ -156,8 +156,8 @@ export function showError(e, params = {methodName: null, secs: 5, url: null}) {
156156
}
157157
if (
158158
errMessage === 'ECONNREFUSED' ||
159-
includes(errMessage, 'Failed to fetch') ||
160-
includes(errMessage, 'The requested resource could not be found')
159+
_.includes(errMessage, 'Failed to fetch') ||
160+
_.includes(errMessage, 'The requested resource could not be found')
161161
) {
162162
errMessage = i18n.t('couldNotConnect', {url});
163163
}
@@ -290,7 +290,7 @@ export function newSession(caps, attachSessId = null) {
290290
return false;
291291
}
292292
https = false;
293-
if (!isPlainObject(desiredCapabilities[SAUCE_OPTIONS_CAP])) {
293+
if (!_.isPlainObject(desiredCapabilities[SAUCE_OPTIONS_CAP])) {
294294
desiredCapabilities[SAUCE_OPTIONS_CAP] = {};
295295
}
296296
if (!desiredCapabilities[SAUCE_OPTIONS_CAP].name) {
@@ -302,7 +302,7 @@ export function newSession(caps, attachSessId = null) {
302302
let headspinUrl;
303303
try {
304304
headspinUrl = new URL(session.server.headspin.webDriverUrl);
305-
} catch (ign) {
305+
} catch {
306306
showError(new Error(`${i18n.t('Invalid URL:')} ${session.server.headspin.webDriverUrl}`));
307307
return false;
308308
}
@@ -353,15 +353,19 @@ export function newSession(caps, attachSessId = null) {
353353
desiredCapabilities['lt:options'].source = 'appiumdesktop';
354354
desiredCapabilities['lt:options'].isRealMobile = true;
355355
if (session.server.advanced.useProxy) {
356-
desiredCapabilities['lt:options'].proxyUrl = isUndefined(session.server.advanced.proxy)
356+
desiredCapabilities['lt:options'].proxyUrl = _.isUndefined(
357+
session.server.advanced.proxy,
358+
)
357359
? ''
358360
: session.server.advanced.proxy;
359361
}
360362
} else {
361363
desiredCapabilities['lambdatest:source'] = 'appiumdesktop';
362364
desiredCapabilities['lambdatest:isRealMobile'] = true;
363365
if (session.server.advanced.useProxy) {
364-
desiredCapabilities['lambdatest:proxyUrl'] = isUndefined(session.server.advanced.proxy)
366+
desiredCapabilities['lambdatest:proxyUrl'] = _.isUndefined(
367+
session.server.advanced.proxy,
368+
)
365369
? ''
366370
: session.server.advanced.proxy;
367371
}
@@ -447,7 +451,7 @@ export function newSession(caps, attachSessId = null) {
447451
let experitestUrl;
448452
try {
449453
experitestUrl = new URL(session.server.experitest.url);
450-
} catch (ign) {
454+
} catch {
451455
showError(new Error(`${i18n.t('Invalid URL:')} ${session.server.experitest.url}`));
452456
return false;
453457
}
@@ -489,7 +493,7 @@ export function newSession(caps, attachSessId = null) {
489493
let mobitruUrl;
490494
try {
491495
mobitruUrl = new URL(webDriverUrl);
492-
} catch (ign) {
496+
} catch {
493497
showError(new Error(`${i18n.t('Invalid URL:')} ${webDriverUrl}`));
494498
return false;
495499
}
@@ -549,13 +553,13 @@ export function newSession(caps, attachSessId = null) {
549553
// If a newCommandTimeout wasn't provided, set it to 60 * 60 so that sessions don't close on users in short term.
550554
// I saw sometimes infinit session timeout was not so good for cloud providers.
551555
// So, let me define this value as NEW_COMMAND_TIMEOUT_SEC by default.
552-
if (isUndefined(desiredCapabilities[CAPS_NEW_COMMAND])) {
556+
if (_.isUndefined(desiredCapabilities[CAPS_NEW_COMMAND])) {
553557
desiredCapabilities[CAPS_NEW_COMMAND] = NEW_COMMAND_TIMEOUT_SEC;
554558
}
555559

556560
// If someone didn't specify connectHardwareKeyboard, set it to true by
557561
// default
558-
if (isUndefined(desiredCapabilities[CAPS_CONNECT_HARDWARE_KEYBOARD])) {
562+
if (_.isUndefined(desiredCapabilities[CAPS_CONNECT_HARDWARE_KEYBOARD])) {
559563
desiredCapabilities[CAPS_CONNECT_HARDWARE_KEYBOARD] = true;
560564
}
561565

@@ -627,7 +631,7 @@ export function newSession(caps, attachSessId = null) {
627631
try {
628632
mode = APP_MODE.WEB_HYBRID;
629633
await driver.navigateTo('https://appium.io');
630-
} catch (ign) {}
634+
} catch {}
631635
}
632636

633637
let mjpegScreenshotUrl =
@@ -861,7 +865,7 @@ export function setSavedServerParams() {
861865
if (server) {
862866
// if we have a cloud provider as a saved server, but for some reason the
863867
// cloud provider is no longer in the list, revert server type to remote
864-
if (values(SERVER_TYPES).includes(serverType) && !currentProviders.includes(serverType)) {
868+
if (_.values(SERVER_TYPES).includes(serverType) && !currentProviders.includes(serverType)) {
865869
serverType = SERVER_TYPES.REMOTE;
866870
}
867871
dispatch({type: SET_SERVER, server, serverType});
@@ -978,7 +982,7 @@ async function fetchAllSessions(baseUrl, authToken) {
978982
try {
979983
const res = await fetchSessionInformation({url, authToken});
980984
return res.data.value ?? [];
981-
} catch (err) {
985+
} catch {
982986
return [];
983987
}
984988
}
@@ -988,7 +992,7 @@ async function fetchAllSessions(baseUrl, authToken) {
988992
try {
989993
const res = await fetchSessionInformation({url, authToken});
990994
return formatSeleniumGridSessions(res);
991-
} catch (err) {
995+
} catch {
992996
return [];
993997
}
994998
}
@@ -1048,7 +1052,7 @@ export function saveRawDesiredCaps() {
10481052
}
10491053

10501054
// Translate the caps JSON to array format
1051-
let newCapsArray = toPairs(newCaps).map(([name, value]) => ({
1055+
let newCapsArray = _.toPairs(newCaps).map(([name, value]) => ({
10521056
type: (() => {
10531057
let type = typeof value;
10541058

@@ -1103,7 +1107,7 @@ export function stopAddCloudProvider() {
11031107
export function addVisibleProvider(provider) {
11041108
return async (dispatch, getState) => {
11051109
let currentProviders = getState().session.visibleProviders;
1106-
const providers = union(currentProviders, [provider]);
1110+
const providers = _.union(currentProviders, [provider]);
11071111
await setSetting(VISIBLE_PROVIDERS, providers);
11081112
dispatch({type: SET_PROVIDERS, providers});
11091113
};
@@ -1116,7 +1120,7 @@ export function removeVisibleProvider(provider) {
11161120
const action = changeServerType('remote');
11171121
await action(dispatch, getState);
11181122
}
1119-
const providers = without(visibleProviders, provider);
1123+
const providers = _.without(visibleProviders, provider);
11201124
await setSetting(VISIBLE_PROVIDERS, providers);
11211125
dispatch({type: SET_PROVIDERS, providers});
11221126
};
@@ -1197,7 +1201,7 @@ export function initFromQueryString(loadNewSession) {
11971201
try {
11981202
const state = JSON.parse(initialState);
11991203
dispatch({type: SET_STATE_FROM_URL, state});
1200-
} catch (e) {
1204+
} catch {
12011205
showError(new Error('Could not parse initial state from URL'), {secs: 0});
12021206
}
12031207
}

app/common/renderer/components/Inspector/Inspector.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ThunderboltOutlined,
1414
} from '@ant-design/icons';
1515
import {Button, Card, Modal, Space, Spin, Switch, Tabs, Tooltip} from 'antd';
16-
import {debounce} from 'lodash';
16+
import _ from 'lodash';
1717
import {useEffect, useRef, useState} from 'react';
1818
import {useNavigate} from 'react-router';
1919

@@ -123,7 +123,7 @@ const Inspector = (props) => {
123123
setScaleRatio(windowSize.width / newImgWidth);
124124
};
125125

126-
const updateScreenshotScaleDebounced = debounce(updateScreenshotScale, 50);
126+
const updateScreenshotScaleDebounced = _.debounce(updateScreenshotScale, 50);
127127

128128
const checkMjpegStream = async () => {
129129
const {setAwaitingMjpegStream} = props;
@@ -133,7 +133,7 @@ const Inspector = (props) => {
133133
try {
134134
await img.decode();
135135
imgReady = true;
136-
} catch (ign) {}
136+
} catch {}
137137
if (imgReady && isAwaitingMjpegStream) {
138138
setAwaitingMjpegStream(false);
139139
updateScreenshotScaleDebounced();

app/common/renderer/lib/appium-client.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class AppiumClient {
4040
if (methodName === 'quit') {
4141
try {
4242
await this.driver.quit();
43-
} catch (ign) {}
43+
} catch {}
4444

4545
_instance = null;
4646

@@ -193,7 +193,7 @@ export default class AppiumClient {
193193
let element = null;
194194
try {
195195
element = await this.driver.findElement(strategy, selector);
196-
} catch (err) {
196+
} catch {
197197
return {};
198198
}
199199

@@ -301,13 +301,13 @@ export default class AppiumClient {
301301
try {
302302
const systemBars = await this.driver.executeScript('mobile:getSystemBars', []);
303303
webviewTopOffset = systemBars.statusBar.height;
304-
} catch (e) {
304+
} catch {
305305
try {
306306
// to minimize the endpoint call which gets error in newer chromedriver.
307307
const sessionDetails = await this.driver.getSession();
308308
// in case driver does not support mobile:getSystemBars
309309
webviewTopOffset = sessionDetails.viewportRect.top;
310-
} catch (ign) {}
310+
} catch {}
311311
}
312312
}
313313
} else if (this.driver.client.isIOS) {
@@ -316,7 +316,7 @@ export default class AppiumClient {
316316
// emulate optional chaining of deeply embedded property which might not exist using
317317
// a try catch
318318
browserName = this.driver.client.capabilities.browserName.toLowerCase();
319-
} catch (ign) {}
319+
} catch {}
320320
const isSafari = browserName === 'safari';
321321
if (isSafari) {
322322
// on iOS, if we're in Safari simply find the top status bar and address bar and use its Y endpoint
@@ -336,12 +336,12 @@ export default class AppiumClient {
336336
[],
337337
);
338338
webviewLeftOffset = deviceScreenInfo.statusBarSize.height;
339-
} catch (e) {
339+
} catch {
340340
try {
341341
const sessionDetails = await this.driver.getSession();
342342
// in case driver does not support mobile:deviceScreenInfo
343343
webviewLeftOffset = sessionDetails.statBarHeight;
344-
} catch (ign) {}
344+
} catch {}
345345
}
346346
}
347347
} else {
@@ -406,7 +406,7 @@ export default class AppiumClient {
406406
try {
407407
await this.driver.getContexts();
408408
return true;
409-
} catch (ign) {}
409+
} catch {}
410410

411411
// If the app under test returns non JSON format response
412412
return false;
@@ -454,7 +454,7 @@ export default class AppiumClient {
454454
let descriptionJSON = {attached: false};
455455
try {
456456
descriptionJSON = JSON.parse(page.description);
457-
} catch (ign) {}
457+
} catch {}
458458

459459
// You can have multiple `type` of pages, like service workers
460460
// We need to have pages with or 1. an attached view or 2. with an empty description

app/common/renderer/lib/client-frameworks/dotnet-nunit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ _driver.PerformActions(new List<ActionSequence> { swipe });
329329
settings.push(`_driver.SetSetting("${settingName}", ${this.getCSharpVal(settingValue)});`);
330330
}
331331
return settings.join('\n');
332-
} catch (e) {
332+
} catch {
333333
return `// Could not parse: ${settingsJson}`;
334334
}
335335
}

app/common/renderer/lib/client-frameworks/java-common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ driver.perform(Arrays.asList(swipe));
309309
settings.push(`driver.setSetting("${settingName}", ${this.getJavaVal(settingValue)});`);
310310
}
311311
return settings.join('\n');
312-
} catch (e) {
312+
} catch {
313313
return `// Could not parse: ${settingsJson}`;
314314
}
315315
}

0 commit comments

Comments
 (0)