woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
277 stars 135 forks source link

Fix ignored OrdersUITest #12963

Open irfano opened 3 days ago

irfano commented 3 days ago

Description

OrdersUITest was ignored during toolbar refactoring process. Some parts of the order-related tests were addressed in #12906. This PR resolves the remaining issues with OrdersUITest.

Before, OrdersUITest was failing with the following error:

 androidx.test.espresso.AmbiguousViewMatcherException: 'view.getId() is <2131364783/com.woocommerce.android.dev:id/toolbar>' matches 2 views in the hierarchy:
- [1] MaterialToolbar{id=2131364783, res-name=toolbar, visibility=VISIBLE, width=1069, height=154, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=com.google.android.material.appbar.CollapsingToolbarLayout$LayoutParams@YYYYYY, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=-154.0, child-count=3}
- [2] MaterialToolbar{id=2131364783, res-name=toolbar, visibility=VISIBLE, width=1080, height=154, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@YYYYYY, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}

This error was caused by duplicate toolbars on the screen. I'm not sure if this is optimal or not, but it falls outside the scope of this PR. To resolve the AmbiguousViewMatcherException, I used the first found toolbar to assert the toolbar title.

Steps to reproduce

Test OrdersUITest.

Testing information

The tests that have been performed

OrdersUITest

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

wpmobilebot commented 3 days ago
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commite3a32352f1ba9df02ed918ccce0ab4c7c4950abd
Direct Downloadwoocommerce-wear-prototype-build-pr12963-e3a3235.apk
wpmobilebot commented 3 days ago

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commite3a32352f1ba9df02ed918ccce0ab4c7c4950abd
Direct Downloadwoocommerce-prototype-build-pr12963-e3a3235.apk
wpmobilebot commented 2 days ago

Version 21.2 has now entered code-freeze, so the milestone of this PR has been updated to 21.3.