-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade appium solution #3876
Upgrade appium solution #3876
Conversation
…eApp and Terminate App + added option to control the started/closed App from the Mobile Action by entering the App Package (if not entered so using the default started App config)
WalkthroughThe changes introduced include modifications to the user interface for mobile device actions, enhancements to mouse interaction handling, and updates to method signatures for better control over mobile gestures. New properties and enumerations have been added, aiming to improve the functionality and responsiveness of the application in managing user interactions and mobile device actions. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MobileDriver
participant AppiumDriver
User->>MobileDriver: PerformAction(actionType)
MobileDriver->>AppiumDriver: ExecuteAction(actionType, parameters)
AppiumDriver->>AppiumDriver: HandleAction(actionType)
AppiumDriver-->>MobileDriver: ActionResult
MobileDriver-->>User: DisplayActionResult
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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: CHILL
Files selected for processing (13)
- Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml (2 hunks)
- Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml.cs (3 hunks)
- Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs (10 hunks)
- Ginger/Ginger/Ginger.csproj (1 hunks)
- Ginger/GingerCore/GingerCore.csproj (1 hunks)
- Ginger/GingerCoreCommon/GingerCoreCommon.csproj (1 hunks)
- Ginger/GingerCoreNET/ActionsLib/UI/Legacy/ActGenElement.cs (1 hunks)
- Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (2 hunks)
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (26 hunks)
- Ginger/GingerCoreNET/Drivers/DriversWindow/IMobileDriverWindow.cs (1 hunks)
- Ginger/GingerCoreNET/GingerCoreNET.csproj (2 hunks)
- Ginger/GingerPluginCore/GingerPluginCore.csproj (1 hunks)
- Ginger/GingerUtils/GingerUtils.csproj (1 hunks)
Files skipped from review due to trivial changes (4)
- Ginger/Ginger/Ginger.csproj
- Ginger/GingerCore/GingerCore.csproj
- Ginger/GingerCoreCommon/GingerCoreCommon.csproj
- Ginger/GingerUtils/GingerUtils.csproj
Additional context used
GitHub Check: Codacy Static Code Analysis
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs
[warning] 1507-1507: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1507
Return 'Task' instead.
[warning] 1559-1559: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1559
Return 'Task' instead.Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs
[warning] 673-673: Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs#L673
Remove this commented out code.
[warning] 683-683: Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs#L683
Remove this commented out code.
[warning] 965-965: Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs#L965
Remove this commented out code.
[notice] 3287-3287: Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs#L3287
Remove this unnecessary cast to 'TimeSpan'.
Additional comments not posted (40)
Ginger/GingerPluginCore/GingerPluginCore.csproj (1)
19-19
: LGTM! Verify compatibility with the new package version.The update to
System.Drawing.Common
version8.0.7
may include bug fixes, performance improvements, or new features. Ensure compatibility with the rest of the codebase.The code changes are approved.
Run the following script to verify compatibility:
Ginger/GingerCoreNET/Drivers/DriversWindow/IMobileDriverWindow.cs (3)
50-50
: LGTM! Verify implementations of the updated method.The addition of the optional
pressDuration
parameter enhances flexibility. Ensure that all implementations of this interface are updated accordingly.The code changes are approved.
Run the following script to verify implementations:
Verification successful
Implementation of
PerformLongPress
is consistent with the interface.The method in
GenericAppiumDriver.cs
correctly implements the interface methodPerformLongPress
with the optionalTimeSpan?
parameter, despite a difference in parameter naming (clickDuration
vs.pressDuration
). Ensure consistency in parameter naming if necessary for clarity.
GenericAppiumDriver.cs
: Implementation usesclickDuration
instead ofpressDuration
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify implementations of the updated method. # Test: Search for the method implementations. Expect: Only occurrences of the new signature. rg --type cs 'void PerformLongPress' -A 5Length of output: 1436
54-54
: LGTM! Verify implementations of the updated method.The addition of the
swipeScale
andswipeDuration
parameters allows for more nuanced swipe gestures. Ensure that all implementations of this interface are updated accordingly.The code changes are approved.
Run the following script to verify implementations:
Verification successful
Implementations Updated Correctly
The
PerformScreenSwipe
method has been updated with the new parametersswipeScale
andswipeDuration
in all relevant implementations. The changes have been correctly propagated across the codebase.
GenericAppiumDriver.cs
: Method implemented with the new signature.MobileDriverWindow.xaml.cs
: Method implemented with the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify implementations of the updated method. # Test: Search for the method implementations. Expect: Only occurrences of the new signature. rg --type cs 'void PerformScreenSwipe' -A 5Length of output: 1916
52-52
: LGTM! Verify implementations of the updated method.The addition of the
pressDuration
anddragDuration
parameters provides more control over the timing of the drag operation. Ensure that all implementations of this interface are updated accordingly.The code changes are approved.
Run the following script to verify implementations:
Verification successful
All implementations of
PerformDrag
are updated correctly.The
PerformDrag
method has been implemented inGenericAppiumDriver.cs
with the updated signature, and its usage inMobileDriverWindow.xaml.cs
is consistent with this update. No other implementations were found, confirming that the update is applied correctly throughout the codebase.
GenericAppiumDriver.cs
: Implementation matches the updated signature.MobileDriverWindow.xaml.cs
: Usage is consistent with the updated method signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify implementations of the updated method. # Test: Search for the method implementations. Expect: Only occurrences of the new signature. rg --type cs 'void PerformDrag' -A 5Length of output: 1415
Script:
#!/bin/bash # Description: Search for any other implementations of the PerformDrag method in the codebase. # Test: Look for any other occurrences of PerformDrag to ensure all implementations are updated. rg 'PerformDrag' -A 5Length of output: 2177
Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml (5)
15-15
: LGTM!The change to the
Width
property forxOperationNameComboBox
likely aims to enhance usability by providing more space for the displayed options.The code changes are approved.
59-62
: LGTM!The addition of the
xAppPnl
StackPanel enhances the functionality of the page by allowing users to input the application package.The code changes are approved.
64-67
: LGTM!The addition of the
xPressPnl
StackPanel enhances the functionality of the page by allowing users to input the press duration.The code changes are approved.
69-72
: LGTM!The addition of the
xDragPnl
StackPanel enhances the functionality of the page by allowing users to input the drag duration.The code changes are approved.
74-83
: LGTM!The addition of the
xSwipePnl
StackPanel enhances the functionality of the page by allowing users to input the swipe scale and duration.The code changes are approved.
Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml.cs (2)
69-74
: LGTM!The added initialization calls for
xAppPackageVE
,xPressDurationTxtBox
,xDragDurationTxtBox
,xSwipeScaleTxtBox
, andxSwipeDurationTxtBox
are correctly implemented.The code changes are approved.
Line range hint
206-263
: LGTM!The added cases for
DoubleTapXY
andLongPressXY
and the visibility adjustments forxAppPnl
,xPressPnl
,xDragPnl
, andxSwipePnl
are correctly implemented.The code changes are approved.
Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs (6)
170-181
: LGTM!The
ActionAppPackage
property is correctly implemented, enhancing the configurability of mobile actions.The code changes are approved.
183-194
: LGTM!The
PressDuration
property is correctly implemented, enhancing the configurability of mobile actions.The code changes are approved.
196-207
: LGTM!The
DragDuration
property is correctly implemented, enhancing the configurability of mobile actions.The code changes are approved.
209-220
: LGTM!The
SwipeScale
property is correctly implemented, enhancing the configurability of mobile actions.The code changes are approved.
222-233
: LGTM!The
SwipeDuration
property is correctly implemented, enhancing the configurability of mobile actions.The code changes are approved.
305-307
: LGTM!The new enum value
DoubleTapXY
is correctly added, expanding the set of available mobile actions.The code changes are approved.
Ginger/GingerCoreNET/ActionsLib/UI/Legacy/ActGenElement.cs (1)
618-621
: LGTM!The new enum values
DoubleTapElement
andPressElement
are correctly added, expanding the set of available actions.The code changes are approved.
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs (8)
661-661
: LGTM!The variable
mMoveStartTime
is correctly declared and initialized.The code changes are approved.
681-681
: LGTM!The code correctly sets
mMoveStartTime
to the current time.The code changes are approved.
725-741
: LGTM!The logic for calculating
pressDuration
anddragDuration
is correctly implemented. The additional parameters enhance the functionality of the drag and click actions.The code changes are approved.
755-759
: LGTM!The additional
swipeDuration
parameter enhances the functionality of the swipe actions.The code changes are approved.
1151-1176
: LGTM!The additional
swipeDuration
parameter enhances the functionality of the swipe actions.The code changes are approved.
Line range hint
1507-1523
: LGTM!The method signature update and the use of the
clickDuration
parameter in thePerformLongPress
method enhance the functionality of the click actions.The code changes are approved.
Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1507-1507: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1507
Return 'Task' instead.
Line range hint
1559-1571
: LGTM!The method signature update and the use of the
pressDuration
anddragDuration
parameters in thePerformDrag
method enhance the functionality of the drag actions.The code changes are approved.
Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1559-1559: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1559
Return 'Task' instead.
1644-1648
: LGTM!The method signature update and the use of the
swipeDuration
parameter enhance the functionality of the swipe actions.The code changes are approved.
Ginger/GingerCoreNET/GingerCoreNET.csproj (2)
239-239
: LGTM!The upgrade from
Appium.WebDriver
version5.0.0-rc.6
to5.1.0
is a good move as it transitions from a release candidate to a stable version, likely including bug fixes and new features.The code changes are approved.
336-336
: LGTM!The upgrade from
System.Drawing.Common
version8.0.1
to8.0.7
is a good move as it likely includes enhancements or fixes that could improve compatibility or performance.The code changes are approved.
Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (12)
56-58
: LGTM!The new imports are necessary for the interaction methods implemented in the file.
1439-1447
: LGTM!The
SwipeByXY
method is correctly implemented usingPointerInputDevice
andActionBuilder
.
1338-1346
: LGTM!The
TapXY
method is correctly implemented usingPointerInputDevice
andActionBuilder
.
1358-1369
: LGTM!The
DoubleTapXY
method is correctly implemented usingPointerInputDevice
andActionBuilder
.
1385-1394
: LGTM!The
PressXY
method is correctly implemented usingPointerInputDevice
andActionBuilder
.
Line range hint
2894-2909
: LGTM!The
PerformDrag
method is correctly implemented with additional parameters for press and drag durations.
Line range hint
1645-1684
: LGTM!The
SwipeScreen
method is correctly implemented with additional parameters for swipe scale and duration.
3279-3287
: LGTM!The
PerformScreenSwipe
method is correctly implemented with additional parameters for swipe scale and duration.Tools
GitHub Check: Codacy Static Code Analysis
[notice] 3287-3287: Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs#L3287
Remove this unnecessary cast to 'TimeSpan'.
Line range hint
965-1165
: LGTM!The
MobileDeviceActionHandler
method is correctly updated to call the new interaction methods.
1348-1356
: LGTM!The
TapElement
method is correctly implemented usingPointerInputDevice
andActionBuilder
.
1371-1382
: LGTM!The
DoubleTapElement
method is correctly implemented usingPointerInputDevice
andActionBuilder
.
1415-1424
: LGTM!The
PressElement
method is correctly implemented usingPointerInputDevice
andActionBuilder
.
@@ -1500,7 +1504,7 @@ | |||
} | |||
} | |||
|
|||
private async void DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false) | |||
private async void DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false, TimeSpan? clickDuration=null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider returning Task
instead of void
for asynchronous methods.
Returning Task
instead of void
for asynchronous methods allows for better error handling and composition.
Apply this diff to change the return type:
-private async void DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false, TimeSpan? clickDuration=null)
+private async Task DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false, TimeSpan? clickDuration=null)
-private async void DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration)
+private async Task DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration)
Also applies to: 1559-1559
Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1507-1507: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1507
Return 'Task' instead.
- added UFT external link button - changed behavior to stop mobile agent on close of mobile window - add buttons to zoom in and out- part1
…utomation/Ginger into Upgrade-Appium-Solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml (5 hunks)
- Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs (14 hunks)
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (48 hunks)
- Ginger/GingerCoreNET/Drivers/DriversWindow/IMobileDriverWindow.cs (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs
Additional comments not posted (12)
Ginger/GingerCoreNET/Drivers/DriversWindow/IMobileDriverWindow.cs (5)
30-31
: LGTM!The addition of the
IsUftLabDevice
property is clear and useful for indicating whether the device is a UFT Lab device.The code changes are approved.
52-52
: LGTM!The addition of the optional
pressDuration
parameter enhances the flexibility of thePerformLongPress
method.The code changes are approved.
54-54
: LGTM!The addition of the
pressDuration
anddragDuration
parameters enhances control over the drag operation.The code changes are approved.
56-56
: LGTM!The replacement of the
impact
parameter withswipeScale
and the addition of theswipeDuration
parameter provide more nuanced control over swipe gestures.The code changes are approved.
68-69
: LGTM!The addition of the
OpenDeviceExternalView
method enhances the functionality for interacting with the device's external view.The code changes are approved.
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml (7)
8-8
: LGTM!The changes to the
WindowStyle
andResizeMode
properties enhance the window's appearance and resizing behavior.The code changes are approved.
99-99
: LGTM!The change to the
Margin
attribute of thexCordBtn
button is acceptable and may improve its positioning within the grid layout.The code changes are approved.
100-100
: LGTM!The change to the
Margin
attribute of thexSwipeBtn
button is acceptable and may improve its positioning within the grid layout.The code changes are approved.
101-101
: LGTM!The change to the
Margin
attribute of thexPortraiteBtn
button is acceptable and may improve its positioning within the grid layout.The code changes are approved.
102-102
: LGTM!The change to the
Margin
attribute of thexLandscapeBtn
button is acceptable and may improve its positioning within the grid layout.The code changes are approved.
112-112
: LGTM!The addition of the
xExternalViewBtn
button enhances the functionality for opening the device's external view.The code changes are approved.
214-216
: LGTM!The addition of the
xZoomInBtn
andxZoomOutBtn
buttons enhances the functionality by providing zooming capabilities.The code changes are approved.
There was a problem hiding this comment.
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: CHILL
Files selected for processing (2)
- Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml (7 hunks)
- Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs (15 hunks)
Additional context used
GitHub Check: Codacy Static Code Analysis
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs
[warning] 1055-1055: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1055
Remove this commented out code.
[warning] 1510-1510: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1510
Return 'Task' instead.
[warning] 1562-1562: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1562
Return 'Task' instead.
Additional comments not posted (17)
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml (5)
7-8
: LGTM!The changes to the
Title
andWindowStyle
properties are approved.
11-11
: LGTM!The change to the
Background
property of theGrid
namedxWindowGrid
is approved.
Line range hint
27-60
: LGTM!The reformatting of the
TabControl
andTabItem
elements improves readability without altering the functionality. The changes are approved.
75-76
: LGTM!The adjustment to the
StackPanel
containing theTabControl
is approved. The overall layout logic is preserved.
97-100
: Verify the event handlers and logic for the new buttons.Several new buttons have been added to the user interface:
xCordBtn
: Show Mouse CoordinatesxSwipeBtn
: Perform SwipexPortraiteBtn
: Switch to PortraitxLandscapeBtn
: Switch to LandscapexExternalViewBtn
: Open Device External ViewxZoomInBtn
: Zoom InxZoomOutBtn
: Zoom OutPlease ensure that the corresponding event handlers (
xCordBtn_Click
,xSwipeBtn_Click
,xOrientationBtn_Click
,xExternalViewBtn_Click
,xZoomInBtn_Click
,xZoomOutBtn_Click
) and the associated logic are implemented correctly in the code-behind file.Also applies to: 110-110, 212-215
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs (12)
235-238
: LGTM!The code changes are approved.
665-665
: LGTM!The code changes are approved.
685-685
: LGTM!The code changes are approved.
729-730
: LGTM!The code changes are approved.
735-737
: LGTM!The code changes are approved.
741-745
: LGTM!The code changes are approved.
759-763
: LGTM!The code changes are approved.
1051-1067
: LGTM!The code changes are approved.
Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1055-1055: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1055
Remove this commented out code.
1153-1178
: LGTM!The code changes are approved.
1647-1651
: LGTM!The code changes are approved.
1737-1773
: LGTM!The code changes are approved.
1510-1510
: Consider returningTask
instead ofvoid
for asynchronous methods.Returning
Task
instead ofvoid
for asynchronous methods allows for better error handling and composition.Apply this diff to change the return type:
-private async void DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false, TimeSpan? clickDuration=null) +private async Task DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false, TimeSpan? clickDuration=null)Likely invalid or redundant comment.
Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1510-1510: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1510
Return 'Task' instead.
@@ -1552,7 +1559,7 @@ | |||
} | |||
} | |||
|
|||
private async void DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint) | |||
private async void DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider returning Task
instead of void
for asynchronous methods.
Returning Task
instead of void
for asynchronous methods allows for better error handling and composition.
Apply this diff to change the return type:
-private async void DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration)
+private async Task DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration)
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.
private async void DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration) | |
private async Task DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration) |
Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1562-1562: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1562
Return 'Task' instead.
{ | ||
if (DevicePlatformType == eDevicePlatformType.Android) | ||
{ | ||
appPackage = AppiumCapabilities.Where(x => x.Parameter == "appPackage" || x.Parameter == "appium:appPackage").FirstOrDefault().Value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Find if its list or FirstOrDefault instead of where e.g. AppiumCapabilities.FirstOrDefault(x => x.Parameter == "appPackage" || x.Parameter == "appium:appPackage").Value;
} | ||
else | ||
{ | ||
appPackage = AppiumCapabilities.Where(x => x.Parameter == "bundleId" || x.Parameter == "appium:bundleId").FirstOrDefault().Value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use FirstOrDefault or Find
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs (15 hunks)
- Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (48 hunks)
Additional context used
GitHub Check: Codacy Static Code Analysis
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs
[warning] 1507-1507: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1507
Return 'Task' instead.
[warning] 1559-1559: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1559
Return 'Task' instead.
Additional comments not posted (28)
Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs (19)
235-238
: LGTM!The code changes are approved.
665-666
: LGTM!The code changes are approved.
685-686
: LGTM!The code changes are approved.
729-737
: LGTM!The code changes are approved.
741-745
: LGTM!The code changes are approved.
759-760
: LGTM!The code changes are approved.
763-764
: LGTM!The code changes are approved.
1051-1064
: LGTM!The code changes are approved.
1150-1151
: LGTM!The code changes are approved.
1155-1156
: LGTM!The code changes are approved.
1160-1161
: LGTM!The code changes are approved.
1165-1166
: LGTM!The code changes are approved.
1170-1171
: LGTM!The code changes are approved.
1175-1176
: LGTM!The code changes are approved.
1214-1215
: LGTM!The code changes are approved.
1251-1252
: LGTM!The code changes are approved.
1523-1524
: LGTM!The code changes are approved.
1507-1508
: Consider returningTask
instead ofvoid
for asynchronous methods.Returning
Task
instead ofvoid
for asynchronous methods allows for better error handling and composition.Apply this diff to change the return type:
-private async void DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false, TimeSpan? clickDuration=null) +private async Task DeviceScreenshotImageMouseClickAsync(System.Windows.Point clickedPoint, bool performLongPress = false, TimeSpan? clickDuration=null)Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1507-1507: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1507
Return 'Task' instead.
1559-1560
: Consider returningTask
instead ofvoid
for asynchronous methods.Returning
Task
instead ofvoid
for asynchronous methods allows for better error handling and composition.Apply this diff to change the return type:
-private async void DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration) +private async Task DeviceScreenshotImageMouseDragAsync(System.Windows.Point startPoint, System.Windows.Point endPoint, TimeSpan pressDuration, TimeSpan dragDuration)Tools
GitHub Check: Codacy Static Code Analysis
[warning] 1559-1559: Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs#L1559
Return 'Task' instead.Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs (9)
176-189
: The newIsUftLabDevice
property looks good!It correctly returns true if the
DeviceSource
isMicroFoucsUFTMLab
, false otherwise.
411-411
: Handling "platformVersion" capability looks good.The change allows setting the platform version capability via
driverOptions.PlatformVersion
which is important for mobile testing scenarios.
1010-1029
: The new mobile device actions for swipe gestures look great!The actions
SwipeByCoordinates
,SwipeDown
,SwipeUp
,SwipeLeft
,SwipeRight
enhance the mobile testing capabilities. They are properly implemented using theSwipeByXY
andSwipeScreen
methods under the hood.
Line range hint
1661-1698
: The updates to theSwipeScreen
method look great!Adding the
swipeScale
andswipeDuration
parameters enhances the flexibility of performing swipe actions. The swipe end point calculations based on theswipeScale
factor appear to be correct.
1354-1410
: The newTapXY
,DoubleTapXY
, andPressXY
methods look great!These methods provide a clean and efficient way to perform tap, double-tap, and press actions at specific coordinates. Using the
PointerInputDevice
andActionBuilder
classes aligns with Appium's recommended approach for touch actions. The implementations appear to be correct and follow best practices.
3378-3406
: The newOpenDeviceExternalView
method is a nice addition!It provides a convenient way to open the device's external view in a browser. The URL construction logic, using the Appium server details and the device UDID, appears to be correct. Launching the browser with the constructed URL is properly implemented.
Line range hint
3295-3326
: The updates to thePerformScreenSwipe
method look good!The method now utilizes the enhanced
SwipeScreen
method, passing theswipeScale
andswipeDuration
parameters for better control over the swipe action. The recording logic is properly implemented, creating an appropriateActMobileDevice
action based on the swipe side and capturing the relevant details.
Line range hint
3378-3538
: The new device information retrieval methods are a valuable addition!Methods like
GetDeviceCPUInfo
,GetDeviceMemoryInfo
,GetDeviceNetworkInfo
,GetDeviceBatteryInfo
, andGetDeviceGeneralInfo
provide useful capabilities to access various device details. Utilizing the Appium'sExecuteScript
command is the correct approach to retrieve this information. The method implementations appear to be clean and efficient.
3378-3406
: The newOpenDeviceSettings
method is a handy addition!It provides a convenient way to programmatically open the device settings. The implementation handles both Android and iOS devices appropriately. For Android, using the
PressKeyCode
method with the settings key code is the correct approach. For iOS, using theActivateApp
method to open the settings app is the right way. The implementation follows platform-specific best practices.
Thank you for your contribution.
Before submitting this PR, please make sure:
Summary by CodeRabbit
New Features
Improvements
Bug Fixes