From a89a0cbaa3614a1c07ac16fa84f5968576e56326 Mon Sep 17 00:00:00 2001 From: akwizgran Date: Wed, 1 Jan 2025 17:47:39 +0000 Subject: [PATCH] Remove another intermittently failing UI test and some dead code. These tests have been failing intermittently since the UI refactoring and Material Design update last year. They don't seem to provide much value so I'm removing them rather than spending time to work out why they're no longer reliable. --- .../android/account/SetupActivityTest.java | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/briar-android/src/test/java/org/briarproject/briar/android/account/SetupActivityTest.java b/briar-android/src/test/java/org/briarproject/briar/android/account/SetupActivityTest.java index eaef09181..6e1b15212 100644 --- a/briar-android/src/test/java/org/briarproject/briar/android/account/SetupActivityTest.java +++ b/briar-android/src/test/java/org/briarproject/briar/android/account/SetupActivityTest.java @@ -1,17 +1,11 @@ package org.briarproject.briar.android.account; -import android.view.View; - import org.briarproject.briar.R; -import org.briarproject.briar.android.login.StrengthMeter; -import org.hamcrest.Description; -import org.hamcrest.Matcher; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.annotation.Config; -import androidx.test.espresso.matcher.BoundedMatcher; import androidx.test.ext.junit.rules.ActivityScenarioRule; import androidx.test.ext.junit.runners.AndroidJUnit4; @@ -27,8 +21,6 @@ import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isEnabled; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withText; -import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH; -import static org.briarproject.bramble.util.StringUtils.getRandomString; import static org.hamcrest.Matchers.not; @RunWith(AndroidJUnit4.class) @@ -39,15 +31,6 @@ public class SetupActivityTest { public ActivityScenarioRule rule = new ActivityScenarioRule<>(SetupActivity.class); - @Test - public void testNicknameTooLongErrorShown() { - String longNick = getRandomString(MAX_AUTHOR_NAME_LENGTH + 1); - onView(withId(R.id.nickname_entry)).perform(typeText(longNick)); - - // Nickname should be too long - onView(withText(R.string.name_too_long)).check(matches(isDisplayed())); - } - @Test public void testPasswordMatchUI() { moveToSetPasswordFragment(); @@ -76,35 +59,4 @@ public class SetupActivityTest { onView(withId(R.id.next)).perform(click()); onView(withId(R.id.password_entry)).check(matches(isDisplayed())); } - - private Matcher strengthAndColor(float strength, int color) { - return new StrengthMeterMatcher(strength, color); - } - - static class StrengthMeterMatcher - extends BoundedMatcher { - - private final float strength; - private final int color; - - private StrengthMeterMatcher(float strength, int color) { - super(StrengthMeter.class); - this.strength = strength; - this.color = color; - } - - @Override - public void describeTo(Description description) { - description.appendText("is enabled"); - } - - @Override - public boolean matchesSafely(StrengthMeter view) { - boolean strengthMatches = - view.getProgress() == (int) (view.getMax() * strength); - boolean colorMatches = color == view.getColor(); - return strengthMatches && colorMatches; - } - } - }