Skip to content

Added New Operation In Mobile Device Action#4326

Merged
Maheshkale447 merged 4 commits into
Releases/Official-Releasefrom
Feature/SetGeoLocationForMobileAction
Oct 10, 2025
Merged

Added New Operation In Mobile Device Action#4326
Maheshkale447 merged 4 commits into
Releases/Official-Releasefrom
Feature/SetGeoLocationForMobileAction

Conversation

@prashelke

@prashelke prashelke commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Set Geo Location

Thank you for your contribution.
Before submitting this PR, please make sure:

  • PR description and commit message should describe the changes done in this PR
  • Verify the PR is pointing to correct branch i.e. Release or Beta branch if the code fix is for specific release , else point it to master
  • Latest Code from master or specific release branch is merged to your branch
  • No unwanted\commented\junk code is included
  • No new warning upon build solution
  • Code Summary\Comments are added to my code which explains what my code is doing
  • Existing unit test cases are passed
  • New Unit tests are added for your development
  • Sanity Tests are successfully executed for New and Existing Functionality
  • Verify that changes are compatible with all relevant browsers and platforms.
  • After creating pull request there should not be any conflicts
  • Resolve all Codacy comments
  • Builds and checks are passed before PR is sent for review
  • Resolve code review comments
  • Update the Help Library document to match any feature changes

Summary by CodeRabbit

  • New Features
    • Add ability to set device GPS location (Latitude, Longitude, Altitude) from the Mobile Device action.
    • New collapsible “Device Location” section appears under rotation settings when selecting “Set Device Location”; collapsed by default.
    • Runtime support for applying location to Android and iOS drivers for location-based testing, with input validation for coordinates.

@coderabbitai

coderabbitai Bot commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a SetDeviceLocation action: introduces Latitude/Longitude/Altitude properties on ActMobileDevice, adds a collapsed UI panel with three UCValueExpression fields to ActMobileDeviceEditPage, and implements GenericAppiumDriver.SetDeviceLocation to apply GPS location via Appium.

Changes

Cohort / File(s) Summary of Changes
Mobile Device Edit UI
Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml
Adds collapsed panel xDeviceLoactioPnl containing three UCValueExpression controls (xLatitudeTxtBox, xLongitudeTxtBox, xAltitudeTxtBox) for Latitude/Longitude/Altitude, placed under rotation controls and before the multi-touch grid.
Mobile Device Edit Code-Behind
Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml.cs
Binds the three new controls to mAct.Latitude, mAct.Longitude, mAct.Altitude; sets xDeviceLoactioPnl.Visibility collapsed by default and shows it when action SetDeviceLocation is selected.
Core Action Model
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs
Adds public input properties Latitude, Longitude, Altitude (via GetOrCreateInputParam / AddOrUpdateInputParamValue) and adds SetDeviceLocation to eMobileDeviceAction.
Appium Driver Integration
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs
Adds public void SetDeviceLocation(ActMobileDevice act) to validate/parse coordinates and set a Location on AndroidDriver/IOSDriver; updates MobileDeviceActionHandler to handle SetDeviceLocation; standardizes returned location keys capitalization; adds System.Globalization usage.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as ActMobileDeviceEditPage
  participant Act as ActMobileDevice
  participant Driver as GenericAppiumDriver
  participant Appium as AndroidDriver/IOSDriver

  User->>UI: Select "SetDeviceLocation"
  UI->>UI: Reveal xDeviceLoactioPnl (lat/long/alt)
  User->>UI: Enter Latitude/Longitude/Altitude
  UI->>Act: Bind values to properties

  Note over Act,Driver: Execution
  Act->>Driver: Execute(SetDeviceLocation)
  Driver->>Driver: Validate & parse inputs (culture-invariant)
  alt Valid inputs & supported driver
    Driver->>Appium: Set location (lat,long,alt)
    Appium-->>Driver: Success
    Driver-->>Act: Complete
  else Invalid inputs or unsupported driver
    Driver-->>Act: Throw/return error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Maheshkale447

Poem

