Skip to content

Conversation

mialeska
Copy link
Contributor

Execute script and Android startActivity action
Update Selenium reference to v.4.34.0
Update license year

@mialeska mialeska self-assigned this Jul 24, 2025
@mialeska mialeska added enhancement New feature or request java dependencies Pull requests that update a dependency file labels Jul 24, 2025
Copy link

coderabbitai bot commented Jul 24, 2025

Walkthrough

This update introduces new abstractions and implementations for Android activity management, centralizes script execution logic in the application layer, and adds related logging and localization entries. Dependency and pipeline configuration versions are updated. The test code is refactored to use the new Android actions abstraction, and minor updates are made to the license and localization files.

Changes

File(s) Change Summary
LICENSE Copyright year updated from 2024 to 2025.
azure-pipelines.yml Upgraded SonarCloud and Maven task versions; changed task inputs and execution parameters.
pom.xml Updated aquality-selenium-core to 4.7.0 and commons-lang3 to 3.18.0.
src/main/resources/localization/be.json
src/main/resources/localization/en.json
src/main/resources/localization/pl.json
src/main/resources/localization/ru.json
src/main/resources/localization/uk.json
Added two new localization entries for script execution and result reporting in each language file.
src/main/java/aquality/appium/mobile/actions/IAndroidActions.java Introduced new interface for Android activity actions with overloaded and default methods.
src/main/java/aquality/appium/mobile/actions/AndroidActions.java Added implementation of IAndroidActions with logic to start Android activities.
src/main/java/aquality/appium/mobile/actions/IActionsModule.java Added default method to provide Android actions implementation class.
src/main/java/aquality/appium/mobile/application/Application.java Added generic executeScript method with logging and retry logic; refactored getId() to use it.
src/main/java/aquality/appium/mobile/application/IMobileApplication.java Added generic script execution methods to the interface (with and without parameters).
src/main/java/aquality/appium/mobile/application/AqualityServices.java Added static method to obtain IAndroidActions instance from the DI container.
src/main/java/aquality/appium/mobile/application/MobileModule.java Added binding for IAndroidActions to its implementation in the DI module.
src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java Refactored to use AqualityServices.getAndroidActions().startActivity() instead of manual script execution.

Sequence Diagram(s)

sequenceDiagram
    participant TestCode as AndroidScreen (Test)
    participant Services as AqualityServices
    participant Actions as AndroidActions
    participant App as Application

    TestCode->>Services: getAndroidActions()
    Services->>Actions: (resolve via DI)
    TestCode->>Actions: startActivity(appPackage, appActivity, stopApp)
    Actions->>App: executeScript("mobile: startActivity", params)
    App->>App: log execution, retry logic
    App->>Actions: return result
    Actions->>TestCode: wait until activity matches, else throw error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Poem

In the warren where Android hops,
New actions leap and script flow pops.
With logging bright and bindings neat,
Activities start without defeat.
Pipelines fresher, versions new,
The codebase blooms—a garden view!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/execute-script

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (3)
src/main/resources/localization/ru.json (1)

16-17: Same placeholder-numbering nitpick as in the EN bundle
See comment in en.json. Harmonising formatting rules will save future localisation effort.

src/main/resources/localization/be.json (1)

16-17: Same placeholder-numbering nitpick as in the EN bundle
See comment in en.json. Harmonising formatting rules will save future localisation effort.

src/main/resources/localization/uk.json (1)

16-17: Same placeholder-numbering nitpick as in the EN bundle
See comment in en.json. Harmonising formatting rules will save future localisation effort.

🧹 Nitpick comments (4)
src/main/resources/localization/en.json (1)

16-17: Consider using numbered placeholders for consistency across the resource bundle

Most entries that accept parameters rely on numbered specifiers (%1$s, %2$s) to guard against argument-order differences between languages.
Staying consistent reduces the risk of localisation bugs when translators reorder placeholders.

-  "loc.application.execute.script": "Executing script '%s'",
-  "loc.application.script.result": "Script result: '%s'",
+  "loc.application.execute.script": "Executing script '%1$s'",
+  "loc.application.script.result": "Script result: '%1$s'",

