How anshita-bhasin/cypress_k6 works
Project Type and Purpose
• This is a multi-module training repository for:
• Learning core JavaScript (the “Javascript” folder)
• Front-end & API test automation with Cypress (the “cypress_training/cypress” folder)
• *(Intended)* performance/load testing with k6 (per the README, even though we don’t see the k6 folder in your tree)
File Structure
• Top level:
• Javascript/ … → dozens of plain JS examples (arrays, loops, promises, classes, etc.)
• cypress_training/
– cypress.config.js → Cypress configuration
– cypress/
· fixtures/ → test data (JSON, Excel)
· downloads/ → captured files during tests
· e2e/… → all your .cy.js test specs
– support/ → shared commands/helpers
– package.json & node_modules → Node.js ecosystem for Cypress
• Key Patterns:
• Separation of Concerns: JS examples vs. E2E tests vs. performance tests
• Test-Driven Layers: Fixtures & commands feed into spec files, which drive the Cypress runner
Extract Additional Insights from the README
• The README explicitly lays out three modules:
1. JavaScript Basics (src or Javascript directory)
2. Cypress for UI/API testing
3. k6 for load testing
• It also describes the execution flow:
• node src/example.js for JS
• npx cypress open or npx cypress run for E2E
• k6 run k6/load_test.js for performance
Main Components and Their Interactions
A. Developer Workstation (Node.js environment)
• Runs all three modules
B. JavaScript Examples Module
• Files in /Javascript
• Executed directly by Node.js → console output
C. Cypress E2E Test Module
• Cypress Test Runner (Node process)
• loads:
• Test specs (.cy.js)
• Fixtures (JSON, Excel)
• Support files (commands.js, e2e.js)
• Spawns a Browser (Chrome/Electron)
• Drives the System Under Test (could be a local app or public web pages / APIs) via HTTP/DOM
• Writes outputs to cypress/downloads and on-screen test reports
D. k6 Load Test Module (per README)
• k6 CLI (Go-based tool)
• Load script (k6/load_test.js)
• Fires HTTP requests/virtual users at the same SUT endpoints
• Generates metrics (VU counts, latency, throughput)
Architectural Patterns & Design Principles
• Modularity: Three self-contained training modules
• Separation of Concerns: each layer (examples, functional tests, performance tests) lives in its own folder
• Single Source of Truth for Config: cypress.config.js centralizes environment settings
• Reusable Test Helpers: cypress/support/commands.js