-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update migration tests to handle new text (#6545)
* test: update migration tests to handle new text * fix: check for headless params
- Loading branch information
Showing
9 changed files
with
146 additions
and
38 deletions.
There are no files selected for viewing
11 changes: 6 additions & 5 deletions
11
...s/src/__tests__/migration_tests/auth-deployment-migration/auth.deployment.secrets.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
...ests/src/__tests__/migration_tests/transformer_migration/api.searchable.migration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 11 additions & 4 deletions
15
packages/amplify-migration-tests/src/__tests__/update_tests/api_migration_update.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 10 additions & 7 deletions
17
packages/amplify-migration-tests/src/__tests__/update_tests/auth_migration_update.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 17 additions & 4 deletions
21
...ages/amplify-migration-tests/src/__tests__/update_tests/function_migration_update.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 12 additions & 3 deletions
15
packages/amplify-migration-tests/src/__tests__/update_tests/storage_migration_update.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
packages/amplify-migration-tests/src/migration-helpers/init.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { addCircleCITags, getCLIPath, isCI, nspawn as spawn } from 'amplify-e2e-core'; | ||
|
||
const defaultSettings = { | ||
name: '\r', | ||
envName: 'integtest', | ||
editor: '\r', | ||
appType: '\r', | ||
framework: '\r', | ||
srcDir: '\r', | ||
distDir: '\r', | ||
buildCmd: '\r', | ||
startCmd: '\r', | ||
useProfile: '\r', | ||
profileName: '\r', | ||
region: process.env.CLI_REGION, | ||
local: false, | ||
disableAmplifyAppCreation: true, | ||
}; | ||
|
||
export function initJSProjectWithProfile(cwd: string, settings: Object, testingWithLatestCodebase = false) { | ||
const s = { ...defaultSettings, ...settings }; | ||
let env; | ||
|
||
if (s.disableAmplifyAppCreation === true) { | ||
env = { | ||
CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1', | ||
}; | ||
} | ||
|
||
addCircleCITags(cwd); | ||
|
||
return new Promise((resolve, reject) => { | ||
const chain = spawn(getCLIPath(testingWithLatestCodebase), ['init'], { cwd, stripColors: true, env }) | ||
.wait('Enter a name for the project') | ||
.sendLine(s.name) | ||
.wait('Enter a name for the environment') | ||
.sendLine(s.envName) | ||
.wait('Choose your default editor:') | ||
.sendLine(s.editor) | ||
.wait("Choose the type of app that you're building") | ||
.sendLine(s.appType) | ||
.wait('What javascript framework are you using') | ||
.sendLine(s.framework) | ||
.wait('Source Directory Path:') | ||
.sendLine(s.srcDir) | ||
.wait('Distribution Directory Path:') | ||
.sendLine(s.distDir) | ||
.wait('Build Command:') | ||
.sendLine(s.buildCmd) | ||
.wait('Start Command:') | ||
.sendCarriageReturn() | ||
.wait('Using default provider awscloudformation'); | ||
|
||
if (testingWithLatestCodebase || !isCI()) { | ||
chain.wait('Select the authentication method you want to use:').sendCarriageReturn(); | ||
} else { | ||
chain.wait('Do you want to use an AWS profile?').sendLine('y'); | ||
} | ||
|
||
chain | ||
.wait('Please choose the profile you want to use') | ||
.sendLine(s.profileName) | ||
.wait('Try "amplify add api" to create a backend API and then "amplify publish" to deploy everything') | ||
.run((err: Error) => { | ||
if (!err) { | ||
resolve(); | ||
} else { | ||
reject(err); | ||
} | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters