Search in sources :

Example 1 with MainActivity

use of com.cmput301w18t05.taskzilla.activity.MainActivity in project Taskzilla by CMPUT301W18T05.

the class SearchActivityTest method testSearch.

public void testSearch() {
    // Set up for Test
    MainActivity activity = (MainActivity) solo.getCurrentActivity();
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    solo.clickOnText("Sign Up");
    solo.assertCurrentActivity("Wrong Activity", SignUpActivity.class);
    solo.enterText((EditText) solo.getView(R.id.usernameField), "TestUser");
    solo.enterText((EditText) solo.getView(R.id.nameField), "TestName");
    solo.enterText((EditText) solo.getView(R.id.emailField), "Test@Email.com");
    solo.enterText((EditText) solo.getView(R.id.phoneField), "1234567890");
    solo.clickOnButton("Sign Up");
    // Correct Log in Info
    solo.clearEditText((EditText) solo.getView(R.id.usernameText));
    solo.enterText((EditText) solo.getView(R.id.usernameText), "TestUser");
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
    solo.waitForText("Search");
    solo.clickOnText("Search");
    solo.clickOnView((SearchView) solo.getView(R.id.searchView));
    solo.sleep(9000);
// solo.enterText((EditText) solo.getView(R.id.searchView),"Task");
// solo.text
}
Also used : MainActivity(com.cmput301w18t05.taskzilla.activity.MainActivity)

Example 2 with MainActivity

use of com.cmput301w18t05.taskzilla.activity.MainActivity in project Taskzilla by CMPUT301W18T05.

the class UserProfileActivityTest method testLogIn.

public void testLogIn() {
    // Set up for Test
    MainActivity activity = (MainActivity) solo.getCurrentActivity();
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    solo.clickOnText("Sign Up");
    solo.assertCurrentActivity("Wrong Activity", SignUpActivity.class);
    solo.enterText((EditText) solo.getView(R.id.usernameField), "TestUser");
    solo.enterText((EditText) solo.getView(R.id.nameField), "TestName");
    solo.enterText((EditText) solo.getView(R.id.emailField), "Test@Email.com");
    solo.enterText((EditText) solo.getView(R.id.phoneField), "1234567890");
    solo.clickOnButton("Sign Up");
    // No Log in Info
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    // Incorrect Log in Info
    solo.enterText((EditText) solo.getView(R.id.usernameText), "123456789101112131415161718192021222324252627282930");
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    // Correct Log in Info
    solo.clearEditText((EditText) solo.getView(R.id.usernameText));
    solo.enterText((EditText) solo.getView(R.id.usernameText), "TestUser");
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
}
Also used : MainActivity(com.cmput301w18t05.taskzilla.activity.MainActivity)

Example 3 with MainActivity

use of com.cmput301w18t05.taskzilla.activity.MainActivity in project Taskzilla by CMPUT301W18T05.

the class MainActivityIntentTest method testLogIn.

public void testLogIn() {
    // Set up for Test
    MainActivity activity = (MainActivity) solo.getCurrentActivity();
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    solo.clickOnText("Sign Up");
    solo.assertCurrentActivity("Wrong Activity", SignUpActivity.class);
    solo.enterText((EditText) solo.getView(R.id.usernameField), "TestUser");
    solo.enterText((EditText) solo.getView(R.id.nameField), "TestName");
    solo.enterText((EditText) solo.getView(R.id.emailField), "Test@Email.com");
    solo.enterText((EditText) solo.getView(R.id.phoneField), "1234567890");
    solo.enterText((EditText) solo.getView(R.id.passwordField), "a");
    solo.clickOnButton("Sign Up");
    // No Log in Info
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    // Incorrect Log in Info
    solo.enterText((EditText) solo.getView(R.id.usernameText), "123456789101112131415161718192021222324252627282930");
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    // Correct Log in Info
    solo.clearEditText((EditText) solo.getView(R.id.usernameText));
    solo.enterText((EditText) solo.getView(R.id.usernameText), "TestUser");
    solo.enterText((EditText) solo.getView(R.id.passwordText), "a");
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
    assertTrue(solo.waitForActivity(WelcomeActivity.class));
}
Also used : WelcomeActivity(com.cmput301w18t05.taskzilla.activity.WelcomeActivity) MainActivity(com.cmput301w18t05.taskzilla.activity.MainActivity)

Example 4 with MainActivity

use of com.cmput301w18t05.taskzilla.activity.MainActivity in project Taskzilla by CMPUT301W18T05.

the class SearchActivityIntentTest method testSearch.

