1
0
Fork 0

Fix UI tests.

We need to pass a CoordinatorLayout instead of a SwipeGestureLayout to
FenixSnackbar.make() in BaseBrowserFragment to prevent UI tests from
breaking. We also need to remove a few view IDs from the tab preview.
master
Kainalu Hagiwara 2020-07-16 16:30:27 -07:00 committed by Jeff Boek
parent e7dc5580b2
commit 58ccc64386
4 changed files with 19 additions and 16 deletions

View File

@ -385,7 +385,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
tryAgain = downloadFeature::tryAgain,
onCannotOpenFile = {
FenixSnackbar.make(
view = view,
view = view.browserLayout,
duration = Snackbar.LENGTH_SHORT,
isDisplayedWithBrowserToolbar = true
)
@ -649,7 +649,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
val onCannotOpenFile = {
FenixSnackbar.make(
view = view,
view = view.browserLayout,
duration = Snackbar.LENGTH_SHORT,
isDisplayedWithBrowserToolbar = true
)
@ -932,7 +932,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
view?.let { view ->
FenixSnackbar.make(
view = view,
view = view.browserLayout,
duration = FenixSnackbar.LENGTH_LONG,
isDisplayedWithBrowserToolbar = true
)
@ -978,7 +978,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
// Close find in page bar if opened
findInPageIntegration.onBackPressed()
FenixSnackbar.make(
view = requireView(),
view = requireView().browserLayout,
duration = Snackbar.LENGTH_SHORT,
isDisplayedWithBrowserToolbar = false
)

View File

@ -258,7 +258,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
}
}
FenixSnackbar.make(
view = view,
view = view.browserLayout,
duration = Snackbar.LENGTH_SHORT,
isDisplayedWithBrowserToolbar = true
)

View File

@ -8,10 +8,11 @@ import android.content.Context
import android.util.AttributeSet
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.updateLayoutParams
import kotlinx.android.synthetic.main.mozac_ui_tabcounter_layout.view.*
import kotlinx.android.synthetic.main.tab_preview.view.*
import mozilla.components.browser.thumbnails.loader.ThumbnailLoader
import mozilla.components.support.images.ext.loadIntoView
@ -44,12 +45,9 @@ class TabPreview @JvmOverloads constructor(
)
}
menuButton.setColorFilter(
ContextCompat.getColor(
context,
ThemeManager.resolveAttribute(R.attr.primaryText, context)
)
)
// Change view properties to avoid confusing the UI tests
tab_button.counter_box.id = View.NO_ID
tab_button.counter_text.id = View.NO_ID
}
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {

View File

@ -2,7 +2,9 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<mozilla.components.browser.tabstray.thumbnail.TabThumbnailView
android:id="@+id/previewThumbnail"
android:layout_width="match_parent"
@ -23,10 +25,10 @@
android:id="@+id/toolbar_wrapper"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginEnd="0dp"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@drawable/home_search_background" />
<org.mozilla.fenix.components.toolbar.TabCounter
@ -35,10 +37,13 @@
android:layout_height="48dp"
android:layout_gravity="center" />
<mozilla.components.browser.menu.view.MenuButton
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/menuButton"
android:layout_width="36dp"
android:layout_height="48dp"
android:layout_gravity="center" />
android:layout_gravity="center"
android:scaleType="center"
app:srcCompat="@drawable/ic_menu"
app:tint="?primaryText" />
</LinearLayout>
</merge>