1) created a new build flavor for espresso tests

2) create a new source set full of espresso tests
3) updated proguard-testing.pro
4) added test device numbers to .gitignore

// FREEBIE
This commit is contained in:
Rhodey Orbits
2015-05-25 20:59:07 -07:00
committed by Moxie Marlinspike
parent 6a1bbedae8
commit 7cc2941053
33 changed files with 2280 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import org.hamcrest.Matchers;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
public class AdvancedPreferenceFragmentActions {
public static void clickTextSecureMessages() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_toggle_push_messaging"))).perform(click());
}
public static void clickEnterKeySends() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_enter_sends"))).perform(click());
}
public static void clickChooseIdentity() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_choose_identity"))).perform(click());
}
public static void clickSubmitDebugLog() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_submit_debug_logs"))).perform(click());
}
}

View File

@@ -0,0 +1,112 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import android.test.suitebuilder.annotation.LargeTest;
import org.hamcrest.Matchers;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.ConversationListActivity;
import org.thoughtcrime.securesms.LogSubmitActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.RegistrationActivity;
import org.thoughtcrime.securesms.contacts.ContactIdentityManager;
import org.thoughtcrime.securesms.ApplicationPreferencesActivityActions;
import org.thoughtcrime.securesms.ConversationListActivityActions;
import org.thoughtcrime.securesms.TextSecureEspressoTestCase;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
import static android.support.test.espresso.matcher.ViewMatchers.isChecked;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isNotChecked;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.thoughtcrime.securesms.EspressoUtil.waitOn;
@LargeTest
public class AdvancedPreferenceFragmentTest extends TextSecureEspressoTestCase<ConversationListActivity> {
public AdvancedPreferenceFragmentTest() {
super(ConversationListActivity.class);
}
private void checkAllPreferencesDisplayed() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_toggle_push_messaging")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_enter_sends")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_submit_debug_logs")))
.check(matches(isDisplayed()));
ContactIdentityManager identity = ContactIdentityManager.getInstance(getContext());
if (!identity.isSelfIdentityAutoDetected()) {
onData(Matchers.<Object>allOf(withKey("pref_choose_identity")))
.check(matches(isDisplayed()));
}
}
private void checkViewsMatchPreferences() throws Exception {
if (TextSecurePreferences.isPushRegistered(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_toggle_push_messaging"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_toggle_push_messaging"))));
}
if (TextSecurePreferences.isEnterSendsEnabled(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_enter_sends"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_enter_sends"))));
}
}
private void clickAdvancedSettingAndCheckState() throws Exception {
ConversationListActivityActions.clickSettings(getContext());
waitOn(ApplicationPreferencesActivity.class);
ApplicationPreferencesActivityActions.clickAdvancedSetting();
checkAllPreferencesDisplayed();
checkViewsMatchPreferences();
}
public void testEnableTextSecureMessages() throws Exception {
loadActivity(ConversationListActivity.class, STATE_REGISTRATION_SKIPPED);
clickAdvancedSettingAndCheckState();
AdvancedPreferenceFragmentActions.clickTextSecureMessages();
waitOn(RegistrationActivity.class);
}
public void testDisableTextSecureMessages() throws Exception {
loadActivity(ConversationListActivity.class, STATE_REGISTERED);
clickAdvancedSettingAndCheckState();
AdvancedPreferenceFragmentActions.clickTextSecureMessages();
onView(withText(R.string.ApplicationPreferencesActivity_disable_push_messages))
.check(matches(isDisplayed()));
onView(withText(android.R.string.cancel)).perform(click());
}
public void testSubmitDebugLog() throws Exception {
loadActivity(ConversationListActivity.class, STATE_REGISTRATION_SKIPPED);
clickAdvancedSettingAndCheckState();
AdvancedPreferenceFragmentActions.clickSubmitDebugLog();
waitOn(LogSubmitActivity.class);
}
}

View File

@@ -0,0 +1,51 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import org.hamcrest.Matchers;
import org.thoughtcrime.securesms.R;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
public class AppProtectionPreferenceFragmentActions {
public static void clickEnablePassphrase() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_enable_passphrase_temporary"))).perform(click());
}
public static void disablePassphrase() throws Exception {
clickEnablePassphrase();
onView(withText(R.string.ApplicationPreferencesActivity_disable)).perform(click());
}
public static void clickChangePassphrase() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_change_passphrase"))).perform(click());
}
public static void clickTimeoutPassphrase() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_timeout_passphrase"))).perform(click());
}
public static void clickScreenSecurity() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_screen_security"))).perform(click());
}
}