public void testSearch() {
    // Set up for Test
    MainActivity activity = (MainActivity) solo.getCurrentActivity();
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    solo.clickOnText("Sign Up");
    solo.assertCurrentActivity("Wrong Activity", SignUpActivity.class);
    solo.enterText((EditText) solo.getView(R.id.usernameField), "TestUser");
    solo.enterText((EditText) solo.getView(R.id.nameField), "TestName");
    solo.enterText((EditText) solo.getView(R.id.emailField), "Test@Email.com");
    solo.enterText((EditText) solo.getView(R.id.phoneField), "1234567890");
    solo.enterText((EditText) solo.getView(R.id.passwordField), "a");
    solo.clickOnButton("Sign Up");
    // Correct Log in Info
    solo.clearEditText((EditText) solo.getView(R.id.usernameText));
    solo.enterText((EditText) solo.getView(R.id.usernameText), "TestUser");
    solo.enterText((EditText) solo.getView(R.id.passwordText), "a");
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
    assertTrue(solo.waitForActivity(WelcomeActivity.class));
    View fab = solo.getView(R.id.fab);
    solo.waitForView(fab);
    solo.clickOnView(fab);
    solo.waitForActivity(NewTaskActivity.class);
    View taskField = solo.getView(R.id.TaskName);
    solo.waitForView(taskField);
    solo.typeText((EditText) taskField, "taskname");
    EditText descriptionField = (EditText) solo.getView(R.id.Description);
    solo.typeText(descriptionField, "testing search");
    View addButton = solo.getView(R.id.addTaskButton);
    solo.clickOnView(addButton);
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
    solo.waitForText("Search");
    solo.clickOnText("Search");
}
Also used : EditText(android.widget.EditText) WelcomeActivity(com.cmput301w18t05.taskzilla.activity.WelcomeActivity) MainActivity(com.cmput301w18t05.taskzilla.activity.MainActivity) SearchView(android.widget.SearchView) View(android.view.View)

Example 5 with MainActivity

use of com.cmput301w18t05.taskzilla.activity.MainActivity in project Taskzilla by CMPUT301W18T05.

the class UserTaskActivityIntentTest method testDeleteTask.

public void testDeleteTask() {
    MainActivity activity = (MainActivity) solo.getCurrentActivity();
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);
    solo.clickOnText("Sign Up");
    solo.assertCurrentActivity("Wrong Activity", SignUpActivity.class);
    solo.enterText((EditText) solo.getView(R.id.usernameField), "TestUser");
    solo.enterText((EditText) solo.getView(R.id.nameField), "TestName");
    solo.enterText((EditText) solo.getView(R.id.emailField), "Test@Email.com");
    solo.enterText((EditText) solo.getView(R.id.phoneField), "1234567890");
    solo.clickOnButton("Sign Up");
    solo.enterText((EditText) solo.getView(R.id.usernameText), "TestUser");
    solo.clickOnButton("Log In");
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
    // taken from https://stackoverflow.com/questions/33125017/how-to-access-floatingactionmenu-and-floating-action-button-in-robotium
    // 2018-3-17
    // View v = inflater.inflate(R.layout.fragment_tasks_requester, container, false);
    solo.waitForText("Tasks");
    View fab = solo.getCurrentActivity().findViewById(R.id.fab);
    solo.clickOnView(fab);
    solo.assertCurrentActivity("Wrong Activity", NewTaskActivity.class);
    solo.enterText((EditText) solo.getView(R.id.TaskName), "Test Task To Be Deleted");
    solo.enterText((EditText) solo.getView(R.id.Description), "Test Description");
    solo.clickOnButton("Add Task");
    solo.waitForActivity(WelcomeActivity.class);
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
    View fab2 = solo.getCurrentActivity().findViewById(R.id.fab);
    solo.clickOnView(fab2);
    assertTrue(solo.waitForText("Test Task To Be Deleted"));
    solo.clickOnText("Test Task To Be Deleted");
    solo.assertCurrentActivity("Wrong Activity", ViewTaskActivity.class);
    solo.waitForText("Test Task to Be Deleted");
    View DeleteButton = solo.getCurrentActivity().findViewById(R.id.DeleteButton);
    solo.clickOnView(DeleteButton);
    solo.clickOnText(("Yes"));
    solo.waitForActivity(WelcomeActivity.class);
    solo.assertCurrentActivity("Wrong Activity", WelcomeActivity.class);
}
Also used : MainActivity(com.cmput301w18t05.taskzilla.activity.MainActivity) View(android.view.View)

Aggregations

MainActivity (com.cmput301w18t05.taskzilla.activity.MainActivity)17 View (android.view.View)11 WelcomeActivity (com.cmput301w18t05.taskzilla.activity.WelcomeActivity)2 EditText (android.widget.EditText)1 ImageButton (android.widget.ImageButton)1 SearchView (android.widget.SearchView)1