I hop to new coordinates, whee!
Latitude, Longitude, Altitude—three.
A hidden panel opens, tidy and small,
Appium sets the spot, I bounce with a call.
Carrot compass—device finds its hall. 🥕🧭

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only includes the contributor checklist and a brief “Set Geo Location” line, without any summary of the actual changes, motivations, or testing details. It does not follow the repository’s template which expects a clear description of what was changed, why, and how to verify it. Without substantive content, reviewers cannot assess the scope or impact of this PR. Please replace the checklist placeholder with completed sections from the template, including a detailed summary of the changes (e.g., adding latitude/longitude/altitude properties and UI), target branch confirmation, testing performed, and any documentation updates to ensure the description fully explains the PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The current title “Added New Operation In Mobile Device Action” is overly generic and does not specify which operation was added, making it hard to quickly understand the main feature of the pull request. Although it indicates a new operation in the mobile device action, it fails to highlight that this operation enables setting geo‐location parameters. A more descriptive title would improve clarity for reviewers scanning the history. Please update the title to clearly reflect the specific change, for example “Add Set Geo Location operation to Mobile Device Action,” so the main purpose of the PR is immediately apparent.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Feature/SetGeoLocationForMobileAction

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce2f7a1 and babd561.

📒 Files selected for processing (4)
  • Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml (1 hunks)
  • Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml.cs (3 hunks)
  • Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2 hunks)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2)
Ginger/GingerCoreCommon/Actions/Act.cs (1)
  • AddOrUpdateInputParamValue (828-851)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (1)
  • SetDeviceLocation (5492-5527)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (2)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (1)
  • ActMobileDevice (30-733)
Ginger/GingerCoreCommon/Actions/Act.cs (1)
  • AddOrUpdateReturnParamActual (1308-1335)
Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml.cs (2)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (1)
  • ActMobileDevice (30-733)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (2)
  • ActMobileDevice (2077-2087)
  • SetDeviceLocation (5492-5527)

Comment thread Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between babd561 and 952340b.

📒 Files selected for processing (2)
  • Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2 hunks)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2)
Ginger/GingerCoreCommon/Actions/Act.cs (1)
  • AddOrUpdateInputParamValue (828-851)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (1)
  • SetDeviceLocation (5493-5556)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (2)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (1)
  • ActMobileDevice (30-733)
Ginger/GingerCoreCommon/Actions/Act.cs (1)
  • AddOrUpdateReturnParamActual (1308-1335)
🔇 Additional comments (3)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (1)

620-622: Enum addition looks good

New SetDeviceLocation action is well-named and documented.

Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (2)

61-61: Import addition is appropriate

Using CultureInfo is correct for invariant numeric parsing.


1570-1573: Handler wiring looks correct

Switch case correctly invokes SetDeviceLocation(act).

Comment thread Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs
Comment thread Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 952340b and 2574ee8.

📒 Files selected for processing (2)
  • Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2 hunks)
  • Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2)
Ginger/GingerCoreCommon/Actions/Act.cs (1)
  • AddOrUpdateInputParamValue (828-851)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (1)
  • SetDeviceLocation (5493-5564)
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (2)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (1)
  • ActMobileDevice (30-733)
Ginger/GingerCoreCommon/Actions/Act.cs (1)
  • AddOrUpdateReturnParamActual (1308-1335)
🔇 Additional comments (4)
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2)

370-381: Altitude optional default looks good

Empty default aligns with optional semantics and driver behavior (defaults to 0).


620-621: Enum addition LGTM

SetDeviceLocation action added with clear description.

Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (2)

1570-1572: Switch case wiring LGTM

Action routes correctly to SetDeviceLocation(act).


5493-5564: SetDeviceLocation implementation looks solid

Null checks, invariant parsing, range validation, optional altitude, and driver assignment are correct.

