diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-11 18:14:36 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-11 18:14:36 +0000 |
commit | 19b619581b7db714b730564001b1b22ac1ca889c (patch) | |
tree | 5ead59aa8b05c15812d9636a13619e9b5f1f0942 | |
parent | b5641f04f4cbb66c0941266692bc36a27fc745bc (diff) | |
parent | 98ae0fac626707cdefdc59a959d86c9f934dde4e (diff) | |
download | adt-infra-emu-34-2-release.tar.gz |
Snap for 11702928 from 98ae0fac626707cdefdc59a959d86c9f934dde4e to emu-34-2-releaseemu-34-2-release
Change-Id: Ice8ee2453add823962b83db68dd77ddf7ad2aa72
18 files changed, 169 insertions, 165 deletions
diff --git a/pytest/test_embedded/tests/display/test_rotation.py b/pytest/test_embedded/tests/display/test_rotation.py index eac3667d..fd77a677 100644 --- a/pytest/test_embedded/tests/display/test_rotation.py +++ b/pytest/test_embedded/tests/display/test_rotation.py @@ -80,6 +80,7 @@ async def for_each_rotation(emulator_controller): @pytest.mark.async_timeout(10) @pytest.mark.timeout_win(timeout=60) @pytest.mark.graphics +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_observable_through_screenshot( emulator_controller, animation_app ): @@ -100,6 +101,7 @@ async def test_rotation_observable_through_screenshot( @pytest.mark.e2e @pytest.mark.graphics +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_observable_through_adbstream( avd, at_home, animation_app, emulator_controller ): @@ -125,6 +127,7 @@ async def test_rotation_observable_through_adbstream( @pytest.mark.e2e @pytest.mark.async_timeout(10) @pytest.mark.graphics +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_observable_through_stream_screenshot( animation_app, emulator_controller, stream_screenshot ): @@ -258,6 +261,7 @@ async def rotation_through_console_observable_through_stream_screenshot( "rotation, quadrant", [(0, 1), (90, 2), (-180, 3), (-90, 4)], ) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_pixels_in_the_right_place( animation_app, emulator_controller, rotation, quadrant, stream_screenshot ): @@ -292,7 +296,7 @@ async def test_rotation_pixels_in_the_right_place( @pytest.mark.e2e @pytest.mark.async_timeout(10) @pytest.mark.graphics -@pytest.mark.flaky(reruns=2, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_through_console_observable_through_physical_model( emulator_controller, telnet, at_home ): @@ -321,6 +325,7 @@ async def test_rotation_through_console_observable_through_physical_model( @pytest.mark.e2e @pytest.mark.graphics @pytest.mark.async_timeout(10) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_through_console_observable_through_screenshot( at_home, emulator_controller, telnet ): @@ -335,6 +340,7 @@ async def test_rotation_through_console_observable_through_screenshot( @pytest.mark.e2e @pytest.mark.graphics @pytest.mark.async_timeout(10) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_through_console_observable_through_stream_screenshot( at_home, animation_app, emulator_controller, telnet, stream_screenshot ): @@ -351,7 +357,7 @@ async def test_rotation_through_console_observable_through_stream_screenshot( @pytest.mark.embedded @pytest.mark.sanity @pytest.mark.async_timeout(10) -@pytest.mark.flaky(reruns=2, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_observable_through_screenshot_embedded_mode( emulator_controller, telnet, emulator, at_home ): @@ -363,7 +369,7 @@ async def test_rotation_observable_through_screenshot_embedded_mode( @pytest.mark.e2e @pytest.mark.embedded @pytest.mark.async_timeout(10) -@pytest.mark.flaky(reruns=2, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_rotation_observable_through_stream_screenshot_embedded_mode( emulator_controller, telnet, emulator, at_home, stream_screenshot ): diff --git a/pytest/test_embedded/tests/display/test_screenshot.py b/pytest/test_embedded/tests/display/test_screenshot.py index 12299ed3..ef85bb5f 100644 --- a/pytest/test_embedded/tests/display/test_screenshot.py +++ b/pytest/test_embedded/tests/display/test_screenshot.py @@ -73,7 +73,7 @@ EMU_TO_PIL_IMAGE_FORMATS = { @pytest.mark.embedded @pytest.mark.fast @pytest.mark.parametrize("w,h", [(0, 0), (320, 200), (1920, 1080)]) -@pytest.mark.flaky(reruns=2, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_screenshot_all_formats_are_equal( avd, get_screenshot, animation_app, w, h ): @@ -105,6 +105,7 @@ async def test_screenshot_all_formats_are_equal( [(ImageFormat.RGB888, 3), (ImageFormat.RGBA8888, 4)], ) @pytest.mark.parametrize("degrees", [0, 90]) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_screenshot_exact_amount_of_pixels( at_home, get_screenshot, emulator_controller, image_format, bpp, degrees ): @@ -165,6 +166,7 @@ async def all_orientations(emulator_controller, request): @pytest.mark.graphics @pytest.mark.embedded @pytest.mark.timeout_win(timeout=120) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_screenshot_valid_width_and_height( emulator, get_screenshot, default_display_config ): @@ -180,6 +182,7 @@ async def test_screenshot_valid_width_and_height( @pytest.mark.graphics @pytest.mark.embedded +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_screenshot_gets_default_resolution( at_home, get_screenshot, default_display_config, all_orientations ): @@ -198,6 +201,7 @@ async def test_screenshot_gets_default_resolution( @pytest.mark.graphics @pytest.mark.embedded +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_screenshot_never_scales_up( at_home, get_screenshot, default_display_config, all_orientations ): @@ -223,6 +227,7 @@ async def test_screenshot_never_scales_up( @pytest.mark.graphics @pytest.mark.embedded +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_screenshot_should_fail_if_does_not_exist( at_home, emulator_controller, default_display_config ): diff --git a/pytest/test_embedded/tests/display/test_stream_screenshot.py b/pytest/test_embedded/tests/display/test_stream_screenshot.py index 66360008..f20aaa4e 100644 --- a/pytest/test_embedded/tests/display/test_stream_screenshot.py +++ b/pytest/test_embedded/tests/display/test_stream_screenshot.py @@ -34,7 +34,7 @@ def read_pixel(width, height, pack, arr): @pytest.mark.skipos( "win", "reason: b/305252175 - error at setup. Only the parameter [2-1] fails." ) -@pytest.mark.flaky(reruns=2, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=5) @pytest.mark.timeout_win(timeout=60) @pytest.mark.parametrize( "fmt,channel", diff --git a/pytest/test_embedded/tests/files/test_zip_distribution.py b/pytest/test_embedded/tests/files/test_zip_distribution.py index d26c2180..78cd2883 100644 --- a/pytest/test_embedded/tests/files/test_zip_distribution.py +++ b/pytest/test_embedded/tests/files/test_zip_distribution.py @@ -47,7 +47,6 @@ def get_expected_files(): "mksdcard", "nimble_bridge", "emulator", - "netsim", ] exp_files_win = [ @@ -65,7 +64,6 @@ def get_expected_files(): "mksdcard.exe", "nimble_bridge.exe", "emulator.exe", - "netsim.exe", "android-emu-agents.lib", "concrt140.dll", "libandroid-emu-agents.dll", @@ -134,7 +132,6 @@ def get_exp_sub_dirs(): "libprotobuf.32.dylib", "vulkan", ], - "netsim-ui": ["assets", "index.html", "js", "node_modules"], "resources": [ "Toren1BD.mtl", "Toren1BD.posters", @@ -210,7 +207,6 @@ def get_exp_sub_dirs(): "gles_mesa", "concrt140.dll", ], - "netsim-ui": ["assets", "index.html", "js", "node_modules"], "resources": [ "Toren1BD.mtl", "Toren1BD.posters", diff --git a/pytest/test_embedded/tests/graphics/test_app.py b/pytest/test_embedded/tests/graphics/test_app.py index 8b02f858..c58a3a65 100644 --- a/pytest/test_embedded/tests/graphics/test_app.py +++ b/pytest/test_embedded/tests/graphics/test_app.py @@ -23,6 +23,7 @@ from emu.timing import eventually @pytest.mark.e2e @pytest.mark.graphics @pytest.mark.async_timeout(60) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_android_app_dialog_has_dimmed_background(avd, get_screenshot, log_adb_interactions): """ Test for b/315308358. diff --git a/pytest/test_embedded/tests/incubating/sensors/test_sensor_service.py b/pytest/test_embedded/tests/incubating/sensors/test_sensor_service.py index 67cebe63..d3ca35d1 100644 --- a/pytest/test_embedded/tests/incubating/sensors/test_sensor_service.py +++ b/pytest/test_embedded/tests/incubating/sensors/test_sensor_service.py @@ -100,9 +100,16 @@ async def set_and_get_sensor(sensor_service, sensor_value): 2, ), ("Acceleration", SensorValue.SENSOR_SENSOR_TYPE_ACCELERATION, 10, 0, 0), - ("Acceleration_Uncalibrated", SensorValue.SENSOR_SENSOR_TYPE_ACCELERATION_UNCALIBRATED, 25, 0, 0), - ("Heart_Rate", SensorValue.SENSOR_SENSOR_TYPE_HEART_RATE, 60, 0, 10), - ("RGBC_Light", SensorValue.SENSOR_SENSOR_TYPE_RGBC_LIGHT, 255, 0, 0), + ( + "Acceleration_Uncalibrated", + SensorValue.SENSOR_SENSOR_TYPE_ACCELERATION_UNCALIBRATED, + 25, + 0, + 0, + ), + # BUG: b/326662659 HEART_RATE and RGBC_LIGHT sensor values not available for phone AVD + # ("Heart_Rate", SensorValue.SENSOR_SENSOR_TYPE_HEART_RATE, 60, 0, 10), BUG: b/326662659 HEART_RATE not available for phone AVD + # ("RGBC_Light", SensorValue.SENSOR_SENSOR_TYPE_RGBC_LIGHT, 255, 0, 0), ], ) async def test_sensor_value(service, test_name, sensor_value, x, y, z): diff --git a/pytest/test_embedded/tests/netsim/test_handle_devices.py b/pytest/test_embedded/tests/netsim/test_handle_devices.py deleted file mode 100644 index b1dab0bb..00000000 --- a/pytest/test_embedded/tests/netsim/test_handle_devices.py +++ /dev/null @@ -1,73 +0,0 @@ -import pytest -from netsim_grpc import netsim_client - - -@pytest.mark.e2e -@pytest.mark.boot -def test_device_attaches_to_netsimd(avd): - """Test case to verify that a device is attached to netsimd.""" - assert len(netsim_client.NetsimClient().get_devices()) != 0 - - -@pytest.mark.e2e -@pytest.mark.boot -def test_netsim_patch_and_reset(avd): - """Test case to verify that patch and reset device in netsim""" - initial_devices = netsim_client.NetsimClient().get_devices() - assert len(initial_devices) != 0 - - # Patch Device Position and Orientation - device_name = list(initial_devices.keys())[0] - patch_position = netsim_client.model.Position(x=1, y=2, z=3) - patch_orientation = netsim_client.model.Orientation(yaw=30, pitch=60, roll=90) - assert netsim_client.NetsimClient().set_position( - device_name, position=patch_position, orientation=patch_orientation - ) - - # Verfiy the new Position and Orientation - post_patch_device = netsim_client.NetsimClient().get_devices()[device_name] - assert post_patch_device.position == patch_position - assert post_patch_device.orientation == patch_orientation - - # Attempt Reset and Verify with Position and Orientation - netsim_client.NetsimClient().reset() - post_reset_device = netsim_client.NetsimClient().get_devices()[device_name] - assert post_reset_device.position == netsim_client.model.Position(x=0, y=0, z=0) - assert post_reset_device.orientation == netsim_client.model.Orientation( - yaw=0, pitch=0, roll=0 - ) - - -@pytest.mark.e2e -@pytest.mark.boot -def test_netsim_radio_state_toggle(avd): - """Test case to verify patch radio in netsim""" - initial_devices = netsim_client.NetsimClient().get_devices() - assert len(initial_devices) != 0 - - # Turn off Radio State (BLE) of Device and Verify - device_name = list(initial_devices.keys())[0] - patch_radio = netsim_client.model.PhyKind.BLUETOOTH_LOW_ENERGY - patch_state = False - netsim_client.NetsimClient().set_radio(device_name, patch_radio, patch_state) - post_patch_device = netsim_client.NetsimClient().get_devices()[device_name] - for chip in post_patch_device.chips: - if chip.kind == netsim_client.common.ChipKind.BLUETOOTH: - assert chip.bt.low_energy.state == netsim_client.model.State.OFF - - # Turn on Radio State (BLE) of Device and Verify - patch_state = True - netsim_client.NetsimClient().set_radio(device_name, patch_radio, patch_state) - post_patch_device = netsim_client.NetsimClient().get_devices()[device_name] - for chip in post_patch_device.chips: - if chip.kind == netsim_client.common.ChipKind.BLUETOOTH: - assert chip.bt.low_energy.state == netsim_client.model.State.ON - - # Turn off Radio State (BLE) of Device, Reset and Verify if it's on - patch_state = False - netsim_client.NetsimClient().set_radio(device_name, patch_radio, patch_state) - netsim_client.NetsimClient().reset() - post_patch_reset_device = netsim_client.NetsimClient().get_devices()[device_name] - for chip in post_patch_reset_device.chips: - if chip.kind == netsim_client.common.ChipKind.BLUETOOTH: - assert chip.bt.low_energy.state == netsim_client.model.State.ON diff --git a/pytest/test_embedded/tests/resizable/test_new_resizable.py b/pytest/test_embedded/tests/resizable/test_new_resizable.py index d20d9c6b..d61b5672 100644 --- a/pytest/test_embedded/tests/resizable/test_new_resizable.py +++ b/pytest/test_embedded/tests/resizable/test_new_resizable.py @@ -94,7 +94,7 @@ async def set_display_mode(emulator_controller, mode, timeout=5): ], ) @pytest.mark.timeout_win(timeout=60) -@pytest.mark.flaky(reruns=2, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=5) @pytest.mark.sanity # @pytest.mark.skipos("all", "reason: b/309463427") async def test_new_resizable_changes_resolution( @@ -167,6 +167,7 @@ async def test_new_resizable_changes_resolution( (ImageFormat.RGB888, 3), ], ) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_new_resizable_observable_from_streaming( avd, supported_resizable_resolutions, @@ -213,6 +214,7 @@ async def test_new_resizable_observable_from_streaming( (ImageFormat.RGB888, 3), ], ) +@pytest.mark.flaky(reruns=3, reruns_delay=5) async def test_new_resizable_folding_observable_from_streaming( avd, supported_resizable_resolutions, diff --git a/pytest/test_embedded/tests/sensors/test_sensor.py b/pytest/test_embedded/tests/sensors/test_sensor.py index 81b41842..d5351f12 100644 --- a/pytest/test_embedded/tests/sensors/test_sensor.py +++ b/pytest/test_embedded/tests/sensors/test_sensor.py @@ -78,8 +78,9 @@ async def set_and_get_sensor(emu_controller, sensor_value): ("Gyroscope_Uncalibrated", SensorValue.GYROSCOPE_UNCALIBRATED, 2, 2, 2), ("Acceleration", SensorValue.ACCELERATION, 10, 0, 0), ("Acceleration_Uncalibrated", SensorValue.ACCELERATION_UNCALIBRATED, 25, 0, 0), - ("Heart_Rate", SensorValue.HEART_RATE, 60, 0, 10), - ("RGBC_Light", SensorValue.RGBC_LIGHT, 255, 0, 0), + # BUG: b/326662659 HEART_RATE and RGBC_LIGHT sensor values not available for phone AVD + # ("Heart_Rate", SensorValue.HEART_RATE, 60, 0, 10), + # ("RGBC_Light", SensorValue.RGBC_LIGHT, 255, 0, 0), ], ) async def test_sensor_value(emulator_controller, test_name, sensor_value, x, y, z): diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AddGoogleAccountTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AddGoogleAccountTest.java index 431375fd..5b31732d 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AddGoogleAccountTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AddGoogleAccountTest.java @@ -29,6 +29,7 @@ import com.android.devtools.systemimage.uitest.utils.AppLauncher; import com.android.devtools.systemimage.uitest.utils.Wait; import com.android.devtools.systemimage.uitest.watchers.watcher; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -65,6 +66,7 @@ public class AddGoogleAccountTest { */ @Test @TestInfo(id = "14581151") + @Ignore("Covered by FAT") public void testAddAccountUsingContactsApp() throws Exception { final Instrumentation instrumentation = testFramework.getInstrumentation(); final UiDevice mDevice = testFramework.getDevice(); @@ -97,4 +99,4 @@ public class AddGoogleAccountTest { assertTrue("Add Google account page not found", new Wait(10000L).until(signInHeader::exists)); } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/ApiDemosTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/ApiDemosTest.java index 7a673bef..778a0379 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/ApiDemosTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/ApiDemosTest.java @@ -35,6 +35,7 @@ import junit.framework.Assert; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -88,7 +89,7 @@ public class ApiDemosTest { * */ @Test - @TestInfo(id = "T144630615") + @Ignore("Covered by CTS. Move it to FAT") public void testPasswordQuality() throws Exception { AppLauncher.launch(instrumentation, "API Demos"); @@ -155,4 +156,4 @@ public class ApiDemosTest { //Deactivate "Device Admin" to restore the state. SettingsUtil.deactivate(instrumentation, "Sample Device Admin", "Security", "Device admin apps"); } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AppTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AppTest.java index 60556b7b..49811081 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AppTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/AppTest.java @@ -33,6 +33,7 @@ import com.android.devtools.systemimage.uitest.utils.Wait; import com.android.devtools.systemimage.uitest.watchers.AppWatcher; import com.android.devtools.systemimage.uitest.watchers.watcher; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -74,6 +75,7 @@ public class AppTest { */ @Test @TestInfo(id = "14578823") + @Ignore("Covered by CTS. Move to FAT") public void installAppAndLaunch() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); UiDevice device = UiDevice.getInstance(instrumentation); @@ -116,6 +118,7 @@ public class AppTest { */ @Test @TestInfo(id = "14578831") + @Ignore("Covered by FAT") public void bookmarkWebSiteInBrowser() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); final UiDevice device = UiDevice.getInstance(instrumentation); @@ -196,4 +199,4 @@ public class AppTest { trashCan.click(); } } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/CameraTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/CameraTest.java index 645a70a6..1bafc154 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/CameraTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/CameraTest.java @@ -29,6 +29,7 @@ import com.android.devtools.systemimage.uitest.utils.Wait; import com.android.devtools.systemimage.uitest.watchers.watcher; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -69,6 +70,7 @@ public class CameraTest { */ @Test @TestInfo(id = "ab5f9585-433b-4261-bd15-5c7136f6127b") + @Ignore("Covered by CTS. Move to FAT") public void testPhotoCapture() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); boolean photoTestSuccess = CameraTestUtil.useCamera(instrumentation, "Images", 3); @@ -98,6 +100,7 @@ public class CameraTest { */ @Test @TestInfo(id = "ab5f9585-433b-4261-bd15-5c7136f6127b") + @Ignore("Covered by CTS. Move to FAT") public void testVideoCapture() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); boolean videoTestSuccess = CameraTestUtil.useCamera(instrumentation, "Videos", 3); @@ -118,6 +121,7 @@ public class CameraTest { */ @Test @TestInfo(id = "61ba18b5-cfba-46a7-a3f2-abfc60e40303") + @Ignore("Covered by FAT") public void launchARApp() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); final UiDevice device = testFramework.getDevice(); @@ -137,4 +141,4 @@ public class CameraTest { }) ); } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/PlayStoreTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/PlayStoreTest.java index 346abd86..86f173f5 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/PlayStoreTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/PlayStoreTest.java @@ -31,6 +31,7 @@ import com.android.devtools.systemimage.uitest.watchers.GoogleAppConfirmationWat import com.android.devtools.systemimage.uitest.watchers.watcher; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -78,6 +79,7 @@ public class PlayStoreTest { */ @Test @TestInfo(id = "50027a89-8043-44d7-b7ed-33c631903910") + @Ignore("Covered by FAT") public void testPlaySearch() throws Exception { if (testFramework.isGoogleApiAndPlayImage()) { Instrumentation instrumentation = testFramework.getInstrumentation(); @@ -111,6 +113,7 @@ public class PlayStoreTest { */ @Test @TestInfo(id = "cb0ccd97-f045-42fa-8293-a32e94e838aa") + @Ignore("Covered by FAT") public void testAppInstallation() throws Exception { if (testFramework.isGoogleApiAndPlayImage()) { Instrumentation instrumentation = testFramework.getInstrumentation(); @@ -151,6 +154,7 @@ public class PlayStoreTest { */ @Test @TestInfo(id = "924a0428-4e07-4794-b6a7-2c9d407204aa") + @Ignore("Covered by FAT") public void testAppInstallationAndLaunch() throws Exception { if (testFramework.isGoogleApiAndPlayImage()) { Instrumentation instrumentation = testFramework.getInstrumentation(); @@ -219,6 +223,7 @@ public class PlayStoreTest { */ @Test @TestInfo(id = "bd9460a8-7b07-4cfc-901f-a99564533e51") + @Ignore("Covered by FAT") public void testPayAppVerification() throws Exception { if (testFramework.isGoogleApiAndPlayImage()) { Instrumentation instrumentation = testFramework.getInstrumentation(); @@ -261,6 +266,7 @@ public class PlayStoreTest { */ @Test @TestInfo(id = "fe78dba5-a0f2-4acf-bcbb-10b1c15d3484") + @Ignore("Covered by FAT") public void testParentalControls() throws Exception { if (testFramework.isGoogleApiAndPlayImage()) { final Instrumentation instrumentation = testFramework.getInstrumentation(); @@ -286,4 +292,4 @@ public class PlayStoreTest { device.pressHome(); } } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/SettingsTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/SettingsTest.java index 93fecd84..218dcd14 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/SettingsTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/SettingsTest.java @@ -502,7 +502,6 @@ public class SettingsTest { * </pre> */ @Test - @TestInfo(id = "T144630613") public void activateDeactivatePolicy() throws Exception { try { SettingsUtil.launchDeviceAdminApps(instrumentation, "Security", "Device admin apps"); @@ -589,10 +588,10 @@ public class SettingsTest { * 1. App settings for Maps are reset to default (Verify that Permissions and notification * settings for Maps are cleared). * </pre> - */ - @Ignore("Test is canceled on crash during app permission reset.") + */ @Test @TestInfo(id = "d49facce-9be7-47e0-afde-2052d3c57a25") + @Ignore("Test is canceled on crash during app permission reset") public void modifyAndResetAppPermissions() throws Exception { String appName = "Maps"; String contactsText = "Contacts"; @@ -809,9 +808,9 @@ public class SettingsTest { * 2. Test file is copied into the Download folder. * 3. Test file is deleted from the Download folder. * </pre> - */ - @Ignore("Cannot access external storage without a runtime permissions implementation") + */ @Test + @Ignore("Cannot access external storage without a runtime permissions implementation") public void filesDeleted() throws Exception { String[] testFileNames = {"test_text_01.txt", "test_text_02.txt", "test_text_03.txt"}; @@ -833,4 +832,4 @@ public class SettingsTest { SettingsUtil.hasTestFile(instrumentation, name)); } } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/VpnTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/VpnTest.java index ef1a304f..47a7eea1 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/VpnTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/VpnTest.java @@ -68,7 +68,6 @@ public class VpnTest { * <p/> */ @Test - @TestInfo(id = "14578822") public void testVpn() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); UiDevice device = testFramework.getDevice(); @@ -93,4 +92,4 @@ public class VpnTest { VpnTestUtil.verifyVpnStatus_v2(device)); } } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/YouTubeTest.java b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/YouTubeTest.java index 9331a362..f953bdad 100644 --- a/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/YouTubeTest.java +++ b/system_image_uitests/app/src/androidTest/java/com/android/devtools/systemimage/uitest/smoke/api31/YouTubeTest.java @@ -29,6 +29,7 @@ import com.android.devtools.systemimage.uitest.utils.GoogleAppUtil; import com.android.devtools.systemimage.uitest.utils.YouTubeUtil; import org.junit.FixMethodOrder; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -59,9 +60,6 @@ public class YouTubeTest { /** * Verify YouTube has the latest version or not. - * <p> - * TT ID: XXXX - * <p> * <pre> * Test Steps: * 1. Start an emulator and launch home screen. @@ -72,7 +70,7 @@ public class YouTubeTest { * </pre> */ @Test - @TestInfo(id = "XXXX") + @Ignore("Covered by media test suite") public void checkYouTubeVersion() throws Exception{ Instrumentation instrumentation = testFramework.getInstrumentation(); UiDevice device = UiDevice.getInstance(instrumentation); @@ -84,9 +82,6 @@ public class YouTubeTest { /** * Verify YouTube login and logout are working correctly. - * <p> - * TT ID: XXXX - * <p> * <pre> * Test Steps: * 1. Start an emulator and launch home screen @@ -100,7 +95,7 @@ public class YouTubeTest { * </pre> */ @Test - @TestInfo(id = "XXXX") + @Ignore("Covered by media test suite") public void loginYouTube() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); UiDevice device = UiDevice.getInstance(instrumentation); @@ -131,4 +126,4 @@ public class YouTubeTest { assertFalse("YouTube log out was unsuccessful", YouTubeUtil.isTestUserLoggedIn(instrumentation)); } -}
\ No newline at end of file +} diff --git a/system_image_uitests/app/src/main/java/com/android/devtools/systemimage/uitest/utils/GoogleAppUtil.java b/system_image_uitests/app/src/main/java/com/android/devtools/systemimage/uitest/utils/GoogleAppUtil.java index 99e840c6..421d0c2a 100644 --- a/system_image_uitests/app/src/main/java/com/android/devtools/systemimage/uitest/utils/GoogleAppUtil.java +++ b/system_image_uitests/app/src/main/java/com/android/devtools/systemimage/uitest/utils/GoogleAppUtil.java @@ -26,7 +26,8 @@ import com.android.devtools.systemimage.uitest.common.Res; import com.android.devtools.systemimage.uitest.watchers.watcher; import java.util.concurrent.TimeUnit; import android.util.Log; -import android.view.KeyEvent; + +import org.junit.Assert; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -47,15 +48,17 @@ public class GoogleAppUtil { public static String getUserEmail() { return email; } - public static String getUserPassword() { return password; } /** * Log a user into a Google application - * @param instrumentation - * @return boolean flag indicating success + * + * @param instrumentation the instrumentation instance + * @param firstAttempt indicates if it's the first attempt to log in + * @return boolean flag indicating success + * @throws Exception if an error occurs during the login process */ public static boolean loginGoogleApp(Instrumentation instrumentation, boolean firstAttempt) throws Exception { final UiDevice device = UiDevice.getInstance(instrumentation); @@ -173,6 +176,9 @@ public class GoogleAppUtil { editInput.setText(getUserEmail()); clickNext(device); + assertTrue("Forgot email link not dismissed.", + forgotEmailLink.waitUntilGone(90000L)); + UiObject forgotPasswordLink; if (api == 27 || api == 28) { @@ -199,6 +205,9 @@ public class GoogleAppUtil { editInput.setText(getUserPassword()); clickNext(device); + assertTrue("Forgot password link not dismissed.", + forgotPasswordLink.waitUntilGone(90000L)); + boolean isSignedIn = new watcher(device, Res.GOOGLE_APP_CONF_WATCHER_PATTERN).checkForCondition(); @@ -278,76 +287,102 @@ public class GoogleAppUtil { return true; } + /** + * Log a user out of the Google Chrome application + * + * @param instrumentation the instrumentation instance + * @return boolean flag indicating success + * @throws Exception if an error occurs during the logout process + */ public static boolean logoutGoogleChrome(Instrumentation instrumentation) throws Exception { - final UiDevice device = UiDevice.getInstance(instrumentation); + boolean result = false; - GoogleAppUtil.openChromeSettings(instrumentation); + try { + final UiDevice device = UiDevice.getInstance(instrumentation); - final UiObject androidIconButton = api == 31 ? - device.findObject( - new UiSelector().resourceId(Res.CHROME_SIGNIN_PROMO_BUTTON_RES)) : - device.findObject( - new UiSelector().resourceId(Res.ANDROID_ICON_RES). - className("android.widget.ImageView")); - - if (new Wait().until(androidIconButton::exists)) { - androidIconButton.clickAndWaitForNewWindow(); - } + GoogleAppUtil.openChromeSettings(instrumentation); - refuseSync(device); + final UiObject androidIconButton = api == 31 ? + device.findObject( + new UiSelector().resourceId(Res.CHROME_SIGNIN_PROMO_BUTTON_RES)) : + device.findObject( + new UiSelector().resourceId(Res.ANDROID_ICON_RES). + className("android.widget.ImageView")); - if (api >= 31) { - final UiObject emailLabel = device.findObject( - new UiSelector().text(getUserEmail()).resourceId(Res.ANDROID_SUMMARY_RES)); - if (new Wait().until(emailLabel::exists)) { - emailLabel.clickAndWaitForNewWindow(); + if (new Wait().until(androidIconButton::exists)) { + androidIconButton.clickAndWaitForNewWindow(); } - } - final UiObject signOutLabel = api >= 31 ? - device.findObject(new UiSelector().text("Sign out and turn off sync")) : - device.findObject(new UiSelector().text("Sign out of Chrome")); + refuseSync(device); - if (new Wait().until(signOutLabel::exists)) { - signOutLabel.clickAndWaitForNewWindow(); - new watcher(device, Res.GOOGLE_APP_CONT_WATCHER_PATTERN).checkForCondition(); - } + if (api >= 31) { + final UiObject emailLabel = device.findObject( + new UiSelector().text(getUserEmail()).resourceId(Res.ANDROID_SUMMARY_RES)); + if (new Wait().until(emailLabel::exists)) { + emailLabel.clickAndWaitForNewWindow(); + emailLabel.waitUntilGone(3000L); + } + } - final UiObject signOutButton = device.findObject(new UiSelector().textMatches("(?i)(SIGN OUT)(?-i)")); + final UiObject signOutLabel = api >= 31 ? + device.findObject(new UiSelector().text("Sign out and turn off sync")) : + device.findObject(new UiSelector().text("Sign out of Chrome")); - if (new Wait().until(signOutButton::exists)) { - signOutButton.clickAndWaitForNewWindow(); - } + if (new Wait().until(signOutLabel::exists)) { + signOutLabel.clickAndWaitForNewWindow(); + signOutLabel.waitUntilGone(3000L); + new watcher(device, Res.GOOGLE_APP_CONT_WATCHER_PATTERN).checkForCondition(); + } + final UiObject signOutButton = device.findObject(new UiSelector().textMatches("(?i)(SIGN OUT)(?-i)")); - for (int i = 0; i < 3; i++) { - UiObject loggedInUser = - device.findObject(new UiSelector().text(getUserEmail())); - if (new Wait().until(loggedInUser::exists)) { - loggedInUser.clickAndWaitForNewWindow(); + if (new Wait().until(signOutButton::exists)) { + signOutButton.clickAndWaitForNewWindow(); + signOutButton.waitUntilGone(3000L); } - } - for (int i = 0; i < 2; i++) { - UiObject removeAccountButton = device.findObject( - new UiSelector().textMatches("(?i)remove account(?-i)").className("android.widget.Button")); - if (new Wait().until(removeAccountButton::exists)) { - removeAccountButton.clickAndWaitForNewWindow(); + for (int i = 0; i < 3; i++) { + UiObject loggedInUser = + device.findObject(new UiSelector().text(getUserEmail())); + if (new Wait().until(loggedInUser::exists)) { + loggedInUser.clickAndWaitForNewWindow(); + } } - } + for (int i = 0; i < 2; i++) { + UiObject removeAccountButton = device.findObject( + new UiSelector().textMatches("(?i)remove account(?-i)").className("android.widget.Button")); + if (new Wait().until(removeAccountButton::exists)) { + removeAccountButton.clickAndWaitForNewWindow(); + removeAccountButton.waitUntilGone(3000L); + } + } - String signInText = api >= 30 ? "Turn on sync" : "Sign in to Chrome"; - final UiObject signInLabel = device.findObject(new UiSelector().text(signInText)); - final UiObject signInPromoCloseButton = device.findObject( - new UiSelector().resourceId(Res.CHROME_SIGNIN_PROMO_CLOSE_RES)); - final UiObject addAccountButton = device.findObject( - new UiSelector().text("Add account")); - return new Wait().until(signInLabel::exists) || new Wait().until(signInPromoCloseButton::exists) - || new Wait().until(addAccountButton::exists); + String signInText = api >= 30 ? "Turn on sync" : "Sign in to Chrome"; + final UiObject signInLabel = device.findObject(new UiSelector().text(signInText)); + final UiObject signInPromoCloseButton = device.findObject( + new UiSelector().resourceId(Res.CHROME_SIGNIN_PROMO_CLOSE_RES)); + final UiObject addAccountButton = device.findObject( + new UiSelector().text("Add account")); + + result = new Wait().until(signInLabel::exists) || new Wait().until(signInPromoCloseButton::exists) + || new Wait().until(addAccountButton::exists); + + } catch (Exception e) { + Assert.fail("Failed to logout from Google Chrome with exception: " + e); + } + return result; } + /** + * Open the settings of the Google Chrome application. + * This method interacts with the UI of the Google Chrome app on an Android device + * and opens the settings menu. + * + * @param instrumentation the instrumentation instance + * @throws Exception if an error occurs during the operation + */ private static void openChromeSettings(Instrumentation instrumentation) throws Exception { UiDevice device = UiDevice.getInstance(instrumentation); @@ -395,6 +430,13 @@ public class GoogleAppUtil { } } + /** + * Clicks on the "Next" button in the UI of the Android device. + * This method is used to automate UI interactions, specifically when a "Next" button needs to be clicked. + * + * @param device the UiDevice instance representing the device on which the test is currently running + * @throws UiObjectNotFoundException if the "Next" button is not found in the UI + */ private static void clickNext(UiDevice device) throws UiObjectNotFoundException{ UiObject nextButton = device.findObject(new UiSelector().textMatches(("(?i)next(?-i)"))); if (!nextButton.waitForExists(TimeUnit.MILLISECONDS.convert(3L, TimeUnit.SECONDS))) { @@ -414,6 +456,14 @@ public class GoogleAppUtil { } } + /** + * Refuses the sync operation in the Google Chrome application. + * This method interacts with the UI of the Google Chrome app on an Android device + * and clicks on the "No Thanks" button when the sync operation prompt appears. + * + * @param device the UiDevice instance representing the device on which the test is currently running + * @throws Exception if any error occurs during the operation + */ public static void refuseSync(UiDevice device) throws Exception { UiObject noThanksButton = device.findObject(new UiSelector(). resourceIdMatches(Res.CHROME_NO_THANKS_BUTTON_RES)); |