02/17/2022, 9:37 PM
The compose-jb issue #368 documents the difficulties users of Compose Multiplatform have been having trying to write non-Android GUI tests. It clearly identifies an example (ScrollBarTest) that actually works. But there are many operations, particularly
, that are not currently implemented in the
component thus causing a serious problem for those of us wanting to write GUI tests for our Compose Multiplatform apps. To address this problem, I have volunteered to work on implementing some of these not yet implemented functions. The first step is to set up a development environment for this work. That environment is the subject of this post, a Readers Digest version of material provided by @Igor Demin (for which I am so, so grateful). The basic work is described in and essentially entails: 1. Getting the source code 2. Setting up java 3. Setting up Android Studio 4. Verifying the development setup by running a working test 5. Developing a fix, with test, for some unimplemented method 6. Getting the code reviewed by @olonho and/or @Igor Demin 7. Generating a PR to the JetBrains fork Getting the source code The source code is obtained using a Google tool, '`repo`', which is a layer on top of git. For work on Compose Multiplatform, the branch to use is "androidx-main". The download uses ~40G and takes a while. A gigabit network, or better, is highly recommended. The repo installation instructions can be found at . I used homebrew (
brew install repo
) on a MacBook Pro. Once repo is installed, the branch (androidx-main) is initialized and downloaded using steps from : mkdir <path/for/androidx-main/code> cd <path/for/androidx-main/code> repo init -u https://android/ repo init -u -b androidx-main repo sync -c -j8 Setting up Java The Compose Multiplatform team recommends using JDK15 but I have been using JDK11 successfully for ui-test-junit4 so far. Homebrew is an excellent way to manage multiple JDK versions simultaneously, particularly Open JDK. I am also told that JDK11 is provided by the
download, but I seem to recall needing an installed JDK11 at one point. Setting up Android Studio At this point, when the script completes, we are ready to use Android Studio (Dolphin), which is included in the download of "androidx-main", as a source file editor by executing:
cd frameworks/support
./gradlew studio
Verifying the development setup by running a working test The next step is to verify that the ScrollBarTest can be run successfully. While this usually can be done using Android Studio or Gradle, a known bug in Dolphin generates a "Nothing here" message so we use Gradle with:
./gradlew cleanDesktopTest :compose:foundation:foundation:desktopTest --tests ""
The remaining three steps will be performed in the coming days and I will edit this post accordingly. My hope is that others will find this documentation useful and enable them to contribute fixes also.
👍🏻 1
👍 2

Kirill Grouchnikov

02/17/2022, 10:20 PM
This should be a document somewhere on compose-jb. I'd suggest starting a PR and updating it as you go along. Slack is not really well suited for such a collaborative effort.
👍🏻 1
👍 2


02/21/2022, 6:12 PM
I had recently watched the "Android Day on Google Open Source Live" on Feb 3, 2022, and it covered topics of how to build and contribute to AOSP. For replay videos see here: I followed your instructions, did the repo init commands and sync. Question: I have seen this command:
repo init -u <> -b androidx-main --partial-clone --clone-filter=blob:limit=10M
which contains more arguments than what you gave. Does anyone know the difference, and if I have already done: $ repo init -u -b androidx-main $ repo sync -j8 -c This downloaded 44GB Should I leave things alone as is, or redo with: $ repo init -u -b androidx-main --partial-clone --clone-filter=blob:limit=10M $ repo sync -j8 -c I was able to $ cd support/framework but in order to start Android Studio needed to do: $ ANDROIDX_PROJECTS=MAIN ./gradlew studio Android Studio started okay. The gradlew command to run the ScrollbarTest failed, the task "cleanDesktopTest" was not found. -- mark@T530:~/workspace/aosp/frameworks/support$ ./gradlew cleanDesktopTest \:compose\:foundation:foundation:desktopTest --tests "" Configuration cache is an incubating feature. Configuration on demand is an incubating feature. Calculating task graph as no configuration cache is available for tasks: cleanDesktopTest \:compose\:foundation:foundation:desktopTest --tests Type-safe dependency accessors is an incubating feature. 0 problems were found storing the configuration cache. See the complete report at file:///home/mark/workspace/aosp/frameworks/support/build/reports/configuration-cache/8y984v4wuj734xrnmjx6r8hmj/ecrjffk5e0cp08uq3c7tysa3r/configuration-cache-report.html FAILURE: Build failed with an exception. * What went wrong: Task 'cleanDesktopTest' not found in root project 'androidx'. -- [? I did a copy and paste and somehow picked up the emoji/icons] Hah! \:compose\: is translated to :compose: I cannot escape it [esc] doesn't seem to work for me. Ignore the '\' in the command exmples I played around and was able to explore the tasks and run some tests: ./gradlew \:compose\:foundation:foundation:test worked mark@T530:~/workspace/aosp/frameworks/support$ ./gradlew \:compose\:ui:ui:ui-samples:test Configuration cache is an incubating feature. Configuration on demand is an incubating feature. Reusing configuration cache. BUILD SUCCESSFUL in 2s 173 actionable tasks: 11 executed, 16 from cache, 146 up-to-date Configuration cache entry reused. mark@T530:~/workspace/aosp/frameworks/support$ I'm not sure what to do next at this point.

Igor Demin

02/21/2022, 7:16 PM
The gradlew command to run the ScrollbarTest failed, the task "cleanDesktopTest" was not found.
There is one missing piece. You should add
(or add
to every Gradle command, but it doesn't work for IDE sync)
You can wrap it into a code block 🙂