Skip to content

Commit

Permalink
fix: avoid WDA shutdown when running mobile: configureLocalization sc…
Browse files Browse the repository at this point in the history
  • Loading branch information
mwakizaka committed Nov 29, 2023
1 parent fa59d3d commit 94afb69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/execute-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,9 @@ remotePath | string | yes | Same value as for `mobile: deleteFile` except of the
Change localization settings on the currently booted Simulator.
The changed settings are only applied for the *newly started* applications/activities.
Currently running applications will stay unchanged. This means, for example, that the keyboard
should be hidden and shown again in order to observe the changed layout, and curresponding
should be hidden and shown again in order to observe the changed layout, and corresponding
apps must be restarted in order to observe their interface using the newly set locale/language.
Also this method might leave some system UI alerts untranslated.
Be careful while setting the actual arguments since their actual values are not strictly checked.
This could lead to an unexpected behavior if an incorrect/unsupported language or locale abbreviation is provided.

Expand Down
7 changes: 6 additions & 1 deletion lib/commands/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ export default {
async mobileConfigureLocalization(keyboard, language, locale) {
assertSimulator(this);

// Assign skipSyncUiDialogTranslation: true option in order to avoid shutting down the WDA session
const localizationOptions = {
language: language ? Object.assign(language, {skipSyncUiDialogTranslation: true}) : {},
locale, keyboard
};
return /** @type {boolean} */ (
// @ts-expect-error - do not assign arbitrary properties to `this.opts`
await this.opts.device.configureLocalization({language, locale, keyboard})
await this.opts.device.configureLocalization(localizationOptions)
);
},
};

0 comments on commit 94afb69

Please sign in to comment.