Skip to content

feat(gen2-migration): add test script to product-catalog app#14495

Draft
sanjanaravikumar-az wants to merge 6 commits intogen2-migrationfrom
sanjrkmr/product-catalog-test-script
Draft

feat(gen2-migration): add test script to product-catalog app#14495
sanjanaravikumar-az wants to merge 6 commits intogen2-migrationfrom
sanjrkmr/product-catalog-test-script

Conversation

@sanjanaravikumar-az
Copy link

This script provides frontend-backend testing for the product-catalog app's Amplify backend.

What it tests:

  • GraphQL queries (listProducts, getProduct, listUsers, getUser, listComments, commentsByProductId, checkLowStock Lambda)
  • GraphQL mutations (CRUD operations for Products, Users, and Comments)
  • S3 storage operations (upload product images, get signed URLs)
  • Role-Based Access Control (ADMIN, MANAGER, VIEWER permissions)
  • Business logic (product filtering, sorting, low stock report generation)

How it works:

  • Authenticates via Cognito user pool (IAM auth required for all operations)
  • Runs query tests to verify data retrieval
  • Performs full CRUD cycle on Products, Users, and Comments (create → update → delete)
  • Tests S3 storage by uploading images and retrieving signed URLs
  • Tests full product-with-image workflow (create product → upload image → link image to product)
  • Validates role-based permissions based on current user's role
  • Tests client-side filtering and sorting logic
  • Cleans up test data and signs out

Users need to update TEST_USER credentials before running tests.

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 January 20, 2026 16:18
@9pace 9pace self-requested a review January 22, 2026 16:34
Copy link

@9pace 9pace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like gen2-test-script.ts still has residual duplicated code from the original PR.

// PART 1: GraphQL Query Tests (Requires Auth)
// ============================================================

async function testListProducts(): Promise<string | null> {
Copy link

@9pace 9pace Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should import from test-utils following the same pattern as in gen1 script

@sanjanaravikumar-az sanjanaravikumar-az marked this pull request as draft February 11, 2026 17:07
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.

2 participants

Comments