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

ci: Add React Native integration testing with Detox #5007

Merged
merged 26 commits into from
Feb 28, 2020
Merged

Conversation

iartemiev
Copy link
Member

@iartemiev iartemiev commented Feb 28, 2020

Here's what it looks like when it's running: https://app.circleci.com/jobs/github/aws-amplify/amplify-js/11280

If someone wants to take it for a spin, lmk and we can copy this branch and then temporarily disable the other jobs in the pipeline to have it it only run the detox tests

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

environment:
HOMEBREW_NO_AUTO_UPDATE: 1
command: |
brew tap wix/brew
Copy link
Contributor

Choose a reason for hiding this comment

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

Why wix/brew? Is there a certain homebrew that we need from wix? Or is this what they reccomend for adding detox?

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +288 to +336
cp -rf ~/amplify-js/packages/aws-amplify/dist ./node_modules/aws-amplify/dist
cp -rf ~/amplify-js/packages/aws-amplify/lib ./node_modules/aws-amplify/lib
cp -rf ~/amplify-js/packages/aws-amplify/lib-esm ./node_modules/aws-amplify/lib-esm

cp -rf ~/amplify-js/packages/amazon-cognito-identity-js/dist ./node_modules/amazon-cognito-identity-js/dist
cp -rf ~/amplify-js/packages/amazon-cognito-identity-js/lib ./node_modules/amazon-cognito-identity-js/lib

cp -rf ~/amplify-js/packages/analytics/dist ./node_modules/@aws-amplify/analytics/dist
cp -rf ~/amplify-js/packages/analytics/lib ./node_modules/@aws-amplify/analytics/lib
cp -rf ~/amplify-js/packages/analytics/lib-esm ./node_modules/@aws-amplify/analytics/lib-esm

cp -rf ~/amplify-js/packages/api/dist ./node_modules/@aws-amplify/api/dist
cp -rf ~/amplify-js/packages/api/lib ./node_modules/@aws-amplify/api/lib
cp -rf ~/amplify-js/packages/api/lib-esm ./node_modules/@aws-amplify/api/lib-esm

cp -rf ~/amplify-js/packages/auth/dist ./node_modules/@aws-amplify/auth/dist
cp -rf ~/amplify-js/packages/auth/lib ./node_modules/@aws-amplify/auth/lib
cp -rf ~/amplify-js/packages/auth/lib-esm ./node_modules/@aws-amplify/auth/lib-esm

cp -rf ~/amplify-js/packages/cache/dist ./node_modules/@aws-amplify/cache/dist
cp -rf ~/amplify-js/packages/cache/lib ./node_modules/@aws-amplify/cache/lib
cp -rf ~/amplify-js/packages/cache/lib-esm ./node_modules/@aws-amplify/cache/lib-esm

cp -rf ~/amplify-js/packages/core/dist ./node_modules/@aws-amplify/core/dist
cp -rf ~/amplify-js/packages/core/lib ./node_modules/@aws-amplify/core/lib
cp -rf ~/amplify-js/packages/core/lib-esm ./node_modules/@aws-amplify/core/lib-esm

cp -rf ~/amplify-js/packages/interactions/dist ./node_modules/@aws-amplify/interactions/dist
cp -rf ~/amplify-js/packages/interactions/lib ./node_modules/@aws-amplify/interactions/lib
cp -rf ~/amplify-js/packages/interactions/lib-esm ./node_modules/@aws-amplify/interactions/lib-esm

cp -rf ~/amplify-js/packages/predictions/dist ./node_modules/@aws-amplify/predictions/dist
cp -rf ~/amplify-js/packages/predictions/lib ./node_modules/@aws-amplify/predictions/lib
cp -rf ~/amplify-js/packages/predictions/lib-esm ./node_modules/@aws-amplify/predictions/lib-esm

cp -rf ~/amplify-js/packages/pubsub/dist ./node_modules/@aws-amplify/pubsub/dist
cp -rf ~/amplify-js/packages/pubsub/lib ./node_modules/@aws-amplify/pubsub/lib
cp -rf ~/amplify-js/packages/pubsub/lib-esm ./node_modules/@aws-amplify/pubsub/lib-esm

cp -rf ~/amplify-js/packages/storage/dist ./node_modules/@aws-amplify/storage/dist
cp -rf ~/amplify-js/packages/storage/lib ./node_modules/@aws-amplify/storage/lib
cp -rf ~/amplify-js/packages/storage/lib-esm ./node_modules/@aws-amplify/storage/lib-esm

