1
0
Fork 0

Closes #9189: Fixes "static asset not found" error in doNotSaveLoginFromPromptTest, saveLoginFromPromptTest UI tests (#9439)

AndroidAssetDispatcher class dispatcher was attempting to open a local asset with a query suffix from the request. If query suffix is found, remove it. Re-enable saveLoginFromPromptTest() and doNotSaveLoginFromPromptTest()
master
Aaron Train 2020-03-30 18:01:58 -04:00 committed by GitHub
parent 9679b91e82
commit 4d139d52c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -62,12 +62,12 @@ const val HTTP_NOT_FOUND = 404
class AndroidAssetDispatcher : Dispatcher() {
private val mainThreadHandler = Handler(Looper.getMainLooper())
override fun dispatch(request: RecordedRequest): MockResponse {
override fun dispatch(request: RecordedRequest?): MockResponse {
val assetManager = InstrumentationRegistry.getInstrumentation().context.assets
try {
val pathNoLeadingSlash = request.path.drop(1)
assetManager.open(pathNoLeadingSlash).use { inputStream ->
return fileToResponse(pathNoLeadingSlash, inputStream)
val pathWithoutQueryParams = Uri.parse(request?.path?.drop(1)).path
assetManager.open(pathWithoutQueryParams!!).use { inputStream ->
return fileToResponse(pathWithoutQueryParams, inputStream)
}
} catch (e: IOException) { // e.g. file not found.
// We're on a background thread so we need to forward the exception to the main thread.

View File

@ -140,7 +140,6 @@ class SettingsPrivacyTest {
}
@Test
@Ignore("Passes locally, fails on CI. Fix in https://github.com/mozilla-mobile/fenix/issues/9189")
fun saveLoginFromPromptTest() {
val saveLoginTest =
TestAssetHelper.getSaveLoginAsset(mockWebServer)
@ -166,7 +165,6 @@ class SettingsPrivacyTest {
}
@Test
@Ignore("Passes locally, fails on CI. Fix in https://github.com/mozilla-mobile/fenix/issues/9189")
fun doNotSaveLoginFromPromptTest() {
val saveLoginTest = TestAssetHelper.getSaveLoginAsset(mockWebServer)