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

Upgrade React Native 0.71.11 #5874

Merged
merged 64 commits into from
Jul 27, 2023
Merged

Upgrade React Native 0.71.11 #5874

merged 64 commits into from
Jul 27, 2023

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Jun 16, 2023

Related PRs

To test:
Follow testing instructions from WordPress/gutenberg#51303.

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.

…encies

This upgrade is needed to support React Native version `0.71.11`.
This fixes an issue related to the UUID library when running tests. Without this change, we get the following error:
```
/gutenberg-mobile/gutenberg/node_modules/uuid/dist/esm-browser/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { default as v1 } from './v1.js';
                                                                                      ^^^^^^

    SyntaxError: Unexpected token 'export'

      3 |  */
      4 | import fastDeepEqual from 'fast-deep-equal/es6';
    > 5 | import { v4 as uuid } from 'uuid';
        | ^
      6 |
      7 | /**
      8 |  * WordPress dependencies
```
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jun 16, 2023

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

Comment on lines +59 to +61
// Workaround for Jest not having ESM support yet
// Reference: https://t.ly/9ap_
uuid: require.resolve( 'uuid' ),
Copy link
Member

Choose a reason for hiding this comment

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

From reviewing the URL in this comment, my understanding is that we can remove this workaround when we upgrade to uuid@9. Is that accurate? It would likely be beneficial to note this in the inline comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, true. I haven't tested this myself, but based on the comments that seems the case. I'll update the inline comment to reflect this. 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.

I tried using uuid version 9.x but I still had to use this workaround to address the issue. There might be something else producing the issue, especially as it's not happening in Gutenberg unit tests which I assume we use an older version uuid 🤔 .

Comment on lines 52 to 53
// Mock request reponses
setupApiFetch( generateFetchMocks() );
Copy link
Member

@dcalhoun dcalhoun Jun 22, 2023

Choose a reason for hiding this comment

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

Why this now required due to the RN upgrade? Does this relate to facebook/react-native#34659?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it looks related to that change. Without this change, the tests fail with the following error:

TypeError: Cannot read property 'then' of undefined

      53 | 			method: 'POST',
      54 | 			body: fetchParams.body,
    > 55 | 		} ).then( response => {
         | 		   ^
      56 | 			const { metadata_token } = response;
      57 | 			if ( ! metadata_token ) {
      58 | 				console.warn( 'Token is not achievable' ); // eslint-disable-line no-console

I understand that when Promise was polyfilled in Jest tests, we didn't need to explicitly mock API responses (i.e. api-fetch library).

@fluiddot fluiddot mentioned this pull request Jun 29, 2023
2 tasks
dcalhoun and others added 6 commits June 29, 2023 12:21
Capture result of `bundle exec pod install` within the `ios-xcframework`
directory. while the XCFramework is not currently used for WordPress iOS
integration, this is required to resolve CI failures.
* Add util to generate VideoPress privacy settings for tests

* Mock VideoPress check ownership API request

* Update VideoPress edit test cases

Instead of using a constant for the block HTML, now we generate the HTML via the `generateBlockHTML` util.

* Use different fetch mocks in VideoPress edit test cases

This is needed to keep the same block attributes set via the block HTML generation.

Extract fetch mock metadata to a constant

* Update VideoPress description setting placeholder query

* Update VideoPress test snapshots

The only change is that the video is now public when setting a caption. This has no impact in the testing logic.

* Update src/test/videopress/local-helpers/utils.js

Fixes the JSDoc type of `isVideoPrivate` and `isSitePrivate` params.

Co-authored-by: David Calhoun <[email protected]>

* Fix value used to generate privacy setting in `generatePrivacySettings`

* Remove unneeded metadata on fetch mocks

---------

Co-authored-by: David Calhoun <[email protected]>
* build: Update Gutenberg ref

* build: Capture package-lock.json changes

The result of running:

```
rm -rf ./node_modules && npm install
```

* Update Gutenberg ref

* Update a11y id queries for Android E2E tests

---------

Co-authored-by: David Calhoun <[email protected]>
Siobhan Bamber and others added 4 commits July 4, 2023 17:19
* Update Gutenberg reference

* Update script for generating React-Codegen

The method we used to generate React-Codegen (get_react_codegen_spec) was moved to a different file in newer versions of React Native. We need to update the script for generating it accordingly.

* Update third-party podspecs to target 0.71.11

* Update FBReactNativeSpec.podspec.json with hash

* Apply bundle changes

* Manually add React-bridging.podspec.json

The file was automatically deleted via the generate-podspecs.sh script. It has been manually added as a temporary measure, to enable further testing.

* Revert "Manually add React-bridging.podspec.json"

This reverts commit 9707305.

* Update list of dependencies in Podfile for iOS

* Add tag to Hermes podspec to workaround error

This is intended as a temporary workaround, we should implement a more robust fix before merging.

* Update dependency versions in Podfile.lock

* [Temporary] Add React Native as a dependency

* Revert "[Temporary] Add React Native as a dependency"

This reverts commit 21a4fbe.

* Update Gutenberg ref

* Update Gutenberg ref

* Update Gutenberg ref

* Disable hermes when generating codegen podspec

* Generate third-party podspecs

* Update FBReactNativeSpec podspec

---------

Co-authored-by: Carlos Garcia <[email protected]>
# Conflicts:
#	bundle/ios/App.js
#	bundle/ios/App.js.map
#	gutenberg
Copy link
Contributor

@SiobhyB SiobhyB left a comment

Choose a reason for hiding this comment

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

Approved via WordPress/gutenberg#51303 (review).

For posterity, noting that #5973 needs to be merged in for the tests to pass, and to avoid the issue with crashing on iOS.

@fluiddot
Copy link
Contributor Author

For posterity, noting that #5973 needs to be merged in for the tests to pass, and to avoid the issue with crashing on iOS.

The PR has been already merged in 378e233.

fluiddot and others added 9 commits July 21, 2023 12:26
With this change, the most up-to-date details for the XPATH are now in place.
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.
@fluiddot fluiddot added this to the 1.101.0 (23.0) milestone Jul 27, 2023
@fluiddot
Copy link
Contributor Author

As a side note, b837251 was needed because I updated Podfile in 23d9fbd 🤦.

@fluiddot fluiddot enabled auto-merge July 27, 2023 12:26
@fluiddot fluiddot merged commit 622322d into trunk Jul 27, 2023
@fluiddot fluiddot deleted the upgrade/react-native-0.71.8 branch July 27, 2023 12:46
@SiobhyB SiobhyB mentioned this pull request Aug 3, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants