Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN upgrade: Fix test suite 1 errors #5986

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

SiobhyB
Copy link
Contributor

@SiobhyB SiobhyB commented Jul 21, 2023

Description

Following the upgrade to React Native 0.71.11, all but the first test in the gutenberg-editor-sanity-test-1-visual.test.js suite were failing for Android.

In this PR, the following changes have been made to address the failures:

  • 7f5e9c1 + c9aa893: Updated the XPath for the appender button on Android to ensure it was selected as part of the tests.
  • 275bd36: Ensured top-most column block is always selected before removing it in the suite's first test. Prior to this change, an inner column block was being selected and removed, leaving the parent column block in place. This caused a domino effect of errors with the other tests.

Testing

  • Run the following commands locally to verify the tests pass:
    • TEST_RN_PLATFORM=android npm run device-tests:local gutenberg-editor-sanity-test-1-visual.test.js
    • TEST_RN_PLATFORM=ios npm run device-tests:local gutenberg-editor-sanity-test-1-visual.test.js
  • Verify all tests pass against this PR, ensuring to run the optional tests.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered if this change warrants user-facing release notes more info and have added them to RELEASE-NOTES.txt if necessary.

Siobhan added 2 commits July 21, 2023 20:20
With this change, the most up-to-date details for the XPATH are now in place.
@SiobhyB SiobhyB changed the base branch from trunk to upgrade/react-native-0.71.8 July 21, 2023 19:27
@SiobhyB SiobhyB self-assigned this Jul 21, 2023
@SiobhyB SiobhyB added the Testing Anything related to automated tests label Jul 21, 2023
@SiobhyB SiobhyB changed the title RN upgrade: Fix issues in E2E test RN upgrade: Fix test suite 1 errors Jul 21, 2023
@SiobhyB SiobhyB marked this pull request as ready for review July 21, 2023 20:17
@SiobhyB SiobhyB requested review from fluiddot and dcalhoun July 21, 2023 20:17
This commit significantly simplifies the XPath used to identify the column block's appender button in the Android application. Previous long and potentially unstable XPath has been replaced with a more concise and reliable one, reducing the dependence on the complete UI hierarchy and improving the maintainability and stability of the automation script.
@peril-wordpress-mobile
Copy link

Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job!

Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎊 !

I ran the e2e tests locally and confirmed the change addressed the issue.

@SiobhyB SiobhyB merged commit ee7d4c3 into upgrade/react-native-0.71.8 Jul 24, 2023
@SiobhyB SiobhyB deleted the fix/sanity-test-1-errors branch July 24, 2023 11:39
@@ -13,7 +13,7 @@ const {
import { NESTED_COLUMNS_3_LEVELS } from './test-editor-data';

const ANDROID_COLUMN_APPENDER_BUTTON_XPATH =
'//android.widget.Button[@content-desc="Column Block. Row 1"]/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.widget.Button';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SiobhyB it appears I originally defined this problematic XPath. I recall lacking confidence in its definition at the time. For my own education, what was your approach for identifying this simpler, more stable XPath? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcalhoun, I don't necessarily think the previous XPath was problematic, rather I think something must have changed in the view hierarchy, as it had begun to fail consistently. To get the newer XPath, I followed a process that I believe you may have also followed i.e. I selected the component in appium-inspector and then copied/pasted the current XPath value.

(Note, you'll see in my first commit that I'd initially copied/pasted the entire XPath. I referenced simplifying that XPath in a later commit when I realised it wasn't needed in its entirety. The references to stability and simplification in that later commit's message are related to my mistake within this PR, not the test's previous XPath.)

Let me know if I can further expand on anything!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK. Yes, I sourced my XPath from Appium Inspector as well. Thanks for elaborating!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing Anything related to automated tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants