You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/09/02 07:46:56 UTC

[GitHub] [fineract-cn-mobile] jawidMuhammadi commented on a change in pull request #112: Feat: Add UI/Integration tests for creating group, group list and group details

jawidMuhammadi commented on a change in pull request #112:
URL: https://github.com/apache/fineract-cn-mobile/pull/112#discussion_r481845840



##########
File path: app/src/androidTest/java/org/apache/fineract/ui/online/groups/creategroup/CreateGroupActivityAndroidTest.kt
##########
@@ -0,0 +1,87 @@
+package org.apache.fineract.ui.online.groups.creategroup
+
+import android.content.Intent
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.action.ViewActions.click
+import androidx.test.espresso.action.ViewActions.typeText
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.espresso.matcher.ViewMatchers.withText
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.rule.ActivityTestRule
+import org.apache.fineract.R
+import org.apache.fineract.ui.online.groups.GroupAction
+import org.apache.fineract.utils.Constants
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * Created by Ahmad Jawid Muhammadi on 30/8/20.
+ */
+
+@RunWith(AndroidJUnit4::class)
+class CreateGroupActivityAndroidTest {
+
+    @get:Rule
+    var activityTestRule =
+            ActivityTestRule<CreateGroupActivity>(CreateGroupActivity::class.java, false, false)
+
+    @Before
+    fun before() {
+        //Open CreateGroupActivity with an intent by putting  create group action as an extra
+        val intent = Intent().apply {
+            putExtra(Constants.GROUP_ACTION, GroupAction.CREATE)
+        }
+        activityTestRule.launchActivity(intent)
+    }
+
+    @Test
+    fun createGroupItem() {
+        onView(withId(R.id.etIdentifier))
+                .perform(typeText("testIdentifier"))
+        onView(withId(R.id.etGroupDefinitionIdentifier))
+                .perform(typeText("group definition"))
+        onView(withId(R.id.etName))
+                .perform(typeText("group name"))
+        onView(withId(R.id.etOffice))
+                .perform(typeText("office name"))
+        onView(withId(R.id.etAssignedEmployee))
+                .perform(typeText("assignedEmployee"))
+
+        //go to next fragment
+        onView(withText("NEXT")).perform(click())
+
+        //Add a member
+        onView(withId(R.id.ibAddMember))
+                .perform(click())
+        onView(withId(R.id.etNewMember))
+                .perform(typeText("Ahmad"))
+        onView(withId((R.id.btnAddMember)))
+                .perform(click())
+        onView(withText("NEXT")).perform(click())
+
+        //Add leader name
+        onView(withId(R.id.ibAddLeader))
+                .perform(click())
+        onView(withId(R.id.etNewLeader))
+                .perform(typeText("Jawid"))
+        onView(withId((R.id.btnAddLeader)))
+                .perform(click())
+        onView(withText("NEXT")).perform(click())
+
+        //fill address details
+        onView(withId(R.id.etStreet))
+                .perform(typeText("Street"))
+        onView(withId(R.id.etCity))
+                .perform(typeText("Pune"))
+        onView(withId(R.id.etRegion))
+                .perform(typeText("Region"))
+        onView(withId(R.id.etPostalCode))
+                .perform(typeText("411048"))
+        onView(withId(R.id.etCountry))
+                .perform(typeText("India"))
+        onView(withText("NEXT")).perform(click())
+        onView(withText("COMPLETE")).perform(click())

Review comment:
       Thanks for reviewing the PR, yeah you are right, I will update the PR. Actually in here, after COMPLETE button clicked we are making a fake API call only, I have thought it might not necessary to assert it




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org