-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted AddNewRepeatDialog to kotlin
- Loading branch information
1 parent
e58d42b
commit c91e839
Showing
2 changed files
with
30 additions
and
39 deletions.
There are no files selected for viewing
39 changes: 0 additions & 39 deletions
39
...ct_app/src/androidTest/java/org/odk/collect/android/support/pages/AddNewRepeatDialog.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
collect_app/src/androidTest/java/org/odk/collect/android/support/pages/AddNewRepeatDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.odk.collect.android.support.pages | ||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.RootMatchers.isDialog | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withText | ||
import org.odk.collect.strings.R | ||
|
||
class AddNewRepeatDialog(private val repeatName: String?) : Page<AddNewRepeatDialog>() { | ||
override fun assertOnPage(): AddNewRepeatDialog { | ||
val dialogMessage = if (repeatName.isNullOrBlank()) { | ||
getTranslatedString(R.string.add_another_question) | ||
} else { | ||
getTranslatedString(R.string.add_repeat_question, repeatName) | ||
} | ||
onView(withText(dialogMessage)) | ||
.inRoot(isDialog()) | ||
.check(matches(isDisplayed())) | ||
return this | ||
} | ||
|
||
fun <D : Page<D>> clickOnAdd(destination: D): D { | ||
return clickOnTextInDialog(R.string.add_repeat, destination) | ||
} | ||
|
||
fun <D : Page<D>> clickOnDoNotAdd(destination: D): D { | ||
return clickOnTextInDialog(R.string.cancel, destination) | ||
} | ||
} |