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

[Monorepo] e2e tests #18576

Conversation

dratwas
Copy link
Contributor

@dratwas dratwas commented Nov 18, 2019

Description

This is a part of migration gutenberg-mobile to gutenberg repo.

In this PR I fixed local native e2e tests.
I moved jest_ui.config to the test/native directory.

The tricky part of that is the process.env.MOBILE is set to true in Build Phases -> Bundle React Native Code And Images because react-native/scripts/react-native-xcode.sh always takes babel config from the root - help appreciated with that. I solved it by adding MOBILE env to the Build Phases and if it is set i use the config from packages/react-native-editor

@gziolo left a comment here #18159 (comment)

We need to double-check how Babel caching works with envs.

As far as I understand from here https://babeljs.io/docs/en/config-files#apicache :
the api.cache(true) is an equivalent of api.cache.forever() which means the babel will cache the computed config and never call the function again. So it shouldn't be an issue in that case.

The next thing added here is rn-cli.config.js at the root level which only requires config from packages/react-native-editor. I couldn't make it works w/o this. I tried to set the rn-cli.config.js path as a parameter to react-native/scripts/react-native-xcode.sh w/o adding rn-cli.config.js at the root level.
export BUNDLE_CONFIG=packages/react-native-editor/rn-cli.config.js

Not sure why but in that case I get the error:

Loading dependency graph, done.
error Unable to resolve module `./styles.scss` from /gutenberg/packages/block-editor/src/components/media-placeholder/index.native.js`: The module `./styles.scss` could not be found from `/gutenberg/packages/block-editor/src/components/media-placeholder/index.native.js`. Indeed, none of these files exist:

Seems like the sass-transformer doesn't work correctly.

If you have any idea how to handle those things in a more elegant way please left a comment :)

NOTE: Files from above are only needed for iOS because android works w/o them.

How has this been tested?

npm run native test:e2e:ios:local should start iOS e2e tests and they should pass
npm run native test:e2e:android:local should start android e2e tests and they should pass

Types of changes

Fix native e2e tests

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR. .

@dratwas dratwas changed the base branch from rnmobile/import-mobile-fix-android-build to rnmobile/import-mobile-unit-tests November 18, 2019 15:21
@dratwas dratwas added [Status] In Progress Tracking issues with work in progress [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible labels Nov 18, 2019
@dratwas dratwas mentioned this pull request Nov 20, 2019
21 tasks
@dratwas dratwas removed the [Status] In Progress Tracking issues with work in progress label Nov 20, 2019
@dratwas dratwas marked this pull request as ready for review November 20, 2019 10:08
babel.config.js Show resolved Hide resolved
test/native/jest_ui.config.js Show resolved Hide resolved
test/unit/jest.config.js Show resolved Hide resolved
@gziolo gziolo added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Nov 26, 2019
@Tug
Copy link
Contributor

Tug commented Oct 19, 2020

Closing as it is now outdated

@Tug Tug closed this Oct 19, 2020
@Tug Tug deleted the rnmobile/import-mobile-e2e-tests branch October 19, 2020 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants