Open yschimke opened 2 years ago
Working fine for me locally on API 28.
Failing differently on API 26
com.example.android.wearable.wear.alwayson.AlwaysOnAppTests > textIsCorrectAfterReturningToActiveMode[test(AVD) - 8.0.0] FAILED
java.lang.AssertionError: Failed to assert the following: (Text + EditableText = [Draw count: 9])
Semantics of the node:
Tests on test(AVD) - 8.0.0 failed: There was 1 failure(s).
Feb 21, 2022 4:56:34 PM com.google.testing.platform.RunnerImpl$Companion summarizeAndLogTestResult
SEVERE: Execute com.example.android.wearable.wear.alwayson.AlwaysOnAppTests.textIsCorrectAfterReturningToActiveMode: FAILED
java.lang.AssertionError: java.lang.AssertionError: Failed to assert the following: (Text + EditableText = [Draw count: 9])
Semantics of the node:
Node #35 at (l=75.0, t=170.0, r=205.0, b=199.0)px, Tag: 'drawCount'
Text = '[Draw count: 8]'
Actions = [GetTextLayoutResult]
Has 4 siblings
Selector used: (TestTag = 'drawCount')
at androidx.compose.ui.test.AssertionsKt.assert(Assertions.kt:270)
at androidx.compose.ui.test.AssertionsKt.assert$default(Assertions.kt:260)
at androidx.compose.ui.test.AssertionsKt.assertTextEquals(Assertions.kt:190)
at androidx.compose.ui.test.AssertionsKt.assertTextEquals$default(Assertions.kt:186)
So the issue is that the current emulator binary sets the wear emulator to be connected to a charger. This causes the charger experience to cover the whole screen whenever the display goes to ambient.
The long term solution is to wait for a fix that is will be released which sets the wear emulator to not be on a charger by default.
The short term solution is to disconnect the charger before the test with adb emu power ac off
Failing with different errors - https://github.com/android/wear-os-samples/pull/221
com.example.android.wearable.wear.alwayson.MainActivityTests > textIsCorrectAfterFiveSeconds[test(AVD) - 11] FAILED
java.lang.AssertionError: Activity never becomes requested state "[STARTED]" (last lifecycle transition = "DESTROYED")
at androidx.test.core.app.ActivityScenario.waitForActivityToBecomeAnyOf(ActivityScenario.java:338)
com.example.android.wearable.wear.alwayson.MainActivityTests > textIsCorrectAfterReturningToActiveMode[test(AVD) - 11] FAILED
androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'an instance of android.widget.TextView and view.getText() with or without transformation to match: is "Draw count: 9"' doesn't match the selected view.
Expected: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "Draw count: 9"
As @castedmo pointed out these are the View tests.
Running locally it generally works but there are still some timing issues or behavior change in the emulator breaking the test. Also in the compose test.
It will need someone to investigate and confirm the new behavior is a bug, or update the tests to be more tolerant if it's new expected behavior.
Screen shows
This is both at head but also back at https://github.com/android/wear-os-samples/commit/15fdaf1a05300f9e1335b1451f81d90ac9a4a5d0
cc @alexvanyo @shumelchyk