Skip to content

Commit 9e15275

Browse files
Android UI Kit v3.0.0-beta1-1
1 parent 4e17be3 commit 9e15275

File tree

125 files changed

+2684
-801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2684
-801
lines changed

app/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ dependencies {
6666
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
6767
androidTestImplementation 'androidx.test:runner:1.1.1'
6868
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
69+
// required if you want to use Mockito for unit tests
70+
testImplementation 'org.mockito:mockito-core:3.7.7'
71+
// required if you want to use Mockito for Android tests
72+
androidTestImplementation 'org.mockito:mockito-android:3.7.7'
6973
implementation project(path: ':uikit')
7074

7175
implementation 'com.google.android.material:material:1.2.0-alpha05'
7276
implementation 'com.facebook.shimmer:shimmer:0.4.0'
7377

7478
//
75-
implementation 'com.cometchat:pro-android-chat-sdk:2.2.1'
79+
implementation 'com.cometchat:pro-android-chat-sdk:3.0.0-beta1'
7680
}

app/src/androidTest/java/com/cometchat/pro/androiduikit/AppTestSuite.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
@Suite.SuiteClasses(
1212
{
1313
MainActivityTest.class,
14-
CreateUserActivity.class,
1514
SelectActivityTest.class,
1615
ComponentActivityTest.class
1716
})
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.cometchat.pro.androiduikit;
2+
3+
import com.cometchat.pro.androiduikit.app.ComponentActivityTest;
4+
import com.cometchat.pro.androiduikit.app.MainActivityTest;
5+
import com.cometchat.pro.androiduikit.app.SelectActivityTest;
6+
import com.cometchat.pro.androiduikit.uikit.CometChatUITest;
7+
import com.cometchat.pro.androiduikit.uikit.ConversationListTest;
8+
import com.cometchat.pro.androiduikit.uikit.GroupListTest;
9+
import com.cometchat.pro.androiduikit.uikit.UsersListTest;
10+
import com.cometchat.pro.uikit.ui_components.cometchat_ui.CometChatUI;
11+
12+
import org.junit.runner.RunWith;
13+
import org.junit.runners.Suite;
14+
15+
@RunWith(Suite.class)
16+
@Suite.SuiteClasses({
17+
CometChatUITest.class,
18+
ConversationListTest.class,
19+
UsersListTest.class,
20+
GroupListTest.class
21+
})
22+
23+
public class UIKitTestSuite {}

app/src/androidTest/java/com/cometchat/pro/androiduikit/app/ComponentActivityTest.java

Lines changed: 87 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public void J_checkCallList() {
153153
public void K_checkCallList_2Sec() {
154154
try {
155155
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).perform(ViewActions.scrollTo());
156+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).check(matches(isDisplayed()));
156157
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).perform(click());
157158
Thread.sleep(2000);
158159
Espresso.onView(ViewMatchers.withId(R.id.callList_rv))
@@ -168,16 +169,22 @@ public void D_checkUserList() {
168169
Espresso.onView(ViewMatchers.withId(R.id.cometchat_user_view)).perform(click());
169170
try {
170171
Espresso.onView(ViewMatchers.withId(R.id.cometchatUserList))
171-
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
172-
} catch (PerformException e) {
172+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()))
173+
.perform(pressBack());
174+
mDevice.pressBack();;
175+
}
176+
catch (NoMatchingViewException e) {
177+
Log.e( "D_checkUserList: ","No View found...Trying again with 2 Sec Delay");
178+
D_checkUserList_2Sec();
179+
}
180+
catch (PerformException e) {
173181
Assert.assertTrue("View not loaded",true);
174182
} catch (Exception e) {
175-
Assert.fail();
183+
Assert.fail(e.getMessage());
176184
}
177185
}
178186

