package ca.ualberta.CMPUT301W15T06.test;

import ca.ualberta.CMPUT301W15T06.ClaimantClaimListActivity;
import android.app.Activity;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.view.View;
import android.widget.Button;

public class ClaimantClaimListActivityUITest extends
		ActivityInstrumentationTestCase2<ClaimantClaimListActivity> {

	Activity activity;
	Instrumentation instrumentation;
	

	public ClaimantClaimListActivityUITest() {
		super(ClaimantClaimListActivity.class);
	}
	
	protected void setUp() throws Exception{
		super.setUp();
		instrumentation = getInstrumentation();
		
		
	}

	
	//test claim list 
	public void testClaim(){
		assertNotNull(activity.findViewById(ca.ualberta.CMPUT301W15T06.R.id.claimListView));
		((View) activity.findViewById(ca.ualberta.CMPUT301W15T06.R.id.claimListView)).performClick();
	}
	
	//test ClaimList (listView) long click
	public void testLongClick(){
		
	}

		
	//US 09.01.01
	public void testPushOnline() {
		// click button runnable -- click push online
		final Button button1 = ((Button) activity.findViewById(ca.ualberta.CMPUT301W15T06.R.id.claimListView));
		activity.runOnUiThread(new Runnable() {
		@Override
		public void run() {
		button1.performClick();
		}
		});
	}


}
@@ -215,16 +215,49 @@
 tCase2;%0A
+import android.view.ContextMenu;%0A
 import a
@@ -303,16 +303,48 @@
 .Button;
+%0Aimport android.widget.GridView;
 %0A%0Apublic
@@ -510,16 +510,28 @@
 ation;%0A%09
+GridView gv;
 %0A%0A%09publi
@@ -718,16 +718,134 @@
 on();%0A%09%09
+activity = getActivity();%0A%09%09gv = (GridView) getActivity().findViewById(ca.ualberta.CMPUT301W15T06.R.id.claimListView);
 %0A%09%09%0A%09%7D%0A%0A
@@ -1079,24 +1079,48 @@
 ();%0A%09%7D%0A%09%0A%09//
+US01.02.01 & US01.03.01 
 test ClaimLi
@@ -1125,11 +1125,10 @@
 List
- (l
+(L
 istV
@@ -1136,18 +1136,19 @@
 ew) 
-long click
+ContextMenu
 %0A%09pu
@@ -1165,22 +1165,486 @@
 test
-LongClick()%7B%0A%09
+ContextMenu()%7B%0A%09%09activity.findViewById(ca.ualberta.CMPUT301W15T06.R.id.claimListView).performLongClick();%0A%09%09%0A%09%09final ContextMenu contextMenu = (ContextMenu) getActivity().getBaseContext();%0A%09%09    assertTrue(contextMenu != null);%0A%0A%09%09    getActivity().runOnUiThread(new Runnable() %7B%0A%09%09        public void run() %7B%0A%09%09            contextMenu.performIdentifierAction(ca.ualberta.CMPUT301W15T06.R.id.claimListView, 0);%0A%09%09        %7D%0A%09%09    %7D);%0A%09%09    getInstrumentation().waitForIdleSync();
 %09%0A%09%7D

modify UI test case for US01