Skip to content

feat(gen2-migration): gen2 test script integration#14718

Draft
sanjanaravikumar-az wants to merge 2 commits intogen2-migrationfrom
sanjrkmr-gen2-test-script-integration
Draft

feat(gen2-migration): gen2 test script integration#14718
sanjanaravikumar-az wants to merge 2 commits intogen2-migrationfrom
sanjrkmr-gen2-test-script-integration

Conversation

@sanjanaravikumar-az
Copy link
Copy Markdown
Contributor

@sanjanaravikumar-az sanjanaravikumar-az commented Mar 29, 2026

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.ts if 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 TestRunner from _test-common, provisions users via provisionTestUser, and reuses createTestFunctions/createTestOrchestrator from test-utils.ts. The only difference is it reads amplify_outputs.json instead of amplifyconfiguration.json.

Changes:

  • gen2-test-script.ts (new): Gen2 test entry point for project-boards, mirrors gen1-test-script structure
  • test-utils.ts: Removed hardcoded Amplify config import — the calling script (gen1 or gen2) now handles Amplify.configure() before test functions are invoked
  • _test-common/signup.ts: provisionTestUser now supports both Gen1 (aws_user_pools_id) and Gen2 (auth.user_pool_id) config formats, with case-insensitive attribute mapping for username_attributes
  • cli.ts: Added runGen2TestScript function (same pattern as runGen1TestScript), call after step 11, and npm install before step 18 redeploy to restore Gen2 deps wiped by the post-refactor test script

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sanjanaravikumar-az sanjanaravikumar-az requested a review from a team as a code owner March 29, 2026 15:31
@sanjanaravikumar-az sanjanaravikumar-az marked this pull request as draft March 29, 2026 15:31
}

const runner = new TestRunner();
const testFunctions = createTestFunctions(amplifyconfig);

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning

Superfluous argument passed to
function createTestFunctions
.

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.

Suggested changeset 1
amplify-migration-apps/discussions/gen2-test-script.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/amplify-migration-apps/discussions/gen2-test-script.ts b/amplify-migration-apps/discussions/gen2-test-script.ts
--- a/amplify-migration-apps/discussions/gen2-test-script.ts
+++ b/amplify-migration-apps/discussions/gen2-test-script.ts
@@ -59,7 +59,7 @@
   }
 
   const runner = new TestRunner();
-  const testFunctions = createTestFunctions(amplifyconfig);
+  const testFunctions = createTestFunctions();
   const {
     runQueryTests,
     runTopicMutationTests,
EOF
@@ -59,7 +59,7 @@
}

const runner = new TestRunner();
const testFunctions = createTestFunctions(amplifyconfig);
const testFunctions = createTestFunctions();
const {
runQueryTests,
runTopicMutationTests,
Copilot is powered by AI and may make mistakes. Always verify output.
runStorageTests,
runBookmarksTests,
runCleanupTests,
} = createTestOrchestrator(testFunctions, runner, amplifyconfig);

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning

Superfluous argument passed to
function createTestOrchestrator
.

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.

Suggested changeset 1
amplify-migration-apps/discussions/gen2-test-script.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/amplify-migration-apps/discussions/gen2-test-script.ts b/amplify-migration-apps/discussions/gen2-test-script.ts
--- a/amplify-migration-apps/discussions/gen2-test-script.ts
+++ b/amplify-migration-apps/discussions/gen2-test-script.ts
@@ -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();
EOF
@@ -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();
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant