Skip to content
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

patrol test: Uninstalling the app after the test was run #816

Closed
Tracked by #788
bartekpacia opened this issue Jan 26, 2023 · 7 comments · Fixed by #848 or #875
Closed
Tracked by #788

patrol test: Uninstalling the app after the test was run #816

bartekpacia opened this issue Jan 26, 2023 · 7 comments · Fixed by #848 or #875
Labels
feature New feature request package: patrol_cli Related to the patrol_cli package

Comments

@bartekpacia
Copy link
Contributor

bartekpacia commented Jan 26, 2023

To uninstall an app, we need to know its package name / bundle ID.

The easiest way to accomplish this is to ask the user to specify these values in pubspec.yaml:

Example

# pubspec.yaml

dependencies:
  bloc: ^7.2.0
  # ...

dev_dependencies:
  patrol: ^1.0.0
  # ...

patrol:
  android_app_id: pl.leancode.patrol.example
  ios_app_id: pl.leancode.patrol.Example
  # macos, windows in the future?

or:

patrol:
  app_ids:
    android: pl.leancode.patrol.example
    ios: pl.leancode.patrol.Example
    # more in the future?

cc @mateuszwojtczak

@bartekpacia bartekpacia changed the title uninstalling the app under test after the test was run patrol test: Uninstalling the app after the test was run Jan 26, 2023
@bartekpacia bartekpacia added feature New feature request package: patrol_cli Related to the patrol_cli package labels Jan 26, 2023
@bartekpacia
Copy link
Contributor Author

bartekpacia commented Jan 26, 2023

patrol:
  android:
    package_name: pl.leancode.patrol.example
    app_name: "Patrol example"
  ios:
    bundle_id: pl.leancode.patrol.Example
    app_name: "Patrol example"

Adding app name will unblock #157

@bartekpacia
Copy link
Contributor Author

Do we also want to uninstall the app if it is already present on the device?

@bartekpacia
Copy link
Contributor Author

Reopening because pubspec.yaml fields are not implemented yet.

@crisboarna
Copy link

Hi, I am looking at using your testing framework. This issue solution seems to not cover the case of flavours ? If you want to run Android flavours tests it will not be a static package name, there will be a suffix added to it. Is that scenario covered ?

@bartekpacia
Copy link
Contributor Author

bartekpacia commented Feb 5, 2023

Hi @crisboarna, thanks for taking a look at us! :)

If you configured your app to have package_name according to the flavor, you'll be able to specify this. For example, let's say that your package_name is com.crisboarna.calendar and it has 3 flavors: dev, staging, and prod, and that you wish to run your integration tests with staging flavor. Then you'll be able to do:

patrol:
  android:
    package_name: com.crisboarna.calendar.staging
    app_name: Awesome Calendar

To run these tests (with automatic uninstall), you'll execute:

patrol test --flavor staging

Does it solve your use case?

@bartekpacia
Copy link
Contributor Author

bartekpacia commented Feb 5, 2023

Thinking about it now, it'd also make sense to include flavor and dart-defines in pubspec.yaml:

patrol:
  flavor: staging
  dart-defines:
    CRASHLYTICS_ENABLED: false

  android:
    package_name: com.crisboarna.calendar.staging
    app_name: Awesome Calendar
    dart-defines:
      SOME_KEY: this dart-define will be only present on Android

  ios:
    bundle_id: com.crisboarna.Calendar.staging
    app_name: Awesome Calendar
    dart-defines:
      SOME_KEY: this dart-define will be only present on iOS

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request package: patrol_cli Related to the patrol_cli package
Projects
None yet
2 participants