Fix ErrorPanelTest after changes to exception classifications
This commit is contained in:
parent
60615e6b9e
commit
abf9a80715
@ -14,8 +14,8 @@ import org.junit.runner.RunWith
|
||||
import org.schabi.newpipe.R
|
||||
import org.schabi.newpipe.error.ErrorInfo
|
||||
import org.schabi.newpipe.error.UserAction
|
||||
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException
|
||||
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
|
||||
import org.schabi.newpipe.extractor.exceptions.UnsupportedContentInCountryException
|
||||
import org.schabi.newpipe.ui.theme.AppTheme
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@ -71,10 +71,10 @@ class ErrorPanelTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Recaptcha Error shows solve, retry and open in browser buttons
|
||||
* Test Recaptcha Error shows all buttons: solve, retry, open in browser, report
|
||||
*/
|
||||
@Test
|
||||
fun recaptchaErrorShowsSolveAndRetryOpenInBrowserButtons() {
|
||||
fun recaptchaErrorShowsAllButtons() {
|
||||
var retryClicked = false
|
||||
val recaptchaErrorInfo = ErrorInfo(
|
||||
throwable = ReCaptchaException(
|
||||
@ -99,7 +99,7 @@ class ErrorPanelTest {
|
||||
composeRule.onNodeWithText(text(R.string.open_in_browser), ignoreCase = true)
|
||||
.assertIsDisplayed()
|
||||
composeRule.onNodeWithText(text(R.string.error_snackbar_action), ignoreCase = true)
|
||||
.assertDoesNotExist()
|
||||
.assertIsDisplayed()
|
||||
assert(retryClicked) { "onRetry callback should have been invoked" }
|
||||
}
|
||||
|
||||
@ -109,14 +109,14 @@ class ErrorPanelTest {
|
||||
@Test
|
||||
fun testNonRetryableErrorHidesRetryAndReportButtons() {
|
||||
val contentNotAvailable = ErrorInfo(
|
||||
throwable = ContentNotAvailableException("Video has been removed"),
|
||||
throwable = UnsupportedContentInCountryException("Not available here"),
|
||||
userAction = UserAction.REQUESTED_STREAM,
|
||||
request = "https://example.com/watch?v=qux"
|
||||
)
|
||||
|
||||
setErrorPanel(contentNotAvailable)
|
||||
|
||||
composeRule.onNodeWithText(text(R.string.content_not_available))
|
||||
composeRule.onNodeWithText(text(R.string.unsupported_content_in_country))
|
||||
.assertIsDisplayed()
|
||||
composeRule.onNodeWithText(text(R.string.retry), ignoreCase = true)
|
||||
.assertDoesNotExist()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user