diff --git a/packages/amplify-e2e-core/src/categories/auth.ts b/packages/amplify-e2e-core/src/categories/auth.ts index ae5d6dd95f1..1401bdff6a3 100644 --- a/packages/amplify-e2e-core/src/categories/auth.ts +++ b/packages/amplify-e2e-core/src/categories/auth.ts @@ -322,8 +322,9 @@ export function addAuthWithCustomTrigger(cwd: string, settings: any): Promise { if (!err) { resolve(); @@ -695,11 +696,10 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise { spawn(getCLIPath(), ['add', 'auth'], { cwd, stripColors: true }) .wait('Do you want to use the default authentication and security configuration?') - .send(KEY_DOWN_ARROW) - .send(KEY_DOWN_ARROW) + .sendKeyDown(2) .sendCarriageReturn() .wait('Select the authentication/authorization services that you want to use') - .send(KEY_DOWN_ARROW) + .sendKeyDown() .sendCarriageReturn() .wait('Please provide a friendly name for your resource that will be used') .sendCarriageReturn() @@ -710,14 +710,11 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise { .wait('Do you want to add User Pool Groups?') .sendCarriageReturn() .wait('Provide a name for your user pool group') - .send('userPoolGroup1') - .sendCarriageReturn() + .sendLine('userPoolGroup1') .wait('Do you want to add another User Pool Group') - .send('y') - .sendCarriageReturn() + .sendConfirmYes() .wait('Provide a name for your user pool group') - .send('userPoolGroup2') - .sendCarriageReturn() + .sendLine('userPoolGroup2') .wait('Do you want to add another User Pool Group') .sendCarriageReturn() .wait('Sort the user pool groups in order of preference') @@ -729,11 +726,10 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise { .wait('Select the group to restrict access with') .sendCarriageReturn() .wait('Multifactor authentication (MFA) user login options') - .send(KEY_DOWN_ARROW) + .sendKeyDown() .sendCarriageReturn() .wait('For user login, select the MFA types') - .send('a') - .sendCarriageReturn() + .sendLine('a') .wait('Please specify an SMS authentication message') .sendCarriageReturn() .wait('Email based user registration/forgot password') @@ -743,20 +739,17 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise { .wait('Please specify an email verification message') .sendCarriageReturn() .wait('Do you want to override the default password policy') - .send('y') - .sendCarriageReturn() + .sendConfirmYes() .wait('Enter the minimum password length for this User Pool') .sendCarriageReturn() .wait('Select the password character requirements for your userpool') - .send('a') - .sendCarriageReturn() + .sendLine('a') .wait('What attributes are required for signing up?') .sendCarriageReturn() .wait('Specify the app') .sendCarriageReturn() .wait('Do you want to specify the user attributes this app') - .send('y') - .sendCarriageReturn() + .sendConfirmYes() .wait('Specify read attributes') .sendCarriageReturn() .wait('Specify write attributes') @@ -768,13 +761,11 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise { .wait('What domain name prefix do you want to use?') .sendCarriageReturn() .wait('Enter your redirect signin URI') - .send('https://signin1/') - .sendCarriageReturn() + .sendLine('https://signin1/') .wait('Do you want to add another redirect signin URI') .sendConfirmNo() .wait('Enter your redirect signout URI') - .send('https://signout1/') - .sendCarriageReturn() + .sendLine('https://signout1/') .wait('Do you want to add another redirect signout URI') .sendConfirmNo() .wait('Select the OAuth flows enabled for this project') @@ -782,62 +773,41 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise { .wait('Select the OAuth scopes enabled for this project') .sendCarriageReturn() .wait('Select the social providers you want to configure for your user pool') - .send('a') - .sendCarriageReturn() + .sendLine('a') .wait('Enter your Facebook App ID for your OAuth flow') - .send(FACEBOOK_APP_ID) - .sendCarriageReturn() + .sendLine(FACEBOOK_APP_ID) .wait('Enter your Facebook App Secret for your OAuth flow') - .send(FACEBOOK_APP_SECRET) - .sendCarriageReturn() + .sendLine(FACEBOOK_APP_SECRET) .wait('Enter your Google Web Client ID for your OAuth flow') - .send(GOOGLE_APP_ID) - .sendCarriageReturn() + .sendLine(GOOGLE_APP_ID) .wait('Enter your Google Web Client Secret for your OAuth flow') - .send(GOOGLE_APP_SECRET) - .sendCarriageReturn() + .sendLine(GOOGLE_APP_SECRET) .wait('Enter your Amazon App ID for your OAuth flow') - .send(AMAZON_APP_ID) - .sendCarriageReturn() + .sendLine(AMAZON_APP_ID) .wait('Enter your Amazon App Secret for your OAuth flow') - .send(AMAZON_APP_SECRET) - .sendCarriageReturn() + .sendLine(AMAZON_APP_SECRET) .wait('Enter your Services ID for your OAuth flow') - .send(APPLE_APP_ID) - .sendCarriageReturn() + .sendLine(APPLE_APP_ID) .wait('Enter your Team ID for your OAuth flow') - .send(APPLE_TEAM_ID) - .sendCarriageReturn() + .sendLine(APPLE_TEAM_ID) .wait('Enter your Key ID for your OAuth flow') - .send(APPLE_KEY_ID) - .sendCarriageReturn() + .sendLine(APPLE_KEY_ID) .wait('Enter your Private Key for your OAuth flow') - .send(APPLE_PRIVATE_KEY) - .sendCarriageReturn() + .sendLine(APPLE_PRIVATE_KEY) .wait('Do you want to configure Lambda Triggers for Cognito') - .send('y') - .sendCarriageReturn() + .sendConfirmYes() .wait('Which triggers do you want to enable for Cognito') .send('a') - .send(' ') - .sendCarriageReturn() + .sendLine(' ') .wait('What functionality do you want to use for Create Auth Challenge') - .send(KEY_DOWN_ARROW) - .send(KEY_DOWN_ARROW) - .send(KEY_DOWN_ARROW) - .send(' ') - .sendCarriageReturn() + .sendKeyDown(3) + .sendLine(' ') .wait('What functionality do you want to use for Custom Message') - .send(KEY_DOWN_ARROW) - .send(KEY_DOWN_ARROW) - .send(' ') - .sendCarriageReturn() + .sendKeyDown(2) + .sendLine(' ') .wait('What functionality do you want to use for Define Auth Challenge') - .send(KEY_DOWN_ARROW) - .send(KEY_DOWN_ARROW) - .send(KEY_DOWN_ARROW) - .send(' ') - .sendCarriageReturn() + .sendKeyDown(3) + .sendLine(' ') .wait('What functionality do you want to use for Post Authentication') .sendCarriageReturn() .wait('What functionality do you want to use for Post Confirmation') @@ -852,20 +822,13 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise { .sendCarriageReturn() .wait('Do you want to edit your custom function now') .sendConfirmNo() + .wait('Successfully') .wait('Do you want to edit your custom function now') .sendConfirmNo() + .wait('Successfully') .wait('Do you want to edit your custom function now') .sendConfirmNo() - .wait('Do you want to edit your custom function now') - .sendConfirmNo() - .wait('Do you want to edit your custom function now') - .sendConfirmNo() - .wait('Do you want to edit your custom function now') - .sendConfirmNo() - .wait('Do you want to edit your custom function now') - .sendConfirmNo() - .wait('Do you want to edit your custom function now') - .send('n') + .wait('Successfully added auth resource') .sendEof() .run((err: Error) => { if (!err) {