Skip to content

Commit 840ca24

Browse files
committed
fix(e2e): handle path overlap warning prompt in addRestApi
1 parent dbc9d16 commit 840ca24

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

packages/amplify-e2e-core/src/categories/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ export function addRestApi(cwd: string, settings: RestAPISettings) {
477477
.sendCarriageReturn() // Add another path
478478
.wait('Provide a path')
479479
.sendLine(settings.path)
480+
.wait(/overlaps with.*Are you sure you want to continue|Choose a lambda source/, (data: string) => {
481+
if (/overlaps with/.test(data)) {
482+
chain.getProcess()?.write('y');
483+
}
484+
})
480485
.wait('Choose a lambda source');
481486

482487
if (settings.existingLambda) {

packages/amplify-e2e-core/src/utils/nexpect.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export type ExecutionContext = {
9898
*/
9999
run: (cb: (err: any, signal?: any) => void) => ExecutionContext;
100100
runAsync: (expectedErrorPredicate?: (err: Error) => boolean) => Promise<void>;
101+
getProcess: () => Recorder | undefined;
101102
};
102103

103104
/**
@@ -388,6 +389,9 @@ function chain(context: Context): ExecutionContext {
388389
context.queue.push(_delay);
389390
return chain(context);
390391
},
392+
getProcess(): Recorder | undefined {
393+
return context.process;
394+
},
391395
};
392396
const run = (callback: (err: any, code?: number, signal?: string | number) => void): ExecutionContext => {
393397
let errState: any = null;

0 commit comments

Comments
 (0)