View File

@@ -0,0 +1,136 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import android.os.Build;
import android.test.suitebuilder.annotation.LargeTest;
import org.hamcrest.Matchers;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.ConversationListActivity;
import org.thoughtcrime.securesms.PassphraseChangeActivity;
import org.thoughtcrime.securesms.ApplicationPreferencesActivityActions;
import org.thoughtcrime.securesms.ConversationListActivityActions;
import org.thoughtcrime.securesms.PassphraseChangeActivityActions;
import org.thoughtcrime.securesms.TextSecureEspressoTestCase;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
import static android.support.test.espresso.matcher.ViewMatchers.isChecked;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isNotChecked;
import static org.thoughtcrime.securesms.EspressoUtil.waitOn;
@LargeTest
public class AppProtectionPreferenceFragmentTest extends TextSecureEspressoTestCase<ConversationListActivity> {
private static final String ORIGINAL_PASSPHRASE = "badpass";
public AppProtectionPreferenceFragmentTest() {
super(ConversationListActivity.class);
}
private void checkAllPreferencesDisplayed() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_enable_passphrase_temporary"))).check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_change_passphrase"))).check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_timeout_passphrase"))).check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_timeout_interval"))).check(matches(isDisplayed()));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
onData(Matchers.<Object>allOf(withKey("pref_screen_security")))
.check(matches(isDisplayed()));
}
}
private void checkViewsMatchPreferences() throws Exception {
if (!TextSecurePreferences.isPasswordDisabled(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_enable_passphrase_temporary"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_enable_passphrase_temporary"))));
}
if (TextSecurePreferences.isPassphraseTimeoutEnabled(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_timeout_passphrase"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_timeout_passphrase"))));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (TextSecurePreferences.isScreenSecurityEnabled(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_screen_security"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_screen_security"))));
}
}
}
private void checkState() throws Exception {
checkAllPreferencesDisplayed();
checkViewsMatchPreferences();
}
private void clickAppProtectionSettingAndCheckState() throws Exception {
loadActivity(ConversationListActivity.class, STATE_REGISTRATION_SKIPPED);
ConversationListActivityActions.clickSettings(getContext());
waitOn(ApplicationPreferencesActivity.class);
ApplicationPreferencesActivityActions.clickAppProtectionSetting();
checkState();
}
public void testEnablePassphrase() throws Exception {
clickAppProtectionSettingAndCheckState();
AppProtectionPreferenceFragmentActions.clickEnablePassphrase();
waitOn(PassphraseChangeActivity.class);
PassphraseChangeActivityActions.typeNewPassphrase(ORIGINAL_PASSPHRASE);
PassphraseChangeActivityActions.clickOk();
waitOn(ApplicationPreferencesActivity.class);
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_enable_passphrase_temporary"))));
checkState();
}
public void testDisablePassphrase() throws Exception {
testEnablePassphrase();
AppProtectionPreferenceFragmentActions.disablePassphrase();
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_enable_passphrase_temporary"))));
checkState();
}
public void testEnablePassphraseTimeout() throws Exception {
testEnablePassphrase();
AppProtectionPreferenceFragmentActions.clickTimeoutPassphrase();
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_timeout_passphrase"))));
checkState();
}
public void testDisableScreenSecurity() throws Exception {
clickAppProtectionSettingAndCheckState();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return;
}
AppProtectionPreferenceFragmentActions.clickScreenSecurity();
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_screen_security"))));
checkState();
}
}

View File

@@ -0,0 +1,35 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import org.hamcrest.Matchers;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
public class AppearancePreferenceFragmentActions {
public static void clickTheme() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_theme"))).perform(click());
}
public static void clickLanguage() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_language"))).perform(click());
}
}

View File

