Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4294 'added profile deleted message' #4560

Closed
wants to merge 26 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
69bbc79
added profile deleted message
mbobiosio Sep 6, 2022
b386cdb
fixed classes in alphabetical order
mbobiosio Sep 7, 2022
f1e3428
added kdoc
mbobiosio Sep 8, 2022
5ff1077
reviewed comments
mbobiosio Sep 9, 2022
a92c3ed
outside touch for dialog
mbobiosio Sep 9, 2022
1d634af
updated tag
mbobiosio Sep 13, 2022
7882cf7
set outside cancelable to true
mbobiosio Sep 13, 2022
5daf12d
updated tag id
mbobiosio Sep 15, 2022
c0f91a2
added new tests
mbobiosio Sep 16, 2022
3492144
added new tests
mbobiosio Sep 16, 2022
4793299
added new tests
mbobiosio Sep 16, 2022
047c6e0
updated KDoc for tag
mbobiosio Sep 20, 2022
c1274d4
excluded DeleteProfileSuccessDialogFragment in test_file_exemptions.t…
mbobiosio Sep 21, 2022
96d628d
completed unit testing
mbobiosio Sep 23, 2022
2508427
updated comment for new instance
mbobiosio Sep 29, 2022
fa4b79b
removed 'check' from name
mbobiosio Sep 30, 2022
80f8b48
removed unnecessary space
mbobiosio Sep 30, 2022
df71f74
injected AppLanguageResourceHandler for dialog
mbobiosio Sep 30, 2022
af3f9f0
closing dialog and validating activity is running
mbobiosio Oct 4, 2022
d4d176e
closing dialog and validating activity is running -fixed ktlint
mbobiosio Oct 4, 2022
67eca56
added activity state check after closing dialog
mbobiosio Oct 4, 2022
dc9cdb6
removed activitytestrule
mbobiosio Oct 5, 2022
958357d
Merge branch 'develop' into delete-profile-message
mbobiosio Oct 5, 2022
4f5947e
removed unnecessary checks
mbobiosio Oct 13, 2022
1c07fef
removed the test to verify intent
mbobiosio Oct 13, 2022
0e361e6
fixed unused imports
mbobiosio Oct 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot
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 com.google.common.truth.Truth.assertThat
import dagger.Component
import org.hamcrest.CoreMatchers.not
import org.junit.After
Expand Down Expand Up @@ -116,6 +118,13 @@ class ProfileEditActivityTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
var activityTestRule: ActivityTestRule<ProfileListActivity> = ActivityTestRule(
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
ProfileListActivity::class.java,
true,
false
)

@Inject
lateinit var context: Context

Expand Down Expand Up @@ -254,7 +263,7 @@ class ProfileEditActivityTest {
}

@Test
fun testProfileEdit_deleteProfileSuccessful_clickCancel() {
fun testProfileEdit_deleteProfileSuccessful_clickCancel_closesDeleteDialog() {
launch<ProfileEditActivity>(
ProfileEditActivity.createProfileEditActivity(
context = context,
Expand All @@ -266,7 +275,12 @@ class ProfileEditActivityTest {
verifyTextInDialog(textInDialogId = R.string.profile_edit_delete_dialog_title)
verifyTextInDialog(textInDialogId = R.string.profile_edit_delete_dialog_message)
onView(withText(R.string.profile_edit_delete_dialog_negative)).perform(click())
onView(withId(R.id.profile_delete_button)).check(matches(isDisplayed()))

activityTestRule.launchActivity(null)
testCoroutineDispatchers.advanceUntilIdle()
BenHenning marked this conversation as resolved.
Show resolved Hide resolved

// Closing the dialog does not close the activity.
assertThat(activityTestRule.activity.isFinishing).isFalse()
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -284,11 +298,18 @@ class ProfileEditActivityTest {
verifyTextInDialog(textInDialogId = R.string.profile_edit_delete_dialog_message)
onView(withText(R.string.profile_edit_delete_dialog_positive)).check(matches(isDisplayed()))
onView(withText(R.string.profile_edit_delete_dialog_positive)).perform(click())

activityTestRule.launchActivity(null)
testCoroutineDispatchers.advanceUntilIdle()

if (context.resources.getBoolean(R.bool.isTablet)) {
intended(hasComponent(AdministratorControlsActivity::class.java.name))
} else {
intended(hasComponent(ProfileListActivity::class.java.name), times(0))
intended(hasComponent(ProfileListActivity::class.java.name))
}

// Closing the dialog does not close the activity.
assertThat(activityTestRule.activity.isFinishing).isFalse()
}
}

Expand Down