emavgl / oinkoin

Oinkoin is a flutter app for helping you managing your expenses. No internet required.
GNU General Public License v3.0
156 stars 9 forks source link

Add Appium Integration for UI Test Automation #169

Open raulsorrentino opened 4 days ago

raulsorrentino commented 4 days ago

This pull request implements the proposal from issue #162 to add test automation using Appium. Previously, the project did not include any automated UI tests, and this PR introduces the necessary setup to integrate Appium into the project.

Key Features Added

  1. Appium Configuration:

    • Initial setup with configuration and constants files for seamless Appium integration.
    • Included Gradle wrapper files to ensure consistent Gradle versioning across environments.
  2. Updates to Dart Code:

    • Added Semantic Identifiers to key navigation and UI elements in the Flutter application.
    • These identifiers enhance accessibility and ensure reliable element targeting during UI testing.
  3. Page Object Model (POM) Implementation:

    • Structured the pages using Page Object Model (POM) and PageFactory for maintainability.
    • Centralized element management to simplify updates and increase code reuse.

Tests Added

Improvements and Refactoring

Limitations

Not all components of the app are covered by tests at this stage. Additional tests will be added in the future to increase test coverage, focusing on critical app components and functionality.

Fixes #162

emavgl commented 3 days ago

Hello, thanks for the PR and for the hard work. How are this test being executed?

raulsorrentino commented 3 days ago

Hello, thank you for the kind words! Here's a quick guide on how to execute these tests:

  1. Appium Server:
    Install Appium and UiAutomator2 Driver. Make sure the Appium server is running. You can start the server by typing appium in the terminal.

  2. Driver Configuration:
    Update the Constants class to match your setup:

    
    public class Constants {
       public static final String PLATFORM_NAME = "Android";
       public static final String PLATFORM_VERSION = "15";   // Adjust to your device/emulator version
       public static final String UDID = "your-device-id";   // Replace with your device/emulator ID
       public static final String APP_PACKAGE = "com.github.emavgl.piggybankpro";
       public static final String APP_PATH = "/path/to/your/apk/app-pro-debug.apk"; // Update with the APK location
       public static final String APPIUM_SERVER_URL = "http://127.0.0.1:4723";      // Appium server URL
    }
  3. Device/Emulator:
    Connect a device or start an emulator that matches the configuration specified in the Constants class.

  4. Test Execution:
    You can run the tests either directly from your IDE (by selecting the test class or method and pressing the run button) or by using Gradle.

Let me know if you need further clarification!