forked from signalapp/Signal-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
33 changed files
with
2,280 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ signing.properties | |
library/lib/ | ||
library/obj/ | ||
ffpr | ||
test/androidTestEspresso/res/values/arrays.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...idTestEspresso/java/org/thoughtcrime/securesms/ApplicationPreferencesActivityActions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
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 ApplicationPreferencesActivityActions { | ||
|
||
public static void clickSmsAndMmsSetting() throws Exception { | ||
onData(Matchers.<Object>allOf(withKey("preference_category_sms_mms"))).perform(click()); | ||
} | ||
|
||
public static void clickNotificationsSetting() throws Exception { | ||
onData(Matchers.<Object>allOf(withKey("preference_category_notifications"))).perform(click()); | ||
} | ||
|
||
public static void clickAppProtectionSetting() throws Exception { | ||
onData(Matchers.<Object>allOf(withKey("preference_category_app_protection"))).perform(click()); | ||
} | ||
|
||
public static void clickAppearanceSetting() throws Exception { | ||
onData(Matchers.<Object>allOf(withKey("preference_category_appearance"))).perform(click()); | ||
} | ||
|
||
public static void clickDeleteOldMessagesSetting() throws Exception { | ||
onData(Matchers.<Object>allOf(withKey("preference_category_storage"))).perform(click()); | ||
} | ||
|
||
public static void clickAdvancedSetting() throws Exception { | ||
onData(Matchers.<Object>allOf(withKey("preference_category_advanced"))).perform(click()); | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
...droidTestEspresso/java/org/thoughtcrime/securesms/ApplicationPreferencesActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* 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; | ||
|
||
import android.test.suitebuilder.annotation.LargeTest; | ||
|
||
import org.hamcrest.Matchers; | ||
|
||
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.isDisplayed; | ||
import static org.thoughtcrime.securesms.EspressoUtil.waitOn; | ||
|
||
@LargeTest | ||
public class ApplicationPreferencesActivityTest extends TextSecureEspressoTestCase<ConversationListActivity> { | ||
|
||
public ApplicationPreferencesActivityTest() { | ||
super(ConversationListActivity.class); | ||
} | ||
|
||
private void checkAllPreferencesDisplayed() throws Exception { | ||
onData(Matchers.<Object>allOf(withKey("preference_category_sms_mms"))) | ||
.check(matches(isDisplayed())); | ||
onData(Matchers.<Object>allOf(withKey("preference_category_notifications"))) | ||
.check(matches(isDisplayed())); | ||
onData(Matchers.<Object>allOf(withKey("preference_category_app_protection"))) | ||
.check(matches(isDisplayed())); | ||
onData(Matchers.<Object>allOf(withKey("preference_category_appearance"))) | ||
.check(matches(isDisplayed())); | ||
onData(Matchers.<Object>allOf(withKey("preference_category_storage"))) | ||
.check(matches(isDisplayed())); | ||
onData(Matchers.<Object>allOf(withKey("preference_category_advanced"))) | ||
.check(matches(isDisplayed())); | ||
} | ||
|
||
public void testClickSettings() throws Exception { | ||
loadActivity(ConversationListActivity.class, STATE_REGISTRATION_SKIPPED); | ||
ConversationListActivityActions.clickSettings(getContext()); | ||
waitOn(ApplicationPreferencesActivity.class); | ||
checkAllPreferencesDisplayed(); | ||
} | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
test/androidTestEspresso/java/org/thoughtcrime/securesms/ConversationActivityActions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* 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; | ||
|
||
import android.content.Context; | ||
|
||
import static android.support.test.espresso.Espresso.onView; | ||
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu; | ||
import static android.support.test.espresso.action.ViewActions.click; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withId; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withText; | ||
import static org.thoughtcrime.securesms.EspressoUtil.typeTextAndCloseKeyboard; | ||
|
||
public class ConversationActivityActions { | ||
|
||
public static void clickAddAttachment(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.conversation__menu_add_attachment)).perform(click()); | ||
} | ||
|
||
public static void clickAllImages(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.conversation__menu_view_media)).perform(click()); | ||
} | ||
|
||
public static void clickDeleteThread(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.conversation__menu_delete_thread)).perform(click()); | ||
} | ||
|
||
public static void toggleEmojiKeyboard() throws Exception { | ||
onView(withId(R.id.emoji_toggle)).perform(click()); | ||
} | ||
|
||
public static void typeMessage(String message) throws Exception { | ||
typeTextAndCloseKeyboard(onView(withId(R.id.embedded_text_editor)), message); | ||
} | ||
|
||
} |
79 changes: 79 additions & 0 deletions
79
.../androidTestEspresso/java/org/thoughtcrime/securesms/ConversationListActivityActions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/** | ||
* 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; | ||
|
||
import android.content.Context; | ||
|
||
import org.thoughtcrime.securesms.R; | ||
|
||
import static android.support.test.espresso.Espresso.onView; | ||
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu; | ||
import static android.support.test.espresso.action.ViewActions.click; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withId; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withText; | ||
|
||
public class ConversationListActivityActions { | ||
|
||
public static void dismissReminder() throws Exception { | ||
onView(withId(R.id.cancel)).perform(click()); | ||
} | ||
|
||
public static void clickNewConversation() throws Exception { | ||
onView(withId(R.id.fab)).perform(click()); | ||
} | ||
|
||
public static void clickNewGroup(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.text_secure_normal__menu_new_group)).perform(click()); | ||
} | ||
|
||
public static void clickLock(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.text_secure_normal__menu_clear_passphrase)).perform(click()); | ||
} | ||
|
||
public static void clickMarkAllRead(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.text_secure_normal__mark_all_as_read)).perform(click()); | ||
} | ||
|
||
public static void clickImportExport(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.arrays__import_export)).perform(click()); | ||
} | ||
|
||
public static void clickMyIdentity(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.arrays__my_identity_key)).perform(click()); | ||
} | ||
|
||
public static void clickSettings(Context context) throws Exception { | ||
openActionBarOverflowOrOptionsMenu(context); | ||
onView(withText(R.string.text_secure_normal__menu_settings)).perform(click()); | ||
} | ||
|
||
public static void deleteSelected() throws Exception { | ||
onView(withId(R.id.menu_delete_selected)).perform(click()); | ||
onView(withText(R.string.delete)).perform(click()); | ||
} | ||
|
||
public static void cancelDeleteSelected() throws Exception { | ||
onView(withId(R.id.menu_delete_selected)).perform(click()); | ||
onView(withText(android.R.string.cancel)).perform(click()); | ||
} | ||
|
||
} |
Oops, something went wrong.