Skip to content

Commit

Permalink
test: fix flaky add auth test (#7969)
Browse files Browse the repository at this point in the history
  • Loading branch information
Attila Hajdrik authored Aug 16, 2021
1 parent 1725630 commit e34bfbe
Showing 1 changed file with 36 additions and 73 deletions.
109 changes: 36 additions & 73 deletions packages/amplify-e2e-core/src/categories/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ export function addAuthWithCustomTrigger(cwd: string, settings: any): Promise<vo
.sendCarriageReturn()
.wait(`Do you want to edit your email-filter-denylist${settings.useInclusiveTerminology === false ? '-legacy' : ''} function now?`)
.sendConfirmNo()
.wait('Do you want to edit your custom function now?')
.wait('Do you want to edit your custom function now')
.sendConfirmNo()
.wait('Successfully')
.run((err: Error) => {
if (!err) {
resolve();
Expand Down Expand Up @@ -695,11 +696,10 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise<void> {

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()
Expand All @@ -710,14 +710,11 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise<void> {
.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')
Expand All @@ -729,11 +726,10 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise<void> {
.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')
Expand All @@ -743,20 +739,17 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise<void> {
.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')
Expand All @@ -768,76 +761,53 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise<void> {
.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')
.sendCarriageReturn()
.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')
Expand All @@ -852,20 +822,13 @@ export function addAuthUserPoolOnly(cwd: string, settings: any): Promise<void> {
.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) {
Expand Down

0 comments on commit e34bfbe

Please sign in to comment.