Comment on lines +344 to +355
public ActInputValue Latitude
{
get
{
return GetOrCreateInputParam(nameof(Latitude),"0");
}
set
{
AddOrUpdateInputParamValue(nameof(Latitude), value.ToString());
OnPropertyChanged(nameof(Latitude));
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid defaulting Latitude to "0"; use empty to force explicit input

Default "0" makes a no-op action set location to (0,0). Prefer empty default so missing input fails early and doesn’t silently relocate the device.

Apply this diff:

-                return GetOrCreateInputParam(nameof(Latitude),"0");
+                return GetOrCreateInputParam(nameof(Latitude), "");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public ActInputValue Latitude
{
get
{
return GetOrCreateInputParam(nameof(Latitude),"0");
}
set
{
AddOrUpdateInputParamValue(nameof(Latitude), value.ToString());
OnPropertyChanged(nameof(Latitude));
}
}
public ActInputValue Latitude
{
get
{
return GetOrCreateInputParam(nameof(Latitude), "");
}
set
{
AddOrUpdateInputParamValue(nameof(Latitude), value.ToString());
OnPropertyChanged(nameof(Latitude));
}
}
🤖 Prompt for AI Agents
In Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs around lines 344
to 355, the Latitude getter currently defaults the input param to "0" which can
silently move the device to (0,0); change the default value passed to
GetOrCreateInputParam from "0" to an empty string ("") so the parameter is empty
by default and forces explicit input/validation upstream; keep the setter as-is
and ensure any callers/validation now treat an empty string as missing input.

Comment on lines +357 to +368
public ActInputValue Longitude
{
get
{
return GetOrCreateInputParam(nameof(Longitude),"0");
}
set
{
AddOrUpdateInputParamValue(nameof(Longitude), value.ToString());
OnPropertyChanged(nameof(Longitude));
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid defaulting Longitude to "0"; use empty to force explicit input

Same rationale as Latitude: prevent unintended relocation to (0,0) when left blank.

Apply this diff:

-                return GetOrCreateInputParam(nameof(Longitude),"0");
+                return GetOrCreateInputParam(nameof(Longitude), "");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public ActInputValue Longitude
{
get
{
return GetOrCreateInputParam(nameof(Longitude),"0");
}
set
{
AddOrUpdateInputParamValue(nameof(Longitude), value.ToString());
OnPropertyChanged(nameof(Longitude));
}
}
public ActInputValue Longitude
{
get
{
return GetOrCreateInputParam(nameof(Longitude), "");
}
set
{
AddOrUpdateInputParamValue(nameof(Longitude), value.ToString());
OnPropertyChanged(nameof(Longitude));
}
}
🤖 Prompt for AI Agents
In Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs around lines 357
to 368, the Longitude property getter currently defaults to "0" which can
unintentionally relocate to (0,0); change the default value in
GetOrCreateInputParam from "0" to an empty string ("") so Longitude is blank
unless explicitly provided (mirror the Latitude behavior), leaving the setter
unchanged and ensuring OnPropertyChanged is still called.

Comment on lines +5411 to 5413
act.AddOrUpdateReturnParamActual("Latitude", location.Latitude.ToString());
act.AddOrUpdateReturnParamActual("Longitude", location.Longitude.ToString());
act.AddOrUpdateReturnParamActual("Altitude", location.Altitude.ToString());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Use invariant ToString for numeric return values

Avoid locale-specific commas/periods in outputs.

Apply this diff:

-                act.AddOrUpdateReturnParamActual("Latitude",  location.Latitude.ToString());
-                act.AddOrUpdateReturnParamActual("Longitude", location.Longitude.ToString());
-                act.AddOrUpdateReturnParamActual("Altitude", location.Altitude.ToString());
+                act.AddOrUpdateReturnParamActual("Latitude",  location.Latitude.ToString(CultureInfo.InvariantCulture));
+                act.AddOrUpdateReturnParamActual("Longitude", location.Longitude.ToString(CultureInfo.InvariantCulture));
+                act.AddOrUpdateReturnParamActual("Altitude", location.Altitude.ToString(CultureInfo.InvariantCulture));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
act.AddOrUpdateReturnParamActual("Latitude", location.Latitude.ToString());
act.AddOrUpdateReturnParamActual("Longitude", location.Longitude.ToString());
act.AddOrUpdateReturnParamActual("Altitude", location.Altitude.ToString());
act.AddOrUpdateReturnParamActual("Latitude", location.Latitude.ToString(CultureInfo.InvariantCulture));
act.AddOrUpdateReturnParamActual("Longitude", location.Longitude.ToString(CultureInfo.InvariantCulture));
act.AddOrUpdateReturnParamActual("Altitude", location.Altitude.ToString(CultureInfo.InvariantCulture));
🤖 Prompt for AI Agents
In Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs
around lines 5411 to 5413, the code calls ToString() on numeric location values
which can produce locale-specific formatting; change these calls to use
invariant culture (e.g.,
location.Latitude.ToString(CultureInfo.InvariantCulture) or
location.Latitude.ToString("G", CultureInfo.InvariantCulture)) for Latitude,
Longitude, and Altitude and add a using System.Globalization; directive if it’s
not already present so the outputs are culture-invariant.

@Maheshkale447
Maheshkale447 merged commit 7e4594d into Releases/Official-Release Oct 10, 2025
16 of 17 checks passed
@Maheshkale447
Maheshkale447 deleted the Feature/SetGeoLocationForMobileAction branch October 10, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants