mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Fixed: testUserCanSeeNotesForDeletedFiles
which sometimes fails on CI due to androidx.test.espresso.base.RootViewPicker$RootViewWithoutFocusException
.
This commit is contained in:
parent
54a66d1084
commit
4bc4d0a981
@ -145,10 +145,7 @@ class NoteFragmentTest : BaseActivityTest() {
|
||||
clickOnSavedNote(composeTestRule)
|
||||
clickOnOpenNote(composeTestRule)
|
||||
assertNoteSaved(composeTestRule)
|
||||
// to close the note dialog.
|
||||
pressBack()
|
||||
// to close the notes fragment.
|
||||
pressBack()
|
||||
closeAddNoteDialog(composeTestRule)
|
||||
}
|
||||
|
||||
// goto local library fragment to delete the ZIM file
|
||||
@ -185,7 +182,7 @@ class NoteFragmentTest : BaseActivityTest() {
|
||||
assertNoteDialogDisplayed(composeTestRule)
|
||||
writeDemoNote(composeTestRule)
|
||||
saveNote(composeTestRule)
|
||||
pressBack()
|
||||
closeAddNoteDialog(composeTestRule)
|
||||
openNoteFragment(kiwixMainActivity as CoreMainActivity, composeTestRule)
|
||||
assertToolbarExist(composeTestRule)
|
||||
clickOnSavedNote(composeTestRule)
|
||||
@ -204,7 +201,7 @@ class NoteFragmentTest : BaseActivityTest() {
|
||||
assertNoteDialogDisplayed(composeTestRule)
|
||||
writeDemoNote(composeTestRule)
|
||||
saveNote(composeTestRule)
|
||||
pressBack()
|
||||
closeAddNoteDialog(composeTestRule)
|
||||
openNoteFragment(kiwixMainActivity as CoreMainActivity, composeTestRule)
|
||||
assertToolbarExist(composeTestRule)
|
||||
clickOnSavedNote(composeTestRule)
|
||||
@ -227,7 +224,7 @@ class NoteFragmentTest : BaseActivityTest() {
|
||||
assertNoteDialogDisplayed(composeTestRule)
|
||||
writeDemoNote(composeTestRule)
|
||||
saveNote(composeTestRule)
|
||||
pressBack()
|
||||
closeAddNoteDialog(composeTestRule)
|
||||
}
|
||||
// Delete that note from "Note" screen.
|
||||
deletePreviouslySavedNotes()
|
||||
|
@ -36,6 +36,7 @@ import androidx.test.espresso.web.webdriver.Locator
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.main.ADD_NOTE_DIALOG_CLOSE_IMAGE_BUTTON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.ADD_NOTE_TEXT_FILED_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.main.DELETE_MENU_BUTTON_TESTING_TAG
|
||||
@ -180,6 +181,15 @@ class NoteRobot : BaseRobot() {
|
||||
})
|
||||
}
|
||||
|
||||
fun closeAddNoteDialog(composeTestRule: ComposeContentTestRule) {
|
||||
testFlakyView({
|
||||
composeTestRule.apply {
|
||||
waitForIdle()
|
||||
onNodeWithTag(ADD_NOTE_DIALOG_CLOSE_IMAGE_BUTTON_TESTING_TAG).performClick()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun clickOnDeleteIcon(composeTestRule: ComposeContentTestRule) {
|
||||
testFlakyView({
|
||||
composeTestRule.waitForIdle()
|
||||
|
@ -74,6 +74,8 @@ import javax.inject.Inject
|
||||
* Notes are saved as text files at location: "{External Storage}/Kiwix/Notes/ZimFileName/ArticleUrl.txt"
|
||||
*/
|
||||
|
||||
const val ADD_NOTE_DIALOG_CLOSE_IMAGE_BUTTON_TESTING_TAG = "addNoteDialogCloseImageButtonTestingTag"
|
||||
|
||||
class AddNoteDialog : DialogFragment() {
|
||||
private lateinit var zimId: String
|
||||
private var zimFileName: String? = null
|
||||
@ -180,7 +182,8 @@ class AddNoteDialog : DialogFragment() {
|
||||
onClick = {
|
||||
exitAddNoteDialog()
|
||||
closeKeyboard()
|
||||
}
|
||||
},
|
||||
testingTag = ADD_NOTE_DIALOG_CLOSE_IMAGE_BUTTON_TESTING_TAG
|
||||
)
|
||||
},
|
||||
noteText = noteText.value,
|
||||
|
Loading…
x
Reference in New Issue
Block a user