diff --git a/README.md b/README.md index ce7b89ba0d..da1ab63014 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,20 @@ gcloud: ## Invoke a test asynchronously without waiting for test results. # async: false + ## A key-value map of additional details to attach to the test matrix. + ## Arbitrary key-value pairs may be attached to a test matrix to provide additional context about the tests being run. + ## When consuming the test results, such as in Cloud Functions or a CI system, + ## these details can add additional context such as a link to the corresponding pull request. + # client-details + # key1: value1 + # key2: value2 + + ## The name of the network traffic profile, for example LTE, HSPA, etc, + ## which consists of a set of parameters to emulate network conditions when running the test + ## (default: no network shaping; see available profiles listed by the `flank test network-profiles list` command). + ## This feature only works on physical devices. + # network-profile: LTE + ## The history name for your test results (an arbitrary string label; default: the application's label from the APK manifest). ## All tests which use the same history name will have their results grouped together in the Firebase console in a time-ordered test history list. # results-history-name: android-history @@ -257,10 +271,27 @@ gcloud: # directories-to-pull: # - /sdcard/ + ## A list of device-path: file-path pairs that indicate the device paths to push files to the device before starting tests, and the paths of files to push. + ## Device paths must be under absolute, whitelisted paths (${EXTERNAL_STORAGE}, or ${ANDROID_DATA}/local/tmp). + ## Source file paths may be in the local filesystem or in Google Cloud Storage (gs://…). + # other-files + # - /sdcard/dir1/file1.txt: local/file.txt + # - /sdcard/dir2/file2.jpg: gs://bucket/file.jpg + ## Monitor and record performance metrics: CPU, memory, network usage, and FPS (game-loop only). ## Disabled by default. Use --performance-metrics to enable. # performance-metrics: true + ## Specifies the number of shards into which you want to evenly distribute test cases. + ## The shards are run in parallel on separate devices. For example, + ## if your test execution contains 20 test cases and you specify four shards, each shard executes five test cases. + ## The number of shards should be less than the total number of test cases. + ## The number of shards specified must be >= 1 and <= 50. + ## This option cannot be used along max-test-shards and is not compatible with smart sharding. + ## If you want to take benefits of smart sharding use max-test-shards instead. + ## default: null + # num-uniform-shards: 50 + ## The fully-qualified Java class name of the instrumentation test runner ## (default: the last name extracted from the APK manifest). # test-runner-class: com.foo.TestRunner @@ -273,6 +304,21 @@ gcloud: # test-targets: # - class com.example.app.ExampleUiTest#testPasses + ## A map of robo_directives that you can use to customize the behavior of Robo test. + ## The type specifies the action type of the directive, which may take on values click, text or ignore. + ## If no type is provided, text will be used by default. + ## Each key should be the Android resource name of a target UI element and each value should be the text input for that element. + ## Values are only permitted for text type elements, so no value should be specified for click and ignore type elements. + # robo-directives: + # "text:input_resource_name": message + # "click:button_resource_name": "" + + ## The path to a Robo Script JSON file. + ## The path may be in the local filesystem or in Google Cloud Storage using gs:// notation. + ## You can guide the Robo test to perform specific actions by recording a Robo Script in Android Studio and then specifying this argument. + ## Learn more at https://firebase.google.com/docs/test-lab/robo-ux-test#scripting. + # robo-script: path_to_robo_script + ## A list of DIMENSION=VALUE pairs which specify a target device to test against. ## This flag may be repeated to specify multiple devices. ## The four device dimensions are: model, version, locale, and orientation. @@ -297,7 +343,7 @@ flank: ## default: -1 (unlimited) # shard-time: -1 - ## repeat tests - the amount of times to run the tests. + ## The amount of times to run the tests. ## 1 runs the tests once. 10 runs all the tests 10x # num-test-runs: 1 @@ -344,6 +390,12 @@ flank: ## Useful for Fladle and other gradle plugins that don't expect the process to have a non-zero exit code. ## The JUnit XML is used to determine failure. (default: false) # ignore-failed-tests: true + + ## Flank provides two ways for parsing junit xml results. + ## New way uses google api instead of merging xml files, but can generate slightly different output format. + ## This flag allows fallback for legacy xml junit results parsing + ## Currently available for android, iOS still uses only legacy way. + # legacy-junit-result: false ``` ### Android code coverage diff --git a/release_notes.md b/release_notes.md index 54b52238b2..187e8502d3 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,6 +3,7 @@ - [#712](https://github.com/Flank/flank/pull/712) Add keep file path for ios. ([pawelpasterz](https://github.com/pawelpasterz)) - [#711](https://github.com/Flank/flank/pull/711) Remove hardcoded height. ([pawelpasterz](https://github.com/pawelpasterz)) - [#708](https://github.com/Flank/flank/pull/708) Add ignore failed tests option to Flank. ([pawelpasterz](https://github.com/pawelpasterz)) +- [#704](https://github.com/Flank/flank/pull/709) Add robo for robo-directives & robo-script options. ([jan-gogo](https://github.com/jan-gogo)) - [#704](https://github.com/Flank/flank/pull/704) Fix shards calculation when there are ignored tests and shardTime is -1. ([jan-gogo](https://github.com/jan-gogo)) - [#692](https://github.com/Flank/flank/pull/698) Add support for other-files option. ([jan-gogo](https://github.com/jan-gogo)) - [#695](https://github.com/Flank/flank/pull/695) Add support for additional-apks option. ([jan-gogo](https://github.com/jan-gogo)) diff --git a/test_app/app/src/androidTest/java/com/example/test_app/BaseInstrumentedTest.kt b/test_app/app/src/androidTest/java/com/example/test_app/BaseInstrumentedTest.kt index 9fed6b54e7..2fe0665455 100644 --- a/test_app/app/src/androidTest/java/com/example/test_app/BaseInstrumentedTest.kt +++ b/test_app/app/src/androidTest/java/com/example/test_app/BaseInstrumentedTest.kt @@ -1,12 +1,12 @@ package com.example.test_app import android.Manifest -import android.os.SystemClock import androidx.test.espresso.intent.rule.IntentsTestRule import androidx.test.rule.GrantPermissionRule import com.example.test_app.screenshot.ScreenshotTestRule import org.junit.Assert.assertTrue import org.junit.Rule +import kotlin.random.Random abstract class BaseInstrumentedTest { @@ -29,7 +29,7 @@ abstract class BaseInstrumentedTest { val result: Boolean = when (BuildConfig.FLAVOR_type) { "success" -> true "error" -> false - "flaky" -> SystemClock.uptimeMillis() % 2 == 0L + "flaky" -> Random.nextBoolean() else -> throw Error("Invalid flavour type") } assertTrue(result) diff --git a/test_app/app/src/main/java/com/example/test_app/MainActivity.kt b/test_app/app/src/main/java/com/example/test_app/MainActivity.kt index 7fbc9db1cf..46fe90fade 100644 --- a/test_app/app/src/main/java/com/example/test_app/MainActivity.kt +++ b/test_app/app/src/main/java/com/example/test_app/MainActivity.kt @@ -1,16 +1,31 @@ package com.example.test_app +import android.content.DialogInterface import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import android.widget.Button +import android.widget.Toast +import androidx.appcompat.app.AlertDialog class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - } - fun foo() { - println("foo!") + findViewById