AzimoLabs / fastlane-plugin-automated-test-emulator-run

Plugin dedicated for Android platform. Wraps gradle task/shell command used for launching instrumented tests. Provides start of as many AVDs with various configs as needed before test run, waits for boot, kills emulators and deletes them from hdd after tests are finished or disturbed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

running screengrab

joreilly opened this issue · comments

Is it only possible to use gradle_task and shell_task when using this? Would be great for example to be able to run screengrab.

Hello,

I have never used screengrab but I've just checked GitRepo of this tool. I will take a closer look at it tomorrow, yet I am quite sure that it should work.

You can start other fastlane lanes with usage of this tool. So for example you could try something like this:

     lane :assemble_apk_and_grab_screenshots do
         gradle(task: "assembleDebug assembleAndroidTest")
         Action.sh("screengrab")
     end

     lane :grab_screenshots do
     	automated_test_emulator_run(
          AVD_setup_path: "fastlane/MyConfigs/AVD_ConfigForScreengrab.json",
          shell_task: "fastlane assemble_apk_and_grab_screenshots"
        )
     end
  1. So assemble_apk_and_grab_screenshots lane builds your .apk and android-test.apk to be ready for screengrab.
  2. You wrap this lane into shell task.
  3. Plugin will start AVDs according to your JSON config. Wait for AVD to fully launch. And then run fastlane assemble_apk_and_grab_screenshots.
  4. Your AVDs will simply wait for *.apks to be built and then screengrab will launch. It should use currently available devices - AVDs which were launched by plugin and wait for shell task to finish.
  5. After shell task finishes it's job AVDs are killed and deleted.

Thanks @FisherKK for the quick response! Will try that out. BTW am using screengrab from fastlane (such as below)....but same approach will work of course.

    lane :screenshots do |options|
        gradle(task: 'clean')
        gradle(
              task: "assembleDebug assembleDebugAndroidTest",
              properties: {
               ....
              }
        )

        screengrab(
            locales: ['en-US'],
            clear_previous_screenshots: true,
            app_package_name: package_name,
            use_tests_in_packages: ['com.company.package.screenshots'],
            app_apk_path: "app/build/outputs/apk/app-debug.apk",
            tests_apk_path: "app/build/outputs/apk/app-debug-androidTest.apk"
        )
    end

Sure :) No problem!
I hope it will work.