Skip to content

Commit

Permalink
fix: rename TestingBot key and secret to username and accessKey (#1401)
Browse files Browse the repository at this point in the history
  • Loading branch information
jochen-testingbot authored Mar 22, 2024
1 parent dd61f61 commit 03558f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
13 changes: 6 additions & 7 deletions app/renderer/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,12 @@ export function newSession(caps, attachSessId = null) {
if (!desiredCapabilities['tb:options']) {
desiredCapabilities['tb:options'] = {};
}
desiredCapabilities['tb:options'].key = session.server.testingbot.key || process.env.TB_KEY;
desiredCapabilities['tb:options'].secret =
session.server.testingbot.secret || process.env.TB_SECRET;
if (
!(session.server.testingbot.key || process.env.TB_KEY) ||
!(session.server.testingbot.secret || process.env.TB_SECRET)
) {
username = session.server.testingbot.username || process.env.TB_KEY;
accessKey = session.server.testingbot.accessKey || process.env.TB_SECRET;
desiredCapabilities['tb:options'].key = username;
desiredCapabilities['tb:options'].secret = accessKey;
desiredCapabilities['tb:options'].source = 'appiumdesktop';
if (!username || !accessKey) {
showError(new Error(i18n.t('testingbotCredentialsRequired')));
return false;
}
Expand Down
16 changes: 8 additions & 8 deletions app/renderer/components/Session/ServerTabTestingbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import React from 'react';

import {INPUT} from '../AntdTypes';

const testingbotKeyPlaceholder = (t) => {
const testingbotUsernamePlaceholder = (t) => {
if (process.env.TB_KEY) {
return t('usingDataFoundIn', {environmentVariable: 'TB_KEY'});
}
return t('yourUsername');
};

const testingbotSecretPlaceholder = (t) => {
const testingbotAccessKeyPlaceholder = (t) => {
if (process.env.TB_SECRET) {
return t('usingDataFoundIn', {environmentVariable: 'TB_SECRET'});
}
Expand All @@ -24,10 +24,10 @@ const ServerTabTestingbot = ({server, setServerParam, t}) => (
<Form.Item>
<Input
id="testingbotKey"
placeholder={testingbotKeyPlaceholder(t)}
placeholder={testingbotUsernamePlaceholder(t)}
addonBefore={t('TestingBot Key')}
value={server.testingbot.key}
onChange={(e) => setServerParam('key', e.target.value)}
value={server.testingbot.username}
onChange={(e) => setServerParam('username', e.target.value)}
/>
</Form.Item>
</Col>
Expand All @@ -36,10 +36,10 @@ const ServerTabTestingbot = ({server, setServerParam, t}) => (
<Input
id="testingbotSecret"
type={INPUT.PASSWORD}
placeholder={testingbotSecretPlaceholder(t)}
placeholder={testingbotAccessKeyPlaceholder(t)}
addonBefore={t('TestingBot Secret')}
value={server.testingbot.secret}
onChange={(e) => setServerParam('secret', e.target.value)}
value={server.testingbot.accessKey}
onChange={(e) => setServerParam('accessKey', e.target.value)}
/>
</Form.Item>
</Col>
Expand Down

0 comments on commit 03558f6

Please sign in to comment.