Skip to content

Commit a13421f

Browse files
committed
fix: corrected rest api waits
1 parent cf673fb commit a13421f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/amplify-e2e-tests/src/__tests__/smoketest.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as fs from 'fs-extra';
44
import * as os from 'os';
55
import * as pty from 'node-pty';
66
import { nspawn as spawn } from '@aws-amplify/amplify-e2e-core';
7+
jest.retryTimes(0);
78

89
export const NPM = {
910
install(pkgName: string, isGlobal: boolean = false): Promise<void> {
@@ -141,13 +142,14 @@ export class Amplify {
141142
.runAsync();
142143
};
143144
addRestApi = () => {
144-
return spawn('amplify', ['add', 'api'], this.executionArgs)
145+
return spawn('amplify', ['add', 'api'], { ...this.executionArgs, noOutputTimeout: 3000 })
145146
.wait('Select from one of the below mentioned services')
146147
.sendKeyDown()
147148
.sendCarriageReturn()
148149
.wait('Provide a friendly name')
150+
.delay(500)
149151
.sendCarriageReturn()
150-
.wait('Provide a path (e.g. /book/{isbn}):')
152+
.wait('Provide a path')
151153
.sendCarriageReturn()
152154
.wait('Choose a Lambda source')
153155
.sendCarriageReturn()
@@ -158,13 +160,14 @@ export class Amplify {
158160
.wait('Choose the function template that you want to use:')
159161
.sendCarriageReturn()
160162
.wait('Do you want to configure advanced settings?')
161-
.sendNo()
163+
.sendLine('n')
162164
.wait('Do you want to edit the local lambda function now?')
163-
.sendNo()
165+
.sendLine('n')
164166
.wait('Restrict API access?')
165-
.sendCarriageReturn()
167+
.sendLine('n')
166168
.wait('Do you want to add another path?')
167169
.sendNo()
170+
168171
.runAsync();
169172
};
170173
status = () => {
@@ -175,7 +178,6 @@ export class Amplify {
175178
const [apiName] = fs.readdirSync(path.join(this.executionArgs.cwd, 'amplify', 'backend', 'api'));
176179
const targetPath = path.join(this.executionArgs.cwd, 'amplify', 'backend', 'api', apiName, 'schema.graphql');
177180
fs.writeFileSync(targetPath, schema);
178-
console.info('Wrote to', targetPath);
179181
return Promise.resolve(0);
180182
} catch (e) {
181183
return Promise.reject(1);
@@ -203,7 +205,7 @@ type Todo @model {
203205
function writeBanner(text: string) {
204206
const count = text.length;
205207
const textPadding = 3;
206-
console.log('\n');
208+
process.stdout.write('\n');
207209
process.stdout.write('#'.repeat(count + 2 + textPadding * 2));
208210
process.stdout.write('\n');
209211
process.stdout.write(`#${' '.repeat(count + textPadding * 2)}#`);
@@ -282,7 +284,6 @@ describe('Release Smoke Tests', () => {
282284
];
283285
test('An amplify project can be created without error', async () => {
284286
const args = getArgs();
285-
console.info(args.projectDirectory);
286287

287288
const amplify = new Amplify(args.projectDirectory);
288289
createProjectDirectory(args.projectDirectory);
@@ -297,6 +298,5 @@ describe('Release Smoke Tests', () => {
297298
writeBanner(command.description);
298299
await command.run();
299300
}
300-
expect.assertions(0);
301301
});
302302
});

0 commit comments

Comments
 (0)