Skip to content

Commit

Permalink
fix: snapshot and prompt for custom test
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshay Upadhyay committed Feb 3, 2023
1 parent f5da497 commit 2ff2b5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions packages/amplify-e2e-core/src/categories/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ export const addCDKCustomResource = async (cwd: string, settings: any): Promise<

export function addCFNCustomResource(cwd: string, settings: any, testingWithLatestCodebase = false): Promise<void> {
return new Promise((resolve, reject) => {
spawn(getCLIPath(testingWithLatestCodebase), ['add', 'custom'], { cwd, stripColors: true })
const chain = spawn(getCLIPath(testingWithLatestCodebase), ['add', 'custom'], { cwd, stripColors: true })
.wait('How do you want to define this custom resource?')
.send(KEY_DOWN_ARROW)
.sendCarriageReturn()
.wait('Provide a name for your custom resource')
.sendLine(settings.name || '\r')
.wait('Do you want to access Amplify generated resources in your custom CloudFormation file?')
.sendConfirmYes()
.wait('Select the categories you want this custom resource to have access to.')
.send(' ')
.sendCarriageReturn()
.wait(/.*/)
.sendConfirmYes();
if(settings.promptForCategorySelection){
chain.wait('Select the categories you want this custom resource to have access to.')
.send(' ')
.sendCarriageReturn()
}
chain.wait(/.*/)
.wait('Do you want to edit the CloudFormation stack now?')
.sendConfirmNo()
.sendEof()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ describe('adding custom resources test', () => {
expect(customResourceSNSArn).toBeDefined();

// Add custom CFN and add dependency of custom CDK resource on the custom CFN

await addCFNCustomResource(projRoot, { name: cfnResourceName });
await addCFNCustomResource(projRoot, { name: cfnResourceName, promptForCategorySelection: false });

const customCFNFilePath = path.join(
projRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Parameters
[-] Parameter googleClientId: {\\"Type\\":\\"String\\"}
[-] Parameter amazonAppId: {\\"Type\\":\\"String\\"}
[-] Parameter appleAppId: {\\"Type\\":\\"String\\"}
[~] Parameter hostedUIProviderCreds: {"Type":"String"} to {"Type":"String","NoEcho":true}
Resources
[~] AWS::Lambda::Function UserPoolClientLambda
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('adding custom resources migration test', () => {
await amplifyPushAuth(projRoot2, usingLatestCode);

// // Using latest code, add custom CFN and add dependency of custom CDK resource on the custom CFN
await addCFNCustomResource(projRoot2, { name: cfnResourceName }, usingLatestCode);
await addCFNCustomResource(projRoot2, { name: cfnResourceName, promptForCategorySelection: false }, usingLatestCode);
const customCFNFilePath = path.join(
projRoot2,
'amplify',
Expand Down

0 comments on commit 2ff2b5d

Please sign in to comment.