cp -rf ~/amplify-js/packages/amplify-ui/dist ./node_modules/@aws-amplify/ui/dist
cp -rf ~/amplify-js/packages/amplify-ui/lib ./node_modules/@aws-amplify/ui/lib

cp -rf ~/amplify-js/packages/xr/dist ./node_modules/@aws-amplify/xr/dist
cp -rf ~/amplify-js/packages/xr/lib ./node_modules/@aws-amplify/xr/lib
cp -rf ~/amplify-js/packages/xr/lib-esm ./node_modules/@aws-amplify/xr/lib-esm
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks painful, thank you for getting through this! My only question, NON BLOCKING, is Verdaccio will solve this? I know you have it as the callout but just want to double check if itll be something similar we would have to do with Verdaccio

Copy link
Member Author

@iartemiev iartemiev Feb 28, 2020

Choose a reason for hiding this comment

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

Lol yea it was a little painful, but fun too. I think we technically only need the /lib dirs, since that's what RN consumes, but I copied dist and lib-esm as well just in case.

Verdaccio will def solve this though. The reason we're doing that ^ is because we can't yarn link like we do for the other (web) integ tests. So instead of linking or copying, we'll just yarn add aws-amplify from the Verdaccio registry running in CircleCI

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha makes sense to me on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we only need /lib. This is a problem when doing local dev for amplify-js and React Native too.
But I think we can do it a better way in the future, using Verdaccio ideally or even a script file that runs a build and changes the output directory to the corresponding path in the app's node_modules. And then here we just run that script in the config rather than writing all the steps to copy it over in the config (a bit verbose)?
But yeah its not a blocker for now, and great stuff getting this to work! 👍

@codecov
Copy link

codecov bot commented Feb 28, 2020

Codecov Report

Merging #5007 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5007   +/-   ##
=======================================
  Coverage   76.37%   76.37%           
=======================================
  Files         175      175           
  Lines        9669     9669           
  Branches     1982     1982           
=======================================
  Hits         7385     7385           
  Misses       2137     2137           
  Partials      147      147

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45e0be7...73d1d19. Read the comment docs.

Copy link
Contributor

@sammartinez sammartinez left a comment

Choose a reason for hiding this comment

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

LGTM! 🌮

Copy link
Contributor

@Ashish-Nanda Ashish-Nanda left a comment

Choose a reason for hiding this comment

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

Looks Good!

@iartemiev iartemiev merged commit bbd0271 into master Feb 28, 2020
@iartemiev iartemiev deleted the detox-tests branch February 28, 2020 23:06
jordanranz added a commit that referenced this pull request Mar 27, 2020
* Adding database abstraction for AsyncStorage

* Add storage adapter for React Native using AsyncStorage

* Add separate default adapters for Web and React Native

* Make error messages more meaningful

* Add support for Reachability in React Native

* Add @react-native-community/netinfo to devDependencies

* Pin down the version of crypto-js

* Enable publish from rn-datastore branch

* Preparing release

* chore(release): Publish [ci skip]

 - @aws-amplify/[email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]

* Allow in PubSub to add async custom headers

Allow in PubSub the same capabilities as API for custom headers:
* Async header
* Override headers (Authorization)

Check issue #4928 for explanations.

