From a034aabc1870c77e3bd96f3fa2a9c344cabc545f Mon Sep 17 00:00:00 2001 From: Dan Graham Date: Mon, 31 Jan 2022 11:39:05 -0800 Subject: [PATCH] include sauce:options by default and give job a name (#285) --- app/renderer/actions/Session.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/renderer/actions/Session.js b/app/renderer/actions/Session.js index e666e070b..94a3cd5ac 100644 --- a/app/renderer/actions/Session.js +++ b/app/renderer/actions/Session.js @@ -3,13 +3,14 @@ import { getSetting, setSetting, SAVED_SESSIONS, SERVER_ARGS, SESSION_SERVER_TYP import { v4 as UUID } from 'uuid'; import { push } from 'connected-react-router'; import { notification } from 'antd'; -import { includes, debounce, toPairs, union, without, keys, isUndefined } from 'lodash'; +import { includes, debounce, toPairs, union, without, keys, isUndefined, isPlainObject } from 'lodash'; import { setSessionDetails, quitSession } from './Inspector'; import i18n from '../../configs/i18next.config.renderer'; import CloudProviders from '../components/Session/CloudProviders'; import { Web2Driver } from 'web2driver'; import { addVendorPrefixes } from '../util'; import ky from 'ky/umd'; +import moment from 'moment'; export const NEW_SESSION_REQUESTED = 'NEW_SESSION_REQUESTED'; export const NEW_SESSION_BEGAN = 'NEW_SESSION_BEGAN'; @@ -91,6 +92,8 @@ export const DEFAULT_SERVER_PATH = '/'; export const DEFAULT_SERVER_HOST = '127.0.0.1'; export const DEFAULT_SERVER_PORT = 4723; +const SAUCE_OPTIONS_CAP = 'sauce:options'; + const JSON_TYPES = ['object', 'number', 'boolean']; export function getCapsObject (caps) { @@ -250,6 +253,13 @@ export function newSession (caps, attachSessId = null) { return; } https = false; + if (!isPlainObject(desiredCapabilities[SAUCE_OPTIONS_CAP])) { + desiredCapabilities[SAUCE_OPTIONS_CAP] = {}; + } + if (!desiredCapabilities[SAUCE_OPTIONS_CAP].name) { + const dateTime = moment().format('lll'); + desiredCapabilities[SAUCE_OPTIONS_CAP].name = `Appium Desktop Session -- ${dateTime}`; + } break; case ServerTypes.headspin: { let headspinUrl;