Use case-insensitive match for action label.

The label can be as-is ("Test reply") or all-caps ("TEST REPLY")
depending on the system config.

Bug: 227712564
Bug: 227424350
Test: atest InputMethodStressTest
Change-Id: Id64793f572bec06c84a235fc7688870f44013723
This commit is contained in:
Kohsuke Yatoh
2022-04-08 16:52:40 -07:00
parent f75e0a0512
commit fcfbaa6b61

View File

@@ -48,6 +48,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
@RootPermissionTest
@RunWith(AndroidJUnit4.class)
@@ -99,7 +100,9 @@ public final class NotificationTest {
public void testDirectReply() {
postMessagingNotification();
mUiDevice.openNotification();
mUiDevice.wait(Until.findObject(By.text(REPLY_ACTION_LABEL)), TIMEOUT).click();
// The text can be shown as-is, or all-caps, depending on the system.
Pattern actionLabelPattern = Pattern.compile(REPLY_ACTION_LABEL, Pattern.CASE_INSENSITIVE);
mUiDevice.wait(Until.findObject(By.text(actionLabelPattern)), TIMEOUT).click();
// Verify that IME is visible.
assertThat(mUiDevice.wait(Until.findObject(By.pkg(getImePackage(mContext))), TIMEOUT))
.isNotNull();