179-
@Test
180-
public void E_checkUserList_2Sec() {
187+
public void D_checkUserList_2Sec() {
181188
try {
182189
Espresso.onView(ViewMatchers.withId(R.id.cometchat_user_view)).perform(ViewActions.scrollTo());
183190
Espresso.onView(ViewMatchers.withId(R.id.cometchat_user_view)).perform(ViewActions.click());
@@ -205,38 +212,107 @@ public void G_checkGroupList_2Sec() {
205212
Thread.sleep(2000);
206213
Espresso.onView(ViewMatchers.withId(R.id.cometchatGroupList))
207214
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
208-
} catch (InterruptedException e) {
215+
} catch (NoMatchingViewException e) {
216+
Log.e( "F_checkGroupList_2Sec: ","View Not loaded...Moving to 5 sec" );
217+
F_checkGroupList_5Sec();
218+
}catch (InterruptedException e) {
219+
e.printStackTrace();
220+
}
221+
}
222+
223+
public void F_checkGroupList_5Sec() {
224+
try {
225+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.scrollTo());
226+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.click());
227+
Thread.sleep(5000);
228+
Espresso.onView(ViewMatchers.withId(R.id.cometchatGroupList))
229+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
230+
} catch (NoMatchingViewException e) {
231+
Log.e( "F_checkGroupList_2Sec: ","View Not loaded...Moving to 10 sec" );
232+
F_checkGroupList_10Sec();
233+
}catch (InterruptedException e) {
234+
e.printStackTrace();
235+
}
236+
}
237+
238+
public void F_checkGroupList_10Sec() {
239+
try {
240+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.scrollTo());
241+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.click());
242+
Thread.sleep(10000);
243+
Espresso.onView(ViewMatchers.withId(R.id.cometchatGroupList))
244+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
245+
} catch (NoMatchingViewException e) {
246+
Assert.fail("View Not Loaded"+e.getMessage());
247+
}catch (InterruptedException e) {
209248
e.printStackTrace();
210249
}
211250
}
212251

252+
253+
213254
@Test
214255
public void H_checkConversationList() {
215256
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.scrollTo());
216257
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.click());
217258
try {
218259
Espresso.onView(ViewMatchers.withId(R.id.cometchatConversationList))
219260
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
220-
} catch (PerformException e) {
261+
}
262+
catch (NoMatchingViewException e) {
263+
Log.e( "H_checkConversationList: ","No View found...Trying again with 2 Sec Delay");
264+
H_checkConversationList_2Sec();
265+
}
266+
catch (PerformException e) {
221267
Assert.assertTrue("View not loaded",true);
222268
} catch (Exception e) {
223-
Assert.fail();
269+
Assert.fail(e.getMessage());
224270
}
225271
}
226272

227-
@Test
228-
public void I_checkConversationList_2Sec() {
273+
public void H_checkConversationList_2Sec() {
229274
try {
230275
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.scrollTo());
231276
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.click());
232277
Thread.sleep(2000);
233278
Espresso.onView(ViewMatchers.withId(R.id.cometchatConversationList))
234279
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
235-
} catch (InterruptedException e) {
280+
} catch (NoMatchingViewException e) {
281+
Log.e("H_checkConversationList_2Sec: ","View Not loaded..Moving to 5 Sec");
282+
H_checkConversationList_5Sec();
283+
}catch (InterruptedException e) {
236284
e.printStackTrace();
237285
}
238286
}
239287

288+
public void H_checkConversationList_5Sec() {
289+
try {
290+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.scrollTo());
291+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.click());
292+
Thread.sleep(5000);
293+
Espresso.onView(ViewMatchers.withId(R.id.cometchatConversationList))
294+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
295+
} catch (NoMatchingViewException e) {
296+
Log.e("H_checkConversationList_5Sec: ","View Not loaded..Moving to 10 Sec");
297+
H_checkConversationList_10Sec();
298+
}catch (InterruptedException e) {
299+
e.printStackTrace();
300+
}
301+
}
302+
303+
public void H_checkConversationList_10Sec() {
304+
try {
305+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.scrollTo());
306+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.click());
307+
Thread.sleep(10000);
308+
Espresso.onView(ViewMatchers.withId(R.id.cometchatConversationList))
309+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
310+
} catch (NoMatchingViewException e) {
311+
Assert.fail("View Not Loaded"+e.getMessage());
312+
}catch (InterruptedException e) {
313+
e.printStackTrace();
314+
}
315+
}
240316
// RecyclerView callRv = activityRule.getActivity().findViewById(R.id.cometchat_callList);
241317
// int itemCount = callRv.getAdapter().getItemCount();
242318
// if (itemCount>0) {

app/src/androidTest/java/com/cometchat/pro/androiduikit/app/CreateUserActivityTest.java

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)