use of com.waz.api.IConversation in project wire-android by wireapp.
the class ConversationFragmentTest method assertCursorImagesGalleryButton.
@TargetApi(Build.VERSION_CODES.KITKAT)
public void assertCursorImagesGalleryButton() throws Exception {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.GROUP);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
when(mockConversation.isActive()).thenReturn(true);
IAccentColorController mockAccentColorController = activity.getControllerFactory().getAccentColorController();
AccentColor mockAccentColor = mock(AccentColor.class);
when(mockAccentColor.getColor()).thenReturn(Color.RED);
when(mockAccentColorController.getAccentColor()).thenReturn(mockAccentColor);
String action = Intent.ACTION_OPEN_DOCUMENT;
Matcher<Intent> expectedIntent = allOf(hasAction(action), hasType("image/*"));
Intent intent = new Intent();
intent.setData(Uri.parse("file:///tmp/whatever.txt"));
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
intending(expectedIntent).respondWith(result);
MockHelper.setupConversationMocks(mockConversation, activity);
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withId(R.id.cursor_menu_item_camera)).check(isVisible());
onView(withId(R.id.cursor_menu_item_camera)).perform(click());
Thread.sleep(500);
onView(withId(R.id.rv__cursor_images)).check(isVisible());
onView(withId(R.id.gtv__cursor_image__nav_open_gallery)).check(isVisible());
// onView(withId(R.id.gtv__cursor_image__nav_open_gallery)).perform(click());
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class FileUploadTest method assertFileUploadIntentInOneToOneConversation.
@Test
@SuppressLint("NewApi")
public void assertFileUploadIntentInOneToOneConversation() throws InterruptedException {
// Mock conversation
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
when(mockConversation.isActive()).thenReturn(true);
MockHelper.setupConversationMocks(mockConversation, activity);
IConversationStore mockConversationStore = activity.getStoreFactory().getConversationStore();
// Mock intent result
String action;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
action = Intent.ACTION_OPEN_DOCUMENT;
} else {
action = Intent.ACTION_GET_CONTENT;
}
Matcher<Intent> expectedIntent = allOf(hasAction(action), hasType("*/*"));
Intent intent = new Intent();
intent.setData(Uri.parse("file:///tmp/whatever.txt"));
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
intending(expectedIntent).respondWith(result);
// attach fragment
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
// verify stuff
Thread.sleep(500);
onView(withId(R.id.cursor_menu_item_more)).perform(click());
Thread.sleep(500);
onView(withId(R.id.cursor_menu_item_file)).perform(click());
Thread.sleep(200);
verify(mockConversationStore).sendMessage(any(AssetForUpload.class), any(MessageContent.Asset.ErrorHandler.class));
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ParticipantHeaderFragmentTest method assertUserDetailsIsVisibleInOneToOneConversation.
@Test
public void assertUserDetailsIsVisibleInOneToOneConversation() throws InterruptedException {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
User otherUser = MockHelper.createMockUser("James", "988");
when(otherUser.getVerified()).thenReturn(Verification.UNVERIFIED);
when(mockConversation.getOtherParticipant()).thenReturn(otherUser);
MockHelper.setupParticipantsMocks(mockConversation, activity);
attachFragment(ParticipantHeaderFragment.newInstance(IConnectStore.UserRequester.CONVERSATION), ParticipantHeaderFragment.TAG);
Thread.sleep(400);
onView(withId(R.id.udv__participants__user_details)).check(isVisible());
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class AudioRecordingTest method verifyLongPressingAudioMessageButtonShowsRecordingView.
@Test
public void verifyLongPressingAudioMessageButtonShowsRecordingView() throws InterruptedException {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
when(mockConversation.isActive()).thenReturn(true);
MockHelper.setupConversationMocks(mockConversation, activity);
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withId(R.id.cursor_menu_item_audio_message)).check(isVisible());
onView(withId(R.id.cursor_menu_item_audio_message)).perform(ViewActions.longClick());
onView(withId(R.id.amrv_audio_message_recording)).check(isVisible());
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ConversationFragmentTest method assertNoVideoCallButtonInGroupConversation.
@Test
public void assertNoVideoCallButtonInGroupConversation() throws InterruptedException {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.GROUP);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
MockHelper.setupConversationMocks(mockConversation, activity);
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withId(R.id.action_video_call)).check(CustomViewAssertions.isNull());
}
Aggregations