*****This README is still in progress*
To run existing tests on your desired framework
:
prerequisite: You must create populate packages/e2e/.env
values in order for tests to run successfully against the examples. The values you need to populate are specified in packages/e2e/.env.example
. Please see Creating test users to see our conventions.
- Navigate to the root of your local clone of aws-amplify/amplify-ui
- Run
yarn setup
- Run
yarn [framework] dev
(e.g.yarn react build
) - Run
yarn [framework]-example dev
(e.g.yarn react-example dev
) - Run
yarn e2e dev
-
Create or Update a
${feature}.feature
file (using Gherkin) describing the behavior inpackages/e2e/features/${slug}
.Feature: My new feature Documentation-friendly description of this feature, why it exists, & how to use it. @angular @react @vue Scenario: Example scenario using this feature Given some "STARTING_POINT" When I DO "SOMETHING" And I DO SOMETHING "ELSE" Then I see "THE DESIRED BEHAVIOR" @react @skip Scenario: Some React-specific scenario that can't be rain in CI @angular @todo-react @todo-vue Scenario: Some scenario supported in Angular, but React & Vue haven't added yet
-
Create or Update the accompanying
${slug}.feature
tests (e.g.packages/e2e/cypress/integration/${slug}/${feature}/${feature}.steps.ts
-
Start one of the examples.
-
Run
yarn e2e dev
to load CypressTAGS='@react and not (@skip or @todo-react)' yarn e2e dev
-
Click on your updated
${feature}.feature
file to validate your changes -
Add tags above your
Scenario
to indicate how this feature should be tested:-
If the library supports it, then add one of the following:
@angular
for@aws-amplify/ui-angular
@react
for@aws-amplify/ui-react
@vue
for@aws-amplify/ui-vue
This will ensure automated documentation marks these as supported features.
-
If the library supports it, but tests cannot be ran in CI for technical reasons, then also add:
@skip
for all libraries@skip-angular
for specifically@aws-amplify/ui-angular
@skip-react
for specifically@aws-amplify/ui-react
@skip-vue
for specifically@aws-amplify/ui-vue
This will ensure automated documentation marks these as supported features, but won't block builds (in PRs or
main
) with test failures. -
If the library should support it, then also add:
@todo-angular
for@aws-amplify/ui-angular
@todo-react
for@aws-amplify/ui-react
@todo-vue
for@aws-amplify/ui-vue
This will ensure automated documentation marks these as upcoming features, will skip these on PRs, but will error on
main
until completed.
-
For our e2e tests, we use a specific pattern for test user creation in our various environments. Each test user will have a Cognito status which our tests will depend upon to test certain features. Before creating test users, do the following:
- Start an instance of an example using the environment in which you'll be creating test users
- Access the Amplify Admin UI for the environment
-
In the Amplify Admin UI, navigate to "User management" and click
Create user
-
Fill out their credentials according to the alias you need:
username
:.env.USERNAME
+CONFIRMEDemail
:.env.USERNAME
+CONFIRMED@.env.DOMAIN
phone
: +1.env.PHONE_NUMBER
-
Fill out a temporary password of your choice and click
Create user
-
Find your new user in the users list, click them, select
edit
, and mark all aliases asVerified
-
Navigate to your running example and sign in with the alias and temporary password created above
-
Change the test user's password to
.env.VALID_PASSWORD
-
Navigate to your running example and click
Create account
-
Fill out their credentials according to the alias you need:
username
:.env.USERNAME
+UNCONFIRMEDemail
:.env.USERNAME
+UNCONFIRMED@.env.DOMAIN
phone
: +7.env.PHONE_NUMBER
-
Enter their password as
.env.VALID_PASSWORD
and create the user
-
In the Amplify Admin UI, navigate to "User management" and click
Create user
-
Fill out their credentials according to the alias you need:
username
:.env.USERNAME
+FORCE_CHANGE_PASSWORDemail
:.env.USERNAME
+FORCE_CHANGE_PASSWORD@.env.DOMAIN
phone
: +30.env.PHONE_NUMBER
-
Fill out a temporary password of your choice and click
Create user
-
Find your new user in the users list, click them, select
edit
, and mark all aliases asVerified
-
In the Amplify Admin UI, navigate to "User management" and click
Create user
-
Fill out their credentials according to the alias you need:
username
:.env.USERNAME
+UNVERIFIEDemail
:.env.USERNAME
+UNVERIFIED@.env.DOMAIN
phone
: not implemented
-
Fill out a temporary password of your choice and click
Create user
-
Navigate to your running example and sign in with the alias and temporary password created above
-
Change the test user's password to
.env.VALID_PASSWORD