Skip to content

Commit

Permalink
fix: smoke test flakynes (#12760)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolk committed Jun 7, 2023
1 parent 9e81705 commit 5654640
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/amplify-e2e-tests/src/__tests__/smoketest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ export type SmoketestArgs = {
destructive: boolean;
};

function defaultProjectDirectoryName(): string {
let projectDir;
do {
projectDir = path.join(os.tmpdir(), `smoketest_${Math.floor(Math.random() * 1000000)}`);
} while (fs.existsSync(projectDir));
fs.ensureDirSync(projectDir);
return projectDir;
}

function getArgs(): SmoketestArgs {
const { DESTRUCTIVE = 'false', CLI_VERSION = 'latest', PROJECT_DIRECTORY = path.join(os.tmpdir(), 'smoketest') } = process.env;
const { DESTRUCTIVE = 'false', CLI_VERSION = 'latest', PROJECT_DIRECTORY = defaultProjectDirectoryName() } = process.env;
return {
projectDirectory: PROJECT_DIRECTORY,
cliVersion: CLI_VERSION,
Expand Down Expand Up @@ -138,7 +147,7 @@ export class Amplify {
.runAsync();
};
addRestApi = () => {
return spawn(getCLIPath(), ['add', 'api'], { ...this.executionArgs, noOutputTimeout: 3000 })
return spawn(getCLIPath(), ['add', 'api'], { ...this.executionArgs, noOutputTimeout: 10000 })
.wait('Select from one of the below mentioned services')
.sendKeyDown()
.sendCarriageReturn()
Expand Down

0 comments on commit 5654640

Please sign in to comment.