Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alharris-at authored Jun 4, 2022
1 parent b0a4447 commit 5ae249f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 39 deletions.
63 changes: 38 additions & 25 deletions packages/amplify-e2e-core/src/init/initProjectHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ export function initJSProjectWithProfile(cwd: string, settings?: Partial<typeof
.sendLine(s.profileName);
}

chain.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (err) {
reject(err);
} else {
resolve();
}
});
chain
.wait('Help improve Amplify CLI by sharing non sensitive configurations on failures')
.sendYes()
.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/)
.run((err: Error) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}

Expand Down Expand Up @@ -120,6 +124,8 @@ export function initAndroidProjectWithProfile(cwd: string, settings: Object): Pr
.sendCarriageReturn()
.wait('Please choose the profile you want to use')
.sendLine(s.profileName)
.wait('Help improve Amplify CLI by sharing non sensitive configurations on failures')
.sendYes()
.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/)
.run((err: Error) => {
if (!err) {
Expand Down Expand Up @@ -167,6 +173,8 @@ export function initIosProjectWithProfile(cwd: string, settings: Object): Promis
.sendCarriageReturn()
.wait('Please choose the profile you want to use')
.sendLine(s.profileName)
.wait('Help improve Amplify CLI by sharing non sensitive configurations on failures')
.sendYes()
.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/)
.run((err: Error) => {
if (!err) {
Expand All @@ -186,7 +194,7 @@ export function initFlutterProjectWithProfile(cwd: string, settings: Object): Pr
addCircleCITags(cwd);

return new Promise((resolve, reject) => {
let chain = spawn(getCLIPath(), ['init'], { cwd, stripColors: true })
const chain = spawn(getCLIPath(), ['init'], { cwd, stripColors: true })
.wait('Enter a name for the project')
.sendLine(s.name)
.wait('Initialize the project with the above configuration?')
Expand All @@ -207,14 +215,16 @@ export function initFlutterProjectWithProfile(cwd: string, settings: Object): Pr
.sendLine(s.profileName);

singleSelect(chain, s.region, amplifyRegions);

chain.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
chain
.wait('Help improve Amplify CLI by sharing non sensitive configurations on failures')
.sendYes()
.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
});
}

Expand All @@ -227,7 +237,7 @@ export function initProjectWithAccessKey(
addCircleCITags(cwd);

return new Promise((resolve, reject) => {
let chain = spawn(getCLIPath(), ['init'], {
const chain = spawn(getCLIPath(), ['init'], {
cwd,
stripColors: true,
env: {
Expand Down Expand Up @@ -268,21 +278,24 @@ export function initProjectWithAccessKey(

singleSelect(chain, s.region, amplifyRegions);

chain.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
chain
.wait('Help improve Amplify CLI by sharing non sensitive configurations on failures')
.sendYes()
.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
});
}

export function initNewEnvWithAccessKey(cwd: string, s: { envName: string; accessKeyId: string; secretAccessKey: string }): Promise<void> {
addCircleCITags(cwd);

return new Promise((resolve, reject) => {
let chain = spawn(getCLIPath(), ['init'], {
const chain = spawn(getCLIPath(), ['init'], {
cwd,
stripColors: true,
env: {
Expand Down
17 changes: 10 additions & 7 deletions packages/amplify-e2e-core/src/utils/pinpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,16 @@ export function initProjectForPinpoint(cwd: string): Promise<void> {

singleSelect(chain, settings.region, amplifyRegions);

chain.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
chain
.wait('Help improve Amplify CLI by sharing non sensitive configurations on failures')
.sendYes()
.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
});
}

Expand Down
17 changes: 10 additions & 7 deletions packages/amplify-e2e-tests/src/init-special-cases/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,15 @@ async function initWorkflow(cwd: string, settings: { accessKeyId: string; secret

singleSelect(chain, settings.region, amplifyRegions);

chain.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
chain
.wait('Help improve Amplify CLI by sharing non sensitive configurations on failures')
.sendYes()
.wait(/Try "amplify add api" to create a backend API and then "amplify (push|publish)" to deploy everything/).run((err: Error) => {
if (!err) {
resolve();
} else {
reject(err);
}
});
});
}

0 comments on commit 5ae249f

Please sign in to comment.