@@ -0,0 +1,57 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import android.test.suitebuilder.annotation.LargeTest;
import org.hamcrest.Matchers;
import org.thoughtcrime.securesms.ConversationListActivity;
import org.thoughtcrime.securesms.TextSecureEspressoTestCase;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
import static android.support.test.espresso.matcher.PreferenceMatchers.withSummaryText;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
@LargeTest
public class AppearancePreferenceFragmentTest extends TextSecureEspressoTestCase<ConversationListActivity> {
public AppearancePreferenceFragmentTest() {
super(ConversationListActivity.class);
}
private void checkAllPreferencesDisplayed() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_theme")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_language")))
.check(matches(isDisplayed()));
}
private void checkViewsMatchPreferences() throws Exception {
// todo :|
final String theme = TextSecurePreferences.getTheme(getContext());
onData(Matchers.<Object>allOf(withKey("pref_theme"), withSummaryText(theme)))
.check(matches(isDisplayed()));
final String language = TextSecurePreferences.getTheme(getContext());
onData(Matchers.<Object>allOf(withKey("pref_language"), withSummaryText(language)))
.check(matches(isDisplayed()));
}
}

View File

@@ -0,0 +1,31 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import org.hamcrest.Matchers;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
public class NotificationsPreferenceFragmentActions {
public static void clickEnableNotifications() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_key_enable_notifications"))).perform(click());
}
}

View File

@@ -0,0 +1,97 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import android.test.suitebuilder.annotation.LargeTest;
import org.hamcrest.Matchers;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.ConversationListActivity;
import org.thoughtcrime.securesms.ApplicationPreferencesActivityActions;
import org.thoughtcrime.securesms.ConversationListActivityActions;
import org.thoughtcrime.securesms.TextSecureEspressoTestCase;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
import static android.support.test.espresso.matcher.ViewMatchers.isChecked;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isNotChecked;
import static org.thoughtcrime.securesms.EspressoUtil.waitOn;
@LargeTest
public class NotificationsPreferenceFragmentTest extends TextSecureEspressoTestCase<ConversationListActivity> {
public NotificationsPreferenceFragmentTest() {
super(ConversationListActivity.class);
}
private void checkAllPreferencesDisplayed() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_key_enable_notifications")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_key_ringtone")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_key_vibrate")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_led_color")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_led_blink")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_key_inthread_notifications")))
.check(matches(isDisplayed()));
onData(Matchers.<Object>allOf(withKey("pref_repeat_alerts")))
.check(matches(isDisplayed()));
}
private void checkViewsMatchPreferences() throws Exception {
if (TextSecurePreferences.isNotificationsEnabled(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_key_enable_notifications"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_key_enable_notifications"))));
}
if (TextSecurePreferences.isNotificationVibrateEnabled(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_key_vibrate"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_key_vibrate"))));
}
if (TextSecurePreferences.isInThreadNotifications(getContext())) {
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_key_inthread_notifications"))));
} else {
isNotChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_key_inthread_notifications"))));
}
}
private void clickNotificationsSettingAndCheckState() throws Exception {
loadActivity(ConversationListActivity.class, STATE_REGISTRATION_SKIPPED);
ConversationListActivityActions.clickSettings(getContext());
waitOn(ApplicationPreferencesActivity.class);
ApplicationPreferencesActivityActions.clickNotificationsSetting();
checkAllPreferencesDisplayed();
checkViewsMatchPreferences();
}
public void testEnableNotifications() throws Exception {
clickNotificationsSettingAndCheckState();
NotificationsPreferenceFragmentActions.clickEnableNotifications();
isChecked().matches(onData(Matchers.<Object>allOf(withKey("pref_key_enable_notifications"))));
}
}

View File

@@ -0,0 +1,43 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import org.hamcrest.Matchers;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
public class SmsMmsPreferenceFragmentActions {
public static void clickReceiveAllSms() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_all_sms"))).perform(click());
}
public static void clickReceiveAllMms() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_all_mms"))).perform(click());
}
public static void clickSmsDeliveryReports() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_delivery_report_sms"))).perform(click());
}
public static void clickWifiCallingCompat() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_wifi_sms"))).perform(click());
}
}

View File

@@ -0,0 +1,39 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.preferences;
import org.hamcrest.Matchers;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.PreferenceMatchers.withKey;
public class StoragePreferenceFragmentActions {
public static void clickDeleteOldMessages() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_trim_threads"))).perform(click());
}
public static void clickConversationLengthLimit() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_trim_length"))).perform(click());
}
public static void clickTrimAllNow() throws Exception {
onData(Matchers.<Object>allOf(withKey("pref_trim_now"))).perform(click());
}
}