diff options
| author | 2022-03-30 00:06:56 +0000 | |
|---|---|---|
| committer | 2022-04-01 17:54:52 +0000 | |
| commit | d1f18027e715372c65cbe02eed915e66123ed4b2 (patch) | |
| tree | 729c026f19e8ea3a3eae3c507d844a2567a34b6e /libs | |
| parent | 30deaa8bf85562a93bd0f18d2aa3e97174fede7f (diff) | |
Bubble flicker test: Ensure the notification shade is opened
This test depends on finding the text in the notification. In some
cases the notification might not be visible due to whatever else is
going on on the device.
This change adds a swipe that (based on local testing...) will trigger
the shade to expand while on lockscreen and allow all notification
text to be read / found by UiAutomator.
Update the text in the notification to use "BubbleChat" everywhere
so that it can be reliably found (when the notification is collapsed
or expanded it shows text a little differently & it auto expands
when the shade is expanded and it's the top notification).
Test: atest LaunchBubbleFromLockScreen --iterations 20
- Ideally get the "app updates are ready" notif by checking for
updates in settings, when you have this on screen the test
would fail 100% consistently.
Bug: 205288792
Change-Id: Ib01923f35c531fb15230d640237e2c395ee1904d
Diffstat (limited to 'libs')
2 files changed, 16 insertions, 9 deletions
diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt index fb404b913465..684e5cad0e67 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt @@ -17,6 +17,8 @@ package com.android.wm.shell.flicker.bubble import android.platform.test.annotations.Presubmit +import android.view.WindowInsets +import android.view.WindowManager import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice import androidx.test.uiautomator.By @@ -59,6 +61,16 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr } } transitions { + // Swipe & wait for the notification shade to expand so all can be seen + val wm = context.getSystemService(WindowManager::class.java) + val metricInsets = wm.getCurrentWindowMetrics().windowInsets + val insets = metricInsets.getInsetsIgnoringVisibility( + WindowInsets.Type.statusBars() + or WindowInsets.Type.displayCutout()) + device.swipe(100, insets.top + 100, 100, device.getDisplayHeight() / 2, 4) + device.waitForIdle(2000) + instrumentation.uiAutomation.syncInputTransactions() + val notification = device.wait(Until.findObject( By.text("BubbleChat")), FIND_OBJECT_TIMEOUT) notification?.click() ?: error("Notification not found") diff --git a/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/src/com/android/wm/shell/flicker/testapp/BubbleHelper.java b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/src/com/android/wm/shell/flicker/testapp/BubbleHelper.java index d743dffd3c9e..6cd93eff2803 100644 --- a/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/src/com/android/wm/shell/flicker/testapp/BubbleHelper.java +++ b/libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/src/com/android/wm/shell/flicker/testapp/BubbleHelper.java @@ -22,7 +22,6 @@ import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Person; -import android.app.RemoteInput; import android.content.Context; import android.content.Intent; import android.graphics.Point; @@ -116,24 +115,20 @@ public class BubbleHelper { private Notification.Builder getNotificationBuilder(int id) { Person chatBot = new Person.Builder() .setBot(true) - .setName("BubbleBot") + .setName("BubbleChat") .setImportant(true) .build(); - - RemoteInput remoteInput = new RemoteInput.Builder("key") - .setLabel("Reply") - .build(); - String shortcutId = "BubbleChat"; return new Notification.Builder(mContext, CHANNEL_ID) .setChannelId(CHANNEL_ID) .setShortcutId(shortcutId) + .setContentTitle("BubbleChat") .setContentIntent(PendingIntent.getActivity(mContext, 0, new Intent(mContext, LaunchBubbleActivity.class), PendingIntent.FLAG_UPDATE_CURRENT)) .setStyle(new Notification.MessagingStyle(chatBot) - .setConversationTitle("Bubble Chat") - .addMessage("Hello? This is bubble: " + id, + .setConversationTitle("BubbleChat") + .addMessage("BubbleChat", SystemClock.currentThreadTimeMillis() - 300000, chatBot) .addMessage("Is it me, " + id + ", you're looking for?", SystemClock.currentThreadTimeMillis(), chatBot) |