@@ -0,0 +1,2534 @@
+/*%0A * Copyright (c) 2017 CMPUT301F17T15. This project is distributed under the MIT license.%0A */%0A%0Apackage com.cmput301.cia.intent;%0A%0Aimport android.app.Activity;%0Aimport android.test.ActivityInstrumentationTestCase2;%0Aimport android.widget.EditText;%0Aimport android.util.Log;%0A%0Aimport com.cmput301.cia.R;%0Aimport com.cmput301.cia.activities.FilterEventsActivity;%0Aimport com.cmput301.cia.activities.HistoryActivity;%0Aimport com.cmput301.cia.activities.HomePageActivity;%0Aimport com.robotium.solo.Solo;%0A%0A/**%0A * Created by guanfang on 2017/11/12.%0A */%0A%0Apublic class HabitHistoryIntentTests extends ActivityInstrumentationTestCase2 %7B%0A    private Solo solo;%0A%0A    public HabitHistoryIntentTests()%7B%0A        super(com.cmput301.cia.activities.HistoryActivity.class);%0A    %7D%0A%0A    public void setUp() throws Exception%7B%0A        solo = new Solo(getInstrumentation(), getActivity());%0A    %7D%0A%0A    public void testStart() throws Exception%7B%0A        Activity activity = getActivity();%0A    %7D%0A%0A    public void testNavigation()throws Exception%7B%0A        // test current activity%0A        solo.assertCurrentActivity(%22wrong activity%22, HistoryActivity.class);%0A        // test return button works?%0A        solo.clickOnButton(%22Return%22);%0A        solo.sleep(300);%0A        solo.assertCurrentActivity(%22wrong activity%22, HomePageActivity.class);%0A        // test habits button words?%0A        solo.clickOnButton(%22Habits%22);%0A        solo.sleep(300);%0A        solo.assertCurrentActivity(%22wrong activity%22, FilterEventsActivity.class);%0A    %7D%0A%0A    public void testCheck()throws Exception%7B%0A        // test can check works?%0A        boolean actual1 = solo.isCheckBoxChecked(%22Type%22);%0A        assertEquals(%22Filter is Selected%22,false, actual1);%0A        // if click?%0A        solo.clickOnCheckBox(5);%0A        solo.sleep(300);%0A        boolean actual2 = solo.isCheckBoxChecked(%22Type%22);%0A        assertEquals(%22Filter is not Selected%22,true, actual2);%0A    %7D%0A%0A    public void testEditText()throws Exception%7B%0A        // try to enter the text%0A        solo.clickOnEditText(1);%0A        String strInput = %22Sample code 1%22;%0A        solo.sleep(300);%0A        solo.enterText(1, strInput);%0A        solo.sleep(300);%0A        boolean actual = solo.searchEditText(strInput);%0A        assertEquals(%22text entered is not matching%22,true, actual);%0A        // clear all text%0A        solo.clearEditText(1);%0A        solo.sleep(300);%0A        strInput = %22Sample code 2%22;%0A        solo.typeText(1, strInput);%0A        actual = solo.searchEditText(strInput);%0A        assertEquals(%22text entered is not matching%22,true, actual);%0A    %7D%0A%7D%0A

add test case for habithistory