* chore(deps-dev): bump codecov from 1.0.1 to 3.6.5 (#4951)

Bumps [codecov](https://github.com/codecov/codecov-node) from 1.0.1 to 3.6.5.
- [Release notes](https://github.com/codecov/codecov-node/releases)
- [Commits](https://github.com/codecov/codecov-node/commits)

Signed-off-by: dependabot[bot] <[email protected]>

* (fix:@aws-amplify/pubsub) Fix for unsubscription new subscription race condition (#4956)

* Fix for unsubscription new subscription race condition

* Update packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts

* Fix to initialize only once and handle disconnection from network  (#4921)

* initialize only once

* Fix onerror handler for WebSocket

* Change log level for unsubscribe message

* Add regions and fix typo

* Handle disconnection

* chore(deps): bump nokogiri from 1.10.4 to 1.10.8 in /docs (#4974)

Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.4 to 1.10.8.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](sparklemotion/nokogiri@v1.10.4...v1.10.8)

Signed-off-by: dependabot[bot] <[email protected]>

* Use the db instance property of the Adapter class for all database operations (#4995)

Use the db instance property of the Adapter class for all database operations

* Removing unused code

* Remove rn-datastore branch publish config

* Preparing release

* chore(release): Publish [ci skip]

 - [email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]
 - @aws-amplify/[email protected]

* fix(core): move react-native dependency from dev

* fix(core): revert dep addition. Add to peer and devDeps

* ci: Add React Native integration testing with Detox (#5007)

* Make deploy wait on integ_rn_ios_storage (#5009)

* feat(@aws-amplify/api): pass additionalHeaders to graphql function (#5001)

Additional headers are merged **after** merging in headers set at config time.
Additional headers will overwrite any existing values and merge the rest.

* chore(@aws-amplify/api): fix non-breaking typo in function (#5034)

* fix(@aws-amplify/datastore): Fix query and delete types (#5032)

Fixes #4827

* Fix(@aws-amplify/interactions) fixes 4750 to properly use the spread operator (#4806)

* fix(@aws-amplify/datastore) Adding socket disconnection detection (#5086)

* Export necessary providers and types from the package root to avoid importing from generated paths (#5085)

* fix(aws-amplify-react): Fix Federated icons when using React Bo… (#5073)

* Explicitly set box-sizing, as CSS resets override to border-box

* Explicitly set line-height, as CSS resets override line-height

* Upgrade aws-sdk clients which resolves react native issues (#5124)

* Export necessary providers and types from the package root to avoid importing from generated paths

* Upgrade aws-sdk clients which resolves react native issues

* Enable integration tests on modularization branch (#5125)

* chore: Fix setup-dev script (#5035)

Let `unlink-all` succeed always

Co-authored-by: Iglesias <[email protected]>

* fix(@aws-amplify/datastore): Storage should be re-initialized after DataStore.clear() (#5083)

* fix(@aws-amplify/datastore): Fix #5076 storage not re-initialized after DataStore.clear()

* Adding comments

Co-authored-by: Manuel Iglesias <[email protected]>
Co-authored-by: Ashish Nanda <[email protected]>

* fix(aws-amplify-react): BREAKING - Remove "import '@aws-amplify… (#5138)

Importing non-JS files relies on a bundler & breaks SSR.

It works with CRA because CRA *builds all dependencies*, just-in-case.

* feat(@aws-amplify/datastore): Support non-@model types in DataStore (#5128)

* Upgrade immer

* Return sooner if predicates are empty

* Fix bug when trying to delete a model instance that is not persisted

* Support non-@model types

* Generate datastore coverage report and RN integ test

* Fix tslint error

* Remove  unit test case for onGetPost

* Remove unused code

* Rename instance initializer to initializeInstance

* Rename SchemaType to SchemaNonModel

* Rename types to nonModels in schema.js

* Rename type to nonModel

* Make nonModels optional in schema.js

* Remove generic constraint from createTypeClass

* Rename ModelOrTypeConstructorMap to TypeConstructorMap

* Rename createModelAndTypeClassses to createTypeClasses

* Rename createTypeClass to createNonModelClass

* chore: remove datastore form RN integ tests (#5139)

* Fix export type of datastore storage in unit tests

* test(@aws-amplify/datastore): Fix unit tests

* [RN] Migrate zen-observable to zen-observable-ts and fix zen-push import (#5155)

* Migrate zen-observable to zen-observable-ts and fix zen-push import

* Fix unit tests

* Pin aws-sdk versions and rename presignRequest to presign (#5171)

* Migrate zen-observable to zen-observable-ts and fix zen-push import

* Fix unit tests

* Pin aws-sdk versions and rename presignRequest to presign

* Upgrade aws-sdk clients from alpha to beta (#5209)

* Migrate zen-observable to zen-observable-ts and fix zen-push import

* Fix unit tests

* Pin aws-sdk versions and rename presignRequest to presign

* Upgrade aws-sdk clients from alpha to beta

* Update expiration type to Date as per change in aws-sdk

* Fix unit tests as per expiration type change

* Fix jest failures, update snapshot

* Update storage changelog

Co-authored-by: Ashish Nanda <[email protected]>
Co-authored-by: Rodriguez Elorza <[email protected]>
Co-authored-by: aws-amplify-bot <[email protected]>
Co-authored-by: Sebastien Schwartz <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Manuel Iglesias <[email protected]>
Co-authored-by: Ivan Artemiev <[email protected]>
Co-authored-by: Jens Bodal <[email protected]>
Co-authored-by: Ashika <[email protected]>
Co-authored-by: Manuel Iglesias <[email protected]>
Co-authored-by: Praveen Gupta <[email protected]>
Co-authored-by: Eric Clemmons <[email protected]>
Co-authored-by: Iglesias <[email protected]>
Co-authored-by: Yirako <[email protected]>
Co-authored-by: [email protected] <[email protected]>
@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants