Skip to content

Commit a06931f

Browse files
authoredApr 8, 2024··
feat: Add appTimeZone capability (#2379)
1 parent 08aa9ce commit a06931f

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
 

‎docs/reference/capabilities.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ about capabilities, refer to the [Appium documentation](https://appium.io/docs/e
3737
| `appium:calendarFormat` | Calendar format to set for iOS Simulator, for example `gregorian` or `persian`. Can only be set in conjunction with `appium:locale`. |
3838
| `appium:appPushTimeout` | The timeout for application upload in milliseconds. Works for real devices only. The default value is `30000`ms |
3939
| `appium:appInstallStrategy` | Select application installation strategy for real devices. The following strategies are supported:<br>`serial` (default) - pushes app files to the device in a sequential order; this is the least performant strategy, although the most reliable<br>`parallel` - pushes app files simultaneously; this is usually the the most performant strategy, but sometimes could not be very stable<br>`ios-deploy` - tells the driver to use a third-party tool [ios-deploy](https://www.npmjs.com/package/ios-deploy) to install the app; obviously the tool must be installed separately first and must be present in PATH before it could be used. |
40+
| `appium:appTimeZone` | Defines the custom time zone override for the application under test. You can use UTC, PST, EST, as well as place-based timezone names such as America/Los_Angeles. The application must be (re)launched for the capability to take effect. See the [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for more details. The same behavior could be achieved by providing a custom value to the [TZ](https://developer.apple.com/forums/thread/86951#263395) environment variable via the `appium:processArguments` capability | UTC |
4041

4142
### WebDriverAgent
4243

‎lib/desired-caps.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,10 @@ const desiredCapConstraints = /** @type {const} */ ({
369369
},
370370
appLaunchStateTimeoutSec: {
371371
isNumber: true,
372-
}
372+
},
373+
appTimeZone: {
374+
isString: true,
375+
},
373376
});
374377

375378
export {desiredCapConstraints, PLATFORM_NAME_IOS, PLATFORM_NAME_TVOS};

‎lib/driver.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1343,8 +1343,13 @@ export class XCUITestDriver extends BaseDriver {
13431343
}
13441344
}
13451345

1346+
if (util.hasValue(this.opts.appTimeZone)) {
1347+
// https://developer.apple.com/forums/thread/86951?answerId=263395022#263395022
1348+
env.TZ = this.opts.appTimeZone;
1349+
}
1350+
13461351
/** @type {import('appium-webdriveragent').WDACapabilities} */
1347-
const wdaCaps = /** @type {any} */ ({
1352+
const wdaCaps = {
13481353
bundleId: this.opts.autoLaunch === false ? undefined : bundleId,
13491354
arguments: args,
13501355
environment: env,
@@ -1366,7 +1371,7 @@ export class XCUITestDriver extends BaseDriver {
13661371
forceSimulatorSoftwareKeyboardPresence:
13671372
this.opts.forceSimulatorSoftwareKeyboardPresence ??
13681373
(this.opts.connectHardwareKeyboard === true ? false : true),
1369-
});
1374+
};
13701375
if (this.opts.autoAcceptAlerts) {
13711376
wdaCaps.defaultAlertAction = 'accept';
13721377
} else if (this.opts.autoDismissAlerts) {

0 commit comments

Comments
 (0)
Please sign in to comment.