Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a0db2d6 authored by Joshua Mccloskey's avatar Joshua Mccloskey Committed by Android (Google) Code Review
Browse files

Merge "Change screenshot test to use RNG" into main

parents e615b8fc f055c2e3
Loading
Loading
Loading
Loading
+29 −25
Original line number Diff line number Diff line
@@ -29,42 +29,46 @@ android_app {
        "androidx.fragment_fragment",
        "androidx.test.runner",
        "androidx.test.core",
        "androidx.test.rules",
        "androidx.test.ext.junit",
        "platform-screenshot-diff-core",
        "Settings-testutils2",
        "androidx.test.espresso.core",
        "kotlinx-coroutines-android",
        "androidx.lifecycle_lifecycle-runtime-testing",
        "kotlinx_coroutines_test",
    ],
    uses_libs: ["org.apache.http.legacy"],

    aaptflags: ["--extra-packages com.android.settings"],
    manifest: "AndroidManifest.xml",
}

android_test {
    name: "SettingsScreenshotTests",
    platform_apis: true,
    certificate: "platform",
    test_suites: ["device-tests"],
// This is a RNG (Robolectric native graphics) test target.
android_robolectric_test {
    name: "SettingsScreenshotRNGTests",
    srcs: [
        "src/**/*.kt",
    ],
    test_suites: ["general-tests"],

    // Do not add any libraries here, instead add them to the ScreenshotTestStub
    static_libs: [
        "androidx.fragment_fragment-testing",
        "androidx.fragment_fragment",
        "androidx.test.rules",
        "androidx.compose.runtime_runtime",
        "androidx.test.uiautomator_uiautomator",
        "androidx.test.ext.junit",
        "platform-screenshot-diff-core",
        "Settings-testutils2",
        "androidx.test.core",
        "androidx.test.espresso.core",
        "kotlinx-coroutines-android",
        "androidx.lifecycle_lifecycle-runtime-testing",
        "kotlinx_coroutines_test",
        "Settings-core",
        "androidx.test.runner",
        "inline-mockito-robolectric-prebuilt",
        "platform-parametric-runner-lib",
        "uiautomator-helpers",

    ],
    uses_libs: ["org.apache.http.legacy"],
    compile_multilib: "both",
    manifest: "AndroidManifest.xml",
    test_config: "AndroidTest.xml",
    use_embedded_native_libs: false,
    asset_dirs: ["assets"],
    libs: [
        "android.test.runner",
        "android.test.base",
        "android.test.mock",
        "truth",
    ],

    upstream: true,
    instrumentation_for: "ScreenshotTestStub",
    data: [":ScreenshotTestStub"],
    java_resource_dirs: ["config"],
}
+7 −26
Original line number Diff line number Diff line
@@ -16,32 +16,13 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.android.settings.tests.screenshot"
    >

    <application android:debuggable="true">
        <provider
            android:name="com.android.settings.slices.SettingsSliceProvider"
            android:authorities="com.android.settings.tests.screenshot.disabled"
            android:enabled="false"
            tools:node="remove"
            tools:replace="android:authorities" />

    </application>

    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
        xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
        coreApp="true"
        package="com.android.settings">
    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />

    <instrumentation
        android:name="androidx.test.runner.AndroidJUnitRunner"
        android:label="Android Settings Screenshot tests"
        android:targetPackage="com.android.settings.tests.screenshot" />
    <application>
        <activity android:name="com.android.settings.test.screenshot.ContainerActivity" android:exported="true" />
    </application>

</manifest>
 No newline at end of file

tests/screenshot/AndroidTest.xml

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2023 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<configuration description="Runs settings screendiff tests.">
    <option name="test-suite-tag" value="apct-instrumentation" />
    <option name="test-suite-tag" value="apct" />
    <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
        <option name="optimized-property-setting" value="true" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true" />
        <option name="test-file-name" value="SettingsScreenshotTests.apk" />
    </target_preparer>
    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
        <option name="directory-keys"
            value="/data/user/0/com.android.settings.tests.screenshot/" />
        <option name="collect-on-run-ended-only" value="true" />
    </metrics_collector>
    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
        <option name="package" value="com.android.settings.tests.screenshot" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
    </test>
</configuration>
−210 KiB
Loading image diff...
+56.5 KiB
Loading image diff...
Loading