forked from aws-amplify/amplify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: latest headless add auth app secret
- Loading branch information
Showing
5 changed files
with
109 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { | ||
deleteProject, | ||
amplifyPushNonInteractive, | ||
addHeadlessAuth, | ||
createNewProjectDir, | ||
deleteProjectDir, | ||
initAndroidProjectWithProfile, | ||
getCLIInputs, | ||
setCLIInputs, | ||
} from '@aws-amplify/amplify-e2e-core'; | ||
import { | ||
// eslint-disable-next-line spellcheck/spell-checker | ||
AddAuthRequest, | ||
CognitoUserPoolSigninMethod, | ||
CognitoUserProperty, | ||
} from 'amplify-headless-interface'; | ||
import { assertAppClientSecretInFiles } from '@aws-amplify/amplify-e2e-core/src/utils/auth-utils'; | ||
|
||
const PROJECT_NAME = 'authTest'; | ||
const defaultsSettings = { | ||
name: PROJECT_NAME, | ||
}; | ||
|
||
describe('headless auth g', () => { | ||
let projRoot: string; | ||
beforeEach(async () => { | ||
projRoot = await createNewProjectDir('auth-update'); | ||
}); | ||
|
||
afterEach(async () => { | ||
await deleteProject(projRoot); | ||
deleteProjectDir(projRoot); | ||
}); | ||
|
||
it('adds auth resource to android project', async () => { | ||
const addAuthRequest: AddAuthRequest = { | ||
version: 2, | ||
resourceName: 'myAuthResource', | ||
serviceConfiguration: { | ||
serviceName: 'Cognito', | ||
includeIdentityPool: false, | ||
userPoolConfiguration: { | ||
requiredSignupAttributes: [CognitoUserProperty.EMAIL, CognitoUserProperty.PHONE_NUMBER], | ||
// eslint-disable-next-line spellcheck/spell-checker | ||
signinMethod: CognitoUserPoolSigninMethod.USERNAME, | ||
}, | ||
}, | ||
}; | ||
|
||
await initAndroidProjectWithProfile(projRoot, defaultsSettings); | ||
await addHeadlessAuth(projRoot, addAuthRequest); | ||
|
||
// update parameter to generate client Secret | ||
const parameters = getCLIInputs(projRoot, 'auth', addAuthRequest.resourceName); | ||
parameters.cognitoConfig.userpoolClientGenerateSecret = true; | ||
setCLIInputs(projRoot, 'auth', addAuthRequest.resourceName, parameters); | ||
|
||
await amplifyPushNonInteractive(projRoot); | ||
|
||
await assertAppClientSecretInFiles(projRoot, 'android'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters