Skip to content

Set up Gen2 environments pull and example apps #5274

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

Open
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

zchenwei
Copy link
Contributor

@zchenwei zchenwei commented May 25, 2024

Description of changes

  • Gen1 and Gen2 environments are pulled down separately and e2e tests against them will be run on different machines
  • Existing example apps are reused between Gen1 and Gen2 e2e tests by leveraging dynamic import and the meaningless aws-exports.js files are moved
  • e2e test updates are mostly tagging with @gen1 and @gen2. 90% of them can be shared but a few scenarios will be differentiated(e.g., no username login in Gen2, error messages are different, etc)

Screenshot 2024-05-24 at 9 52 13 AM

React Native

  • ios-e2e-gen1
    Set environment variable VERSION=gen1 in example app and yarn e2e detox:e2e:ios:debug
ios-e2e-gen1
  • ios-e2e-gen2
    Set environment variable VERSION=gen2 in example app and yarn e2e detox:e2e:ios:debug:gen2
ios-e2e-gen2
  • android-e2e-gen1
    Set environment variable VERSION=gen1 in example app and yarn e2e detox:build:android:debug
android-e2e-gen1
  • android-e2e-gen2
    Set environment variable VERSION=gen2 in example app and yarn e2e detox:build:android:debug:gen2
android-e2e-gen2

Note: when switching environment variable between VERSION=gen1 and VERSION=gen2, do NOT forget to reset the Metro cache

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • Relevant documentation is changed or added (and PR referenced)
  • yarn test passes and tests are updated/added
  • No side effects or sideEffects field updated

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

Copy link

changeset-bot bot commented May 25, 2024

⚠️ No Changeset found

Latest commit: bf83035

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@zchenwei zchenwei changed the title Gen2 auth environment v3 Separate Gen1 and Gen2 environments pull(v2) May 25, 2024
const AMPLIFY_CONFIG_PATH =
VERSION === 'gen1' ? 'src/amplifyconfiguration' : 'amplify_outputs';

const amplifyOutputs = require(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have to use require() for dynamic import because import() is only supported by react native bundler when used in conjunction with React.lazy() to load a lazy component.

Copy link
Contributor Author

@zchenwei zchenwei Jun 22, 2024

Choose a reason for hiding this comment

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

Note: we cannot extract const AMPLIFY_CONFIG_PATH and reuse it elsewhere because that way, the bundler will fail to understand it and thus fail to do import analysis. It has to stay close to the require() statement below.


Amplify.configure(config);
const AMPLIFY_CONFIG_PATH =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using src/amplifyconfiguration - the json equivalent of src/aws-exports because require will return the exact config object when loading a json file versus putting it behind a default key when loading a js file

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

Successfully merging this pull request may close these issues.

5 participants