Not mandatory, but worth aligning before these keys are consumed widely.

src/main/java/aquality/appium/mobile/application/Application.java (2)

108-119: LGTM: Solid implementation with minor suggestion for clarity.

The executeScript implementation is well-structured with proper retry logic and logging. The conditional result logging is a nice touch.

Minor suggestion for improved readability:

-            String argsString = params == null || params.isEmpty() ? "" : ", " + params;
+            String argsString = (params == null || params.isEmpty()) ? "" : ", " + params;

The extra parentheses make the boolean logic clearer.


128-128: Consider using empty map instead of null for consistency.

While this works correctly, passing Collections.emptyMap() instead of null would be more consistent with the interface's default method implementation and clearer in intent.

-            Map<String, Object> result = executeScript(iosExtName, null);
+            Map<String, Object> result = executeScript(iosExtName, Collections.emptyMap());
src/main/java/aquality/appium/mobile/actions/AndroidActions.java (1)

11-11: Consider adding input parameter validation.

The method doesn't validate that appPackage and appActivity are not null or empty, which could lead to runtime issues.

+        if (appPackage == null || appPackage.trim().isEmpty()) {
+            throw new IllegalArgumentException("appPackage cannot be null or empty");
+        }
+        if (appActivity == null || appActivity.trim().isEmpty()) {
+            throw new IllegalArgumentException("appActivity cannot be null or empty");
+        }
         AqualityServices.getLocalizedLogger().info("loc.application.android.activity.start", appPackage, appActivity);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8f8f93 and f9212a4.

📒 Files selected for processing (16)
  • LICENSE (1 hunks)
  • azure-pipelines.yml (1 hunks)
  • pom.xml (2 hunks)
  • src/main/java/aquality/appium/mobile/actions/AndroidActions.java (1 hunks)
  • src/main/java/aquality/appium/mobile/actions/IActionsModule.java (1 hunks)
  • src/main/java/aquality/appium/mobile/actions/IAndroidActions.java (1 hunks)
  • src/main/java/aquality/appium/mobile/application/Application.java (1 hunks)
  • src/main/java/aquality/appium/mobile/application/AqualityServices.java (2 hunks)
  • src/main/java/aquality/appium/mobile/application/IMobileApplication.java (2 hunks)
  • src/main/java/aquality/appium/mobile/application/MobileModule.java (2 hunks)
  • src/main/resources/localization/be.json (1 hunks)
  • src/main/resources/localization/en.json (1 hunks)
  • src/main/resources/localization/pl.json (1 hunks)
  • src/main/resources/localization/ru.json (1 hunks)
  • src/main/resources/localization/uk.json (1 hunks)
  • src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/main/java/aquality/appium/mobile/actions/AndroidActions.java (1)
src/main/java/aquality/appium/mobile/application/AqualityServices.java (1)
  • AqualityServices (15-213)
src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java (1)
src/main/java/aquality/appium/mobile/application/AqualityServices.java (1)
  • AqualityServices (15-213)
🔇 Additional comments (15)
LICENSE (1)

189-189: Confirm license year consistency across the codebase

I ran an automated search for any occurrences of

Copyright 20[0-9]{2} Aquality Automation 

outside of LICENSE and found no mismatches—suggesting all headers are already at 2025. To be absolutely sure, please manually verify by running:

rg -n "Copyright 20[0-9]{2} Aquality Automation" --glob "!LICENSE" | grep -v "2025"
pom.xml (1)

187-187: Verify downstream compatibility for upgraded core & test libraries

aquality-selenium-core → 4.7.0 and commons-lang3 → 3.18.0 look like safe minor bumps, but they may introduce API deprecations or tightened transitive‐dependency ranges.

Please:

  1. Run the full CI (unit + integration) on a clean workspace.
  2. Check for warnings about removed/deprecated methods (e.g. RandomStringUtils changes in recent commons-lang3).
  3. Confirm that the updated core still aligns to the new Selenium 4.34.0 version declared elsewhere in the PR.

