feat(gen2-migration): gen2 test script integration#14718
feat(gen2-migration): gen2 test script integration#14718sanjanaravikumar-az wants to merge 2 commits intogen2-migrationfrom
Conversation
| } | ||
|
|
||
| const runner = new TestRunner(); | ||
| const testFunctions = createTestFunctions(amplifyconfig); |
Check warning
Code scanning / CodeQL
Superfluous trailing arguments Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 9 hours ago
To fix the issue, the extra, unused argument must be removed from the call to createTestFunctions so that the number of arguments matches the function’s declared parameters. This avoids passing a value that the callee neither declares nor uses, which is exactly what CodeQL is flagging.
Concretely, in amplify-migration-apps/discussions/gen2-test-script.ts, update the line:
const testFunctions = createTestFunctions(amplifyconfig);to call createTestFunctions with no arguments:
const testFunctions = createTestFunctions();No other changes are necessary: amplifyconfig is still correctly used in Amplify.configure(amplifyconfig) and passed to createTestOrchestrator(testFunctions, runner, amplifyconfig), which appears to be the intended consumer of the configuration. No additional imports, methods, or definitions are required.
| @@ -59,7 +59,7 @@ | ||
| } | ||
|
|
||
| const runner = new TestRunner(); | ||
| const testFunctions = createTestFunctions(amplifyconfig); | ||
| const testFunctions = createTestFunctions(); | ||
| const { | ||
| runQueryTests, | ||
| runTopicMutationTests, |
| runStorageTests, | ||
| runBookmarksTests, | ||
| runCleanupTests, | ||
| } = createTestOrchestrator(testFunctions, runner, amplifyconfig); |
Check warning
Code scanning / CodeQL
Superfluous trailing arguments Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 9 hours ago
To fix the problem, the extra, unused argument should be removed from the call to createTestOrchestrator, so that the call matches the function’s declared parameters. This keeps the behavior unchanged, because amplifyconfig is already used where needed (in createTestFunctions(amplifyconfig)), and the orchestrator simply consumes the resulting testFunctions and runner.
Concretely, in amplify-migration-apps/discussions/gen2-test-script.ts, update the call on line 72 from:
} = createTestOrchestrator(testFunctions, runner, amplifyconfig);to:
} = createTestOrchestrator(testFunctions, runner);No new imports, methods, or definitions are required. This change aligns the call with the function’s declared signature and removes the superfluous trailing argument.
| @@ -69,7 +69,7 @@ | ||
| runStorageTests, | ||
| runBookmarksTests, | ||
| runCleanupTests, | ||
| } = createTestOrchestrator(testFunctions, runner, amplifyconfig); | ||
| } = createTestOrchestrator(testFunctions, runner); | ||
|
|
||
| // Get current user ID for activity tests | ||
| const currentUser = await getCurrentUser(); |
Description of changes
Adds Gen2 test script execution to the e2e migration flow. After the Gen2 sandbox deploys (step 11), the system now runs
gen2-test-script.tsif present in the app directory. This validates that the Gen2 deployment works before proceeding to refactor.The gen2 test script for project-boards follows the same pattern as the gen1 script: uses
TestRunnerfrom_test-common, provisions users viaprovisionTestUser, and reusescreateTestFunctions/createTestOrchestratorfromtest-utils.ts. The only difference is it readsamplify_outputs.jsoninstead ofamplifyconfiguration.json.Changes:
gen2-test-script.ts(new): Gen2 test entry point for project-boards, mirrors gen1-test-script structuretest-utils.ts: Removed hardcoded Amplify config import — the calling script (gen1 or gen2) now handlesAmplify.configure()before test functions are invoked_test-common/signup.ts:provisionTestUsernow supports both Gen1 (aws_user_pools_id) and Gen2 (auth.user_pool_id) config formats, with case-insensitive attribute mapping forusername_attributescli.ts: AddedrunGen2TestScriptfunction (same pattern asrunGen1TestScript), call after step 11, andnpm installbefore step 18 redeploy to restore Gen2 deps wiped by the post-refactor test scriptBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.