Skip to content

Conversation

@usepowershell
Copy link
Contributor

with comprehensive traffic simulations

Purpose

  • Added TypeScript support for test configuration settings and updated dependencies in package.json.
  • Introduced detailed test configurations for store admin and storefront.
  • Created a structured test suite for traffic simulations, including:
    • Casual Browser tests simulating various shopper behaviors.
    • Malicious Buyer tests to validate security against common vulnerabilities.
    • Single Item Buyer tests for focused purchasing scenarios.
  • Implemented retry logic for navigation and interactions to improve test reliability.
  • Documented test categories and usage instructions in README files.
  • Ensured graceful handling of non-existent products and malicious inputs.
  • ...

Does this introduce a breaking change?

[ ] Yes
[X] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
  • Deploy using azd or other method.
  • Change directory into the tests folder
  • If not using azd, then create an .env file with the following variables:
  • SERVICE_STORE_ADMIN_ENDPOINT_URL
  • SERVICE_STORE_FRONT_ENDPOINT_URL
  • COMPANY_NAME
  • npm install
  • npm run test

What to Check

Verify that the following are valid

  • Tests should pass

Other Information

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces comprehensive traffic simulation tests for the Playwright test suite, significantly expanding test coverage with security testing, multiple test categories, and TypeScript support. The changes standardize configuration management across all tests and add realistic user behavior simulations.

Key changes include:

  • Added comprehensive traffic simulation tests (casual browsers, single-item buyers, malicious buyers)
  • Implemented TypeScript support with centralized configuration management
  • Enhanced test structure with organized e2e tests and documentation
  • Added security testing capabilities including SQL injection, XSS, and URL manipulation protection

Reviewed Changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/traffic/single-item-buyer.spec.ts New traffic simulation tests for focused purchasing behaviors
tests/traffic/malicious-buyer.spec.ts Security testing suite with various attack simulations
tests/traffic/casual-browser.spec.ts Browsing behavior simulation with retry logic
tests/traffic/README.md Comprehensive documentation for traffic simulation tests
tests/test-config.ts TypeScript configuration module for shared test settings
tests/test-config.js JavaScript configuration module for test environments
tests/playwright.config.ts Updated Playwright configuration with new test patterns
tests/package.json Enhanced package dependencies and npm scripts
Files not reviewed (1)
  • tests/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)

tests/package.json:10

  • TypeScript version 5.8.3 does not exist. The latest TypeScript version as of January 2025 was 5.x series but 5.8.3 is not a valid version. Consider using a stable release like "^5.6.0" or "^5.7.0".
    "typescript": "^5.8.3"

tests/package.json:15

  • @types/node version 22.16.5 appears to be non-existent. Node.js types typically follow semantic versioning but this specific patch version may not exist. Consider using a verified version like "^22.15.0" or "^22.16.0".
    "@types/node": "^22.16.5"

@pauldotyu
Copy link
Contributor

/test-e2e

@github-actions
Copy link

🚀 @pauldotyu Starting E2E tests...

Workflow Run: 16631284349
Environment: e2etest
Location: australiaeast

@github-actions
Copy link

@pauldotyu E2E tests failed!

Workflow Run: 16631284349
Status: Failed
Environment: e2etest
Location: australiaeast

Please check the workflow logs for details and try again.

@usepowershell
Copy link
Contributor Author

Looking at the test run logs, it looks like the UI either isn't loading the product data or the product data isn't being returned in time - https://playwright.microsoft.com/workspaces/westus3_f54d59c1-c74e-441a-9a9a-5fdbcf7deb1c/runs/56879c61c54dd4c69f035def50a229e16833342e/tests/7b8b2e36-4e07-44dc-8575-77e8fb745ab5

@usepowershell
Copy link
Contributor Author

For CI, if you'd like, we could strip it back to the basic test runs (which would be closer to the previous test coverage) for both the store-front and store-admin and leave the other tests for local usage.

… simulations

- Added TypeScript support and updated dependencies in package.json.
- Introduced detailed test configurations for store admin and storefront.
- Created a structured test suite for traffic simulations, including:
  - Casual Browser tests simulating various shopper behaviors.
  - Malicious Buyer tests to validate security against common vulnerabilities.
  - Single Item Buyer tests for focused purchasing scenarios.
- Implemented retry logic for navigation and interactions to improve test reliability.
- Documented test categories and usage instructions in README files.
- Ensured graceful handling of non-existent products and malicious inputs.
@usepowershell
Copy link
Contributor Author

/test-e2e

@github-actions
Copy link

🚀 @smurawski Starting E2E tests...

Workflow Run: 16657664455
Environment: e2etest
Location: australiaeast

@github-actions
Copy link

✅ @smurawski E2E tests completed successfully!

Workflow Run: 16657664455
Duration: ~36 minutes
Status: Passed
Environment: e2etest
Location: australiaeast

All tests passed and resources have been cleaned up.

Copy link
Contributor

@pauldotyu pauldotyu left a comment

Choose a reason for hiding this comment

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

Nice @smurawski! This is extremely useful.

@usepowershell usepowershell merged commit ca7f6fa into Azure-Samples:main Jul 31, 2025
1 check passed
@usepowershell usepowershell deleted the playwright_tests branch July 31, 2025 20:12
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