No changes required if everything compiles and tests green.

Also applies to: 206-206

src/main/resources/localization/pl.json (1)

16-17: LGTM - Localization entries are properly formatted and positioned.

The new Polish localization entries for script execution logging follow the established naming conventions and formatting patterns. The translations are appropriately placed after other application-related entries.

src/main/java/aquality/appium/mobile/application/MobileModule.java (2)

4-4: Import added correctly for new Android actions interface.

The import for IAndroidActions is properly added to support the new binding.


35-35: DI binding follows established pattern.

The binding for IAndroidActions to its implementation follows the same pattern as other action bindings in the module and is positioned logically after the touch actions binding.

src/main/java/aquality/appium/mobile/actions/IActionsModule.java (1)

17-22: Well-structured addition following established patterns.

The new getAndroidActionsImplementation() method follows the exact same pattern as the existing getTouchActionsImplementation() method, including proper JavaDoc documentation and consistent naming conventions.

src/main/java/aquality/appium/mobile/application/AqualityServices.java (2)

3-3: Import correctly added for Android actions interface.

The import for IAndroidActions is properly positioned and supports the new service accessor method.


205-212: Service accessor method follows established patterns.

The new getAndroidActions() method maintains consistency with other service accessor methods in the class, including proper JavaDoc documentation and using the generic get() method for dependency resolution.

src/test/java/samples/android/nativeapp/apidemos/screens/AndroidScreen.java (1)

15-15: Confirm startActivity signature in AqualityServices

I couldn’t locate the startActivity(String, String, boolean) implementation in the repo, so please verify in the AqualityServices library that:

  • AqualityServices.getAndroidActions().startActivity(...) indeed accepts (String appPackage, String appActivity, boolean flag)
  • The false flag preserves the original behavior
src/main/java/aquality/appium/mobile/application/IMobileApplication.java (2)

11-12: LGTM: Well-designed import additions.

The new imports for Collections and Map are correctly added to support the new script execution methods.


68-83: LGTM: Excellent interface design for script execution.

The new executeScript methods follow Java best practices:

  • Generic return type <T> provides type flexibility
  • Clear parameter naming and documentation
  • Default method appropriately delegates to the main implementation with an empty map
  • Method signatures are intuitive and consistent with the existing interface style

This provides a clean abstraction for script execution functionality.

azure-pipelines.yml (2)

12-12: LGTM: Task version upgrades improve pipeline robustness.

The upgrades to SonarCloud tasks (v1→v3) and Maven task (v3→v4) bring latest features and security improvements. The explicit JDK specification and polling timeout are good additions.

Also applies to: 21-21, 35-35, 41-41


29-29: Verify JDK version format consistency.

The JDK version changed from '11' to '1.11' in the sonar job, but remains '11' in the test job. Ensure this format difference is intentional and compatible with the newer Maven task version.

src/main/java/aquality/appium/mobile/actions/AndroidActions.java (1)

12-17: LGTM: Well-structured activity start implementation.

The logging, parameter construction, and script execution are well-implemented. The intent string formatting follows Android conventions.

src/main/java/aquality/appium/mobile/actions/IAndroidActions.java (1)

5-36: LGTM: Excellent interface design for Android actions.

This interface demonstrates excellent design principles:

  • Clear, comprehensive documentation for all methods
  • Logical method overloading providing convenience while maintaining flexibility
  • Sensible default behavior (stopping current app when starting new activity)
  • Proper separation between convenience methods and core functionality
  • Clean delegation pattern in default methods

The interface provides a clean abstraction for Android-specific actions while maintaining type safety and usability.

@github-project-automation github-project-automation bot moved this from In progress to Review in progress in Aquality Appium Mobile Jul 24, 2025
@mialeska mialeska merged commit d5ef515 into master Jul 25, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Review in progress to Done in Aquality Appium Mobile Jul 25, 2025
@mialeska mialeska deleted the feature/execute-script branch July 25, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request java

Projects

Development

Successfully merging this pull request may close these issues.

2 participants