Skip to content

Commit fa7f171

Browse files
Android UI Kit v2.1.11
1 parent 8f8ddea commit fa7f171

Some content is hidden

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

43 files changed

+1050
-120
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Learn more about how to integrate [UI Kit](https://github.com/cometchat-pro/andr
6161

6262
## Troubleshooting
6363

64-
- To read the full dcoumentation on UI Kit integration visit our [Documentation](https://prodocs.cometchat.com/docs/android-ui-kit) .
64+
- To read the full documentation on UI Kit integration visit our [Documentation](https://prodocs.cometchat.com/docs/android-ui-kit) .
6565

6666
- Facing any issues while integrating or installing the UI Kit please <a href="https://app.cometchat.io/"> connect with us via real time support present in CometChat Dashboard.</a>.
6767

app/build.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ dependencies {
5252

5353
testImplementation 'junit:junit:4.12'
5454
implementation 'androidx.recyclerview:recyclerview:1.0.0'
55+
// Core library
56+
androidTestImplementation 'androidx.test:core:1.3.0'
57+
// Espresso dependencies
58+
59+
androidTestImplementation 'androidx.test:rules:1.1.0'
60+
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'
61+
// Assertions
62+
63+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
64+
65+
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.0'
66+
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
5567
androidTestImplementation 'androidx.test:runner:1.1.1'
5668
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
5769
implementation project(path: ':uikit')
@@ -60,5 +72,5 @@ dependencies {
6072
implementation 'com.facebook.shimmer:shimmer:0.4.0'
6173

6274
//
63-
implementation 'com.cometchat:pro-android-chat-sdk:2.1.7-beta3'
75+
implementation 'com.cometchat:pro-android-chat-sdk:2.2.0'
6476
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
7+
import org.junit.runner.RunWith;
8+
import org.junit.runners.Suite;
9+
10+
@RunWith(Suite.class)
11+
@Suite.SuiteClasses(
12+
{
13+
MainActivityTest.class,
14+
CreateUserActivity.class,
15+
SelectActivityTest.class,
16+
ComponentActivityTest.class
17+
})
18+
19+
public class AppTestSuite {}
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
package com.cometchat.pro.androiduikit.app;
2+
3+
import android.content.Context;
4+
import android.content.Intent;
5+
import android.util.Log;
6+
import android.view.View;
7+
8+
import androidx.recyclerview.widget.RecyclerView;
9+
import androidx.test.espresso.Espresso;
10+
import androidx.test.espresso.NoMatchingViewException;
11+
import androidx.test.espresso.PerformException;
12+
import androidx.test.espresso.ViewAssertion;
13+
import androidx.test.espresso.ViewInteraction;
14+
import androidx.test.espresso.action.ViewActions;
15+
import androidx.test.espresso.assertion.ViewAssertions;
16+
import androidx.test.espresso.contrib.RecyclerViewActions;
17+
import androidx.test.espresso.matcher.ViewMatchers;
18+
import androidx.test.platform.app.InstrumentationRegistry;
19+
import androidx.test.rule.ActivityTestRule;
20+
import androidx.test.uiautomator.By;
21+
import androidx.test.uiautomator.UiDevice;
22+
import androidx.test.uiautomator.Until;
23+
24+
import com.cometchat.pro.androiduikit.ComponentListActivity;
25+
import com.cometchat.pro.androiduikit.R;
26+
import com.cometchat.pro.androiduikit.utils.RecyclerViewAssertion;
27+
28+
import org.junit.Assert;
29+
import org.junit.Before;
30+
import org.junit.FixMethodOrder;
31+
import org.junit.Rule;
32+
import org.junit.Test;
33+
import org.junit.runners.MethodSorters;
34+
35+
import static androidx.test.espresso.action.ViewActions.clearText;
36+
import static androidx.test.espresso.action.ViewActions.click;
37+
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
38+
import static androidx.test.espresso.action.ViewActions.pressBack;
39+
import static androidx.test.espresso.assertion.ViewAssertions.matches;
40+
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
41+
import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
42+
import static androidx.test.espresso.matcher.ViewMatchers.withId;
43+
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
44+
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
45+
import static org.hamcrest.core.AllOf.allOf;
46+
47+
48+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
49+
public class ComponentActivityTest {
50+
51+
52+
private static final String BASIC_SAMPLE_PACKAGE
53+
= "com.cometchat.pro.androiduikit";
54+
55+
private static final int LAUNCH_TIMEOUT = 5000;
56+
57+
private UiDevice mDevice;
58+
59+
@Rule
60+
public ActivityTestRule<ComponentListActivity> activityRule = new ActivityTestRule<>(ComponentListActivity.class, true, false);
61+
62+
@Before
63+
public void setup() {
64+
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
65+
Context context = getInstrumentation().getContext();
66+
Intent intent = context.getPackageManager()
67+
.getLaunchIntentForPackage(BASIC_SAMPLE_PACKAGE);
68+
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
69+
70+
// Clear out any previous instances
71+
context.startActivity(intent);
72+
mDevice.wait(Until.hasObject(By.pkg(BASIC_SAMPLE_PACKAGE).depth(0)), LAUNCH_TIMEOUT);
73+
Espresso.onView(ViewMatchers.withId(R.id.componentLaunch)).perform(ViewActions.scrollTo());
74+
Espresso.onView(ViewMatchers.withId(R.id.componentLaunch)).perform(ViewActions.click());
75+
}
76+
77+
@Test
78+
public void A_checkAvatar() {
79+
80+
//Check Components
81+
try {
82+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_avatar)).perform(ViewActions.scrollTo());
83+
Espresso.onView(withId(R.id.cometchat_avatar)).perform(click());
84+
Espresso.onView(withId(R.id.borderWidth)).perform(ViewActions.typeText("5"))
85+
.perform(closeSoftKeyboard());
86+
Thread.sleep(2000);
87+
Espresso.onView(withId(R.id.borderWidth)).perform(pressBack());
88+
mDevice.pressBack();
89+
} catch (Exception e) {
90+
e.printStackTrace();
91+
}
92+
}
93+
94+
@Test
95+
public void B_checkBadgeCount() {
96+
try {
97+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_badge_count)).perform(ViewActions.scrollTo());
98+
Espresso.onView(withId(R.id.cometchat_badge_count)).perform(click());
99+
Espresso.onView(withId(R.id.badgeCount_edt)).perform(clearText())
100+
.perform(ViewActions.typeText("9999"));
101+
Thread.sleep(2000);
102+
Espresso.onView(withId(R.id.countSize)).perform(clearText())
103+
.perform(ViewActions.typeText("12"))
104+
.perform(closeSoftKeyboard());
105+
Thread.sleep(2000);
106+
Espresso.onView(withId(R.id.countSize)).perform(pressBack());
107+
mDevice.pressBack();
108+
} catch (Exception e) {
109+
e.printStackTrace();
110+
}
111+
}
112+
113+
@Test
114+
public void C_checkStatusIndicator() {
115+
try {
116+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_status_indicator)).perform(ViewActions.scrollTo());
117+
Espresso.onView(withId(R.id.cometchat_status_indicator)).perform(click());
118+
Espresso.onView(withId(R.id.offline)).perform(click());
119+
Espresso.onView(withId(R.id.offline)).check(matches(ViewMatchers.isChecked()));
120+
121+
Espresso.onView(withId(R.id.online)).perform(click());
122+
Espresso.onView(withId(R.id.online)).check(matches(ViewMatchers.isChecked()))
123+
.perform(closeSoftKeyboard()).perform(pressBack());
124+
mDevice.pressBack();
125+
} catch (Exception e) {
126+
e.printStackTrace();
127+
}
128+
}
129+
130+
@Test
131+
public void J_checkCallList() {
132+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).perform(ViewActions.scrollTo());
133+
try {
134+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).check(matches(isDisplayed()));
135+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).perform(click());
136+
} catch (AssertionError e) {
137+
Log.e("D_checkCallList: ",e.getMessage() );
138+
} catch (NoMatchingViewException e) {
139+
Log.e("D_checkCallList: ",e.getMessage() );
140+
}
141+
try {
142+
143+
Espresso.onView(ViewMatchers.withId(R.id.callList_rv))
144+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
145+
} catch (PerformException e) {
146+
Assert.assertTrue("View Not loaded",true);
147+
} catch (Exception e) {
148+
Assert.fail();
149+
}
150+
}
151+
152+
@Test
153+
public void K_checkCallList_2Sec() {
154+
try {
155+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).perform(ViewActions.scrollTo());
156+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_callList)).perform(click());
157+
Thread.sleep(2000);
158+
Espresso.onView(ViewMatchers.withId(R.id.callList_rv))
159+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
160+
} catch (InterruptedException e) {
161+
e.printStackTrace();
162+
}
163+
}
164+
165+
@Test
166+
public void D_checkUserList() {
167+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_user_view)).perform(ViewActions.scrollTo());
168+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_user_view)).perform(click());
169+
try {
170+
Espresso.onView(ViewMatchers.withId(R.id.cometchatUserList))
171+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
172+
} catch (PerformException e) {
173+
Assert.assertTrue("View not loaded",true);
174+
} catch (Exception e) {
175+
Assert.fail();
176+
}
177+
}
178+
179+
@Test
180+
public void E_checkUserList_2Sec() {
181+
try {
182+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_user_view)).perform(ViewActions.scrollTo());
183+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_user_view)).perform(ViewActions.click());
184+
Thread.sleep(2000);
185+
Espresso.onView(ViewMatchers.withId(R.id.cometchatUserList))
186+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
187+
} catch (InterruptedException e) {
188+
e.printStackTrace();
189+
}
190+
}
191+
192+
@Test
193+
public void F_checkGroupList() {
194+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.scrollTo());
195+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.click());
196+
Espresso.onView(ViewMatchers.withId(R.id.cometchatGroupList))
197+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
198+
}
199+
200+
@Test
201+
public void G_checkGroupList_2Sec() {
202+
try {
203+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.scrollTo());
204+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_group_view)).perform(ViewActions.click());
205+
Thread.sleep(2000);
206+
Espresso.onView(ViewMatchers.withId(R.id.cometchatGroupList))
207+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
208+
} catch (InterruptedException e) {
209+
e.printStackTrace();
210+
}
211+
}
212+
213+
@Test
214+
public void H_checkConversationList() {
215+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.scrollTo());
216+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.click());
217+
try {
218+
Espresso.onView(ViewMatchers.withId(R.id.cometchatConversationList))
219+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
220+
} catch (PerformException e) {
221+
Assert.assertTrue("View not loaded",true);
222+
} catch (Exception e) {
223+
Assert.fail();
224+
}
225+
}
226+
227+
@Test
228+
public void I_checkConversationList_2Sec() {
229+
try {
230+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.scrollTo());
231+
Espresso.onView(ViewMatchers.withId(R.id.cometchat_conversation_view)).perform(ViewActions.click());
232+
Thread.sleep(2000);
233+
Espresso.onView(ViewMatchers.withId(R.id.cometchatConversationList))
234+
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
235+
} catch (InterruptedException e) {
236+
e.printStackTrace();
237+
}
238+
}
239+
240+
// RecyclerView callRv = activityRule.getActivity().findViewById(R.id.cometchat_callList);
241+
// int itemCount = callRv.getAdapter().getItemCount();
242+
// if (itemCount>0) {
243+
// Espresso.onView(withId(R.id.cometchat_callList)).perform(click());
244+
// }
245+
246+
}

0 commit comments

Comments
 (0)