@@ -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) {
0 commit comments