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

View File

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

View File

@ -8,10 +8,11 @@ import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import androidx.core.view.updateLayoutParams import androidx.core.view.updateLayoutParams
import kotlinx.android.synthetic.main.mozac_ui_tabcounter_layout.view.*
import kotlinx.android.synthetic.main.tab_preview.view.* import kotlinx.android.synthetic.main.tab_preview.view.*
import mozilla.components.browser.thumbnails.loader.ThumbnailLoader import mozilla.components.browser.thumbnails.loader.ThumbnailLoader
import mozilla.components.support.images.ext.loadIntoView import mozilla.components.support.images.ext.loadIntoView
@ -44,12 +45,9 @@ class TabPreview @JvmOverloads constructor(
) )
} }
menuButton.setColorFilter( // Change view properties to avoid confusing the UI tests
ContextCompat.getColor( tab_button.counter_box.id = View.NO_ID
context, tab_button.counter_text.id = View.NO_ID
ThemeManager.resolveAttribute(R.attr.primaryText, context)
)
)
} }
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { 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 <!-- 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 - 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/. --> - 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 <mozilla.components.browser.tabstray.thumbnail.TabThumbnailView
android:id="@+id/previewThumbnail" android:id="@+id/previewThumbnail"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -23,10 +25,10 @@
android:id="@+id/toolbar_wrapper" android:id="@+id/toolbar_wrapper"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_gravity="center"
android:background="@drawable/home_search_background" /> android:background="@drawable/home_search_background" />
<org.mozilla.fenix.components.toolbar.TabCounter <org.mozilla.fenix.components.toolbar.TabCounter
@ -35,10 +37,13 @@
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="center" /> android:layout_gravity="center" />
<mozilla.components.browser.menu.view.MenuButton <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/menuButton" android:id="@+id/menuButton"
android:layout_width="36dp" android:layout_width="36dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="center" /> android:layout_gravity="center"
android:scaleType="center"
app:srcCompat="@drawable/ic_menu"
app:tint="?primaryText" />
</LinearLayout> </LinearLayout>
</merge> </merge>