amplify-swift/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests
Jithin Roy 96b581c3ad
test(auth): Change the folder path for v2 auth tests (#2462)
2022-10-19 11:03:12 -07:00
..
AuthDeleteUserTests chore(Auth): Fixing integration tests (#2329) 2022-09-22 11:39:46 -04:00
AuthEventTests chore(AmplifyAsyncTesting): Making it an internal target instead. (#2379) 2022-09-30 13:12:10 -04:00
AuthUserAttributesTests feat(Auth): Modify getCurrentUser to throw (#2368) 2022-09-29 10:45:37 -04:00
CredentialStore fix(Auth): Minor fixes to fetching device metadata from keychain and fix integration tests (#2380) 2022-10-03 13:37:41 -04:00
DeviceTests test(auth): Change the folder path for v2 auth tests (#2462) 2022-10-19 11:03:12 -07:00
Helpers fix(auth): Add signOut during guest access (#2407) 2022-10-06 22:56:09 -04:00
ResetPasswordTests chore(Auth): Fixing integration tests (#2329) 2022-09-22 11:39:46 -04:00
SessionTests test(auth): Random fetch auth session test (#2416) 2022-10-11 12:09:33 -04:00
SignInTests fix(Auth): Making Auth API's sync (#2408) 2022-10-07 13:10:44 -04:00
SignOutTests chore(Auth): Fixing integration tests (#2329) 2022-09-22 11:39:46 -04:00
SignUpTests fix(auth): Use single client of CredentialsStore (#2404) 2022-10-06 08:45:32 -07:00
AWSAuthBaseTest.swift fix(Auth): Minor fixes to fetching device metadata from keychain and fix integration tests (#2380) 2022-10-03 13:37:41 -04:00
README.md test(auth): Change the folder path for v2 auth tests (#2462) 2022-10-19 11:03:12 -07:00

README.md

AWSCognitoAuthPlugin Integration tests

The following steps demonstrate how to setup the integration tests for auth plugin.

CLI setup

The integration test require auth configured with AWS Cognito User Pool and AWS Cognito Identity Pool.

amplify add auth

 Do you want to use the default authentication and security configuration? 
    Manual configuration
 Select the authentication/authorization services that you want to use: 
    User Sign-Up, Sign-In, connected with AWS IAM controls (Enables ...)
 Please provide a friendly name for your resource that will be used to label this category in the project: 
    <amplifyintegtest>
 Please enter a name for your identity pool. 
    <amplifyintegtestCIDP>
 Allow unauthenticated logins? (Provides scoped down permissions that you can control via AWS IAM) 
    Yes
 Do you want to enable 3rd party authentication providers in your identity pool? 
    No
 Please provide a name for your user pool: 
    <amplifyintegCUP>

 How do you want users to be able to sign in? 
    Username
 Do you want to add User Pool Groups? 
    No
 Do you want to add an admin queries API? 
    No
 Multifactor authentication (MFA) user login options: 
    OFF
 
 Email based user registration/forgot password: 
    Enabled (Requires per-user email entry at registration)
 Please specify an email verification subject: 
    Your verification code
 Please specify an email verification message: 
    Your verification code is {####}
 Do you want to override the default password policy for this User Pool? 
    No
 
 What attributes are required for signing up? 
   (Press Space to deselect Email, if selected, then press Enter with none selected)
 Specify the app's refresh token expiration period (in days): 
    30
 Do you want to specify the user attributes this app can read and write? 
    No
 Do you want to enable any of the following capabilities?
    (press Enter with none selected)
 Do you want to use an OAuth flow? 
    No
? Do you want to configure Lambda Triggers for Cognito? 
    Yes
? Which triggers do you want to enable for Cognito
    Pre Sign-up
    [Choose as many that you would like to manually verify later]
? What functionality do you want to use for Pre Sign-up 
    Create your own module
Succesfully added the Lambda function locally
? Do you want to edit your custom function now? Yes
Please edit the file in your editor: 

For Pre Sign-up lambda

exports.handler = (event) => {
    event.response.autoConfirmUser = true;
};

Continue in the terminal;

? Press enter to continue
Successfully added resource amplifyintegtest locally

amplify push

This will create a amplifyconfiguration.json file in your local, copy that file to ~/.aws-amplify/amplify-ios/testconfiguration/ and rename as AWSCognitoAuthPluginIntegrationTests-amplifyconfiguration.json.

For Auth Device tests: Follow steps here (https://docs.amplify.aws/lib/auth/device_features/q/platform/ios/#configure-auth-category)[https://docs.amplify.aws/lib/auth/device_features/q/platform/ios/#configure-auth-category] and select "Always" for "Do you want to remember your user's devices?"