Skip to content

[Jules-2]: Implement E2E and Cross-Platform Testing (Story 0.2.3)#40

Open
dmisiuk wants to merge 4 commits into
mainfrom
feature/34-jules
Open

[Jules-2]: Implement E2E and Cross-Platform Testing (Story 0.2.3)#40
dmisiuk wants to merge 4 commits into
mainfrom
feature/34-jules

Conversation

@dmisiuk

@dmisiuk dmisiuk commented Sep 25, 2025

Copy link
Copy Markdown
Owner

This commit introduces a comprehensive end-to-end (E2E) testing framework with full cross-platform validation and terminal recording, as outlined in Story 0.2.3.

Key features include:

  • E2E Test Framework: A new framework in tests/e2e/ for running full application workflows.
  • Cross-Platform CI Matrix: An enhanced GitHub Actions workflow (.github/workflows/ci.yml) that runs E2E tests on Ubuntu, macOS, and Windows.
  • Terminal Recording: Integration with asciinema to record terminal sessions for E2E tests, with artifacts saved for review.
  • Platform-Specific Testing: A new suite of tests in tests/cross_platform/ to validate OS-specific behaviors.
  • Comprehensive Reporting: A new reporting system in tests/reporting/ that aggregates E2E test results and generates an HTML summary with links to recordings.

The implementation also includes updates to project documentation (testing-standards.md, testing-quickstart.md) and fixes to the existing test scripts to ensure compatibility and correctness.

Resolves #34

Story Reference

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Demo Content (Auto-populated by demo automation)

Feature Demo

Feature Demo

Before/After Comparison (for bug fixes)

Before After
Before After

Acceptance Criteria Validation

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Demo infrastructure improvement
  • Documentation update

Testing & Demo Validation

Automated Testing (with Visual Validation)

  • Unit tests pass with visual coverage reports
  • Integration tests pass with screenshot validation
  • E2E tests pass with terminal recordings
  • UI tests pass with baseline comparisons
  • Cross-platform testing completed

Demo Requirements Completed

  • Primary Demo Video: Shows main functionality with visual input overlays
  • Screenshots: Key states and interactions captured
  • Cross-Platform: Tested on Windows, macOS, Linux
  • Before/After: Comparison provided (for bug fixes)
  • AC Validation: All acceptance criteria visually demonstrated

Manual Testing Verification

  • Tested on macOS
  • Tested on Linux
  • Tested on Windows
  • Mouse interactions work correctly
  • Keyboard navigation functions properly
  • Visual feedback is clear and responsive

Development Checklist

  • Epic 0 Dependency: Demo infrastructure is operational (if required)
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Demo videos clearly show functionality with input visualization
  • All acceptance criteria are visually validated
  • README updated with new screenshots/demos (if applicable)

Breaking Changes

(If this is a breaking change, describe the impact and migration path)

Additional Notes

(Any additional context, technical decisions, or future considerations)

This commit introduces a comprehensive end-to-end (E2E) testing framework with full cross-platform validation and terminal recording, as outlined in Story 0.2.3.

Key features include:
- **E2E Test Framework:** A new framework in `tests/e2e/` for running full application workflows.
- **Cross-Platform CI Matrix:** An enhanced GitHub Actions workflow (`.github/workflows/ci.yml`) that runs E2E tests on Ubuntu, macOS, and Windows.
- **Terminal Recording:** Integration with `asciinema` to record terminal sessions for E2E tests, with artifacts saved for review.
- **Platform-Specific Testing:** A new suite of tests in `tests/cross_platform/` to validate OS-specific behaviors.
- **Comprehensive Reporting:** A new reporting system in `tests/reporting/` that aggregates E2E test results and generates an HTML summary with links to recordings.

The implementation also includes updates to project documentation (`testing-standards.md`, `testing-quickstart.md`) and fixes to the existing test scripts to ensure compatibility and correctness.

Resolves #34
This commit introduces a comprehensive end-to-end (E2E) testing framework with full cross-platform validation and terminal recording, as outlined in Story 0.2.3.

This commit resolves the CI failure on Windows by replacing the `asciinema` dependency with a native PowerShell solution for terminal recording.

Key features include:
- **E2E Test Framework:** A new framework in `tests/e2e/` for running full application workflows.
- **Cross-Platform CI Matrix:** An enhanced GitHub Actions workflow (`.github/workflows/ci.yml`) that runs E2E tests on Ubuntu, macOS, and Windows.
- **Terminal Recording:** Integration with `asciinema` on Linux/macOS and PowerShell's `Start-Transcript` on Windows to record terminal sessions for E2E tests.
- **Platform-Specific Testing:** A new suite of tests in `tests/cross_platform/` to validate OS-specific behaviors.
- **Comprehensive Reporting:** A new reporting system in `tests/reporting/` that aggregates E2E test results and generates an HTML summary with links to recordings from all platforms.

The implementation also includes updates to project documentation (`testing-standards.md`, `testing-quickstart.md`) and fixes to the existing test scripts to ensure compatibility and correctness.

Resolves #34
This commit introduces a comprehensive end-to-end (E2E) testing framework with full cross-platform validation and terminal recording, as outlined in Story 0.2.3.

It resolves previous CI failures by implementing a platform-aware recording mechanism, using `asciinema` for Linux/macOS and PowerShell's `Start-Transcript` for Windows.

Key changes:
- Adds an E2E test suite that builds and runs the application binary.
- Configures GitHub Actions to run E2E tests on a matrix of Ubuntu, macOS, and Windows.
- Implements platform-specific recording and artifact discovery.
- Adds a dedicated test to validate the recording mechanism on each platform.
- Cleans up placeholder files and fixes Makefile/script portability issues.
- Updates all relevant documentation.

Resolves #34
@dmisiuk dmisiuk requested a review from Copilot September 25, 2025 23:04

Copilot AI left a comment

Copy link
Copy Markdown

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 a comprehensive end-to-end testing framework with cross-platform validation and terminal recording capabilities. The implementation includes E2E test runners, platform-specific recording utilities, automated reporting, and CI/CD integration across Ubuntu, macOS, and Windows.

Key changes:

  • New E2E testing framework in tests/e2e/ with workflow tests and utilities
  • Cross-platform terminal recording system using asciinema (Unix) and PowerShell (Windows)
  • Automated test reporting with HTML report generation and artifact aggregation
  • Enhanced CI pipeline with cross-platform E2E test execution and artifact collection

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/scripts/unix_test_tools.sh Added cross-platform performance monitoring with OS-specific CPU and memory commands
tests/scripts/Makefile Fixed missing directory separators and added cross-platform processor count detection
tests/reporting/reporting_utils.go New reporting utilities for E2E test aggregation and HTML report generation
tests/reporting/aggregator_test.go Comprehensive tests for cross-platform E2E artifact discovery and report generation
tests/recording/capture_utils.go Cross-platform terminal recording with asciinema and PowerShell support
tests/e2e/workflow_test.go Core E2E workflow tests for calculator functionality validation
tests/e2e/e2e_utils.go E2E test utilities including binary building, recording, and test orchestration
tests/cross_platform/platform_compat_test.go Platform compatibility tests validating OS-specific behaviors
docs/testing-standards.md Updated documentation reflecting new E2E testing capabilities and structure
docs/testing-quickstart.md Added E2E testing quickstart guide and artifact information
.github/workflows/ci.yml Enhanced CI workflow with cross-platform E2E testing and artifact upload

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tests/scripts/Makefile
@echo "⚡ Running performance benchmarks..."
@cd $(TESTS_DIR)/unit && $(GO) test -bench=. -benchmem -timeout=120s \
-parallel=$(PARALLEL_JOBS) ./... > $(ARTIFACTS_DIR/reports/benchmark_results.txt 2>&1
-parallel=$(PARALLEL_JOBS) ./... > $(ARTIFACTS_DIR)/reports/benchmark_results.txt 2>&1

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The fixes for missing directory separators are correct and resolve the syntax errors in the Makefile variable references. All $(ARTIFACTS_DIR references now properly include the closing parenthesis and path separator.

Copilot uses AI. Check for mistakes.
Comment thread tests/scripts/Makefile
@if [ -f $(ARTIFACTS_DIR)/coverage/unit_coverage.out ]; then \
$(GO) tool cover -html=$(ARTIFACTS_DIR)/coverage/unit_coverage.out \
-o $(ARTIFACTS_DIR/coverage/coverage.html; \
-o $(ARTIFACTS_DIR)/coverage/coverage.html; \

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The fixes for missing directory separators are correct and resolve the syntax errors in the Makefile variable references. All $(ARTIFACTS_DIR references now properly include the closing parenthesis and path separator.

Copilot uses AI. Check for mistakes.
Comment thread tests/scripts/Makefile
@if [ -f $(ARTIFACTS_DIR)/coverage/unit_coverage.out ]; then \
$(GO) tool cover -func=$(ARTIFACTS_DIR)/coverage/unit_coverage.out \
> $(ARTIFACTS_DIR/coverage/coverage_summary.txt; \
> $(ARTIFACTS_DIR)/coverage/coverage_summary.txt; \

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The fixes for missing directory separators are correct and resolve the syntax errors in the Makefile variable references. All $(ARTIFACTS_DIR references now properly include the closing parenthesis and path separator.

Copilot uses AI. Check for mistakes.
Comment thread tests/scripts/Makefile
Comment on lines +100 to +101
-count=3 -timeout=300s ./... > $(ARTIFACTS_DIR)/reports/detailed_benchmarks.txt 2>&1
@echo "✅ Detailed benchmarks: $(ARTIFACTS_DIR)/reports/detailed_benchmarks.txt"

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The fixes for missing directory separators are correct and resolve the syntax errors in the Makefile variable references. All $(ARTIFACTS_DIR references now properly include the closing parenthesis and path separator.

Copilot uses AI. Check for mistakes.
Comment thread tests/scripts/Makefile
Comment on lines +119 to +124
@echo "System Information:" > $(ARTIFACTS_DIR)/reports/unix_system_info.txt
@uname -a >> $(ARTIFACTS_DIR)/reports/unix_system_info.txt
@echo "Go Version:" >> $(ARTIFACTS_DIR)/reports/unix_system_info.txt
@$(GO) version >> $(ARTIFACTS_DIR)/reports/unix_system_info.txt
@echo "Parallel Jobs: $(PARALLEL_JOBS)" >> $(ARTIFACTS_DIR)/reports/unix_system_info.txt
@echo "✅ Unix system report: $(ARTIFACTS_DIR)/reports/unix_system_info.txt"

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The fixes for missing directory separators are correct and resolve the syntax errors in the Makefile variable references. All $(ARTIFACTS_DIR references now properly include the closing parenthesis and path separator.

Copilot uses AI. Check for mistakes.
Comment on lines +308 to +310
memory_usage=$(free -m | awk '/^Mem:/{print $4}')
memory_usage_label="Memory Free (MB)"
fi

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The cross-platform performance monitoring implementation correctly handles OS-specific commands, but the Linux CPU usage calculation may not be robust across all distributions. Consider adding error handling for cases where the expected output format differs.

Suggested change
memory_usage=$(free -m | awk '/^Mem:/{print $4}')
memory_usage_label="Memory Free (MB)"
fi
# Validate cpu_usage is a number; if not, set to "N/A" and warn
if ! [[ "$cpu_usage" =~ ^[0-9]+([.][0-9]+)?$ ]]; then
log_warning "Could not parse CPU usage from 'top' output; setting CPU usage to N/A"
cpu_usage="N/A"
fi
memory_usage=$(free -m | awk '/^Mem:/{print $4}')
memory_usage_label="Memory Free (MB)"

Copilot uses AI. Check for mistakes.
This commit introduces a comprehensive end-to-end (E2E) testing framework with full cross-platform validation and terminal recording, as outlined in Story 0.2.3.

It resolves previous CI failures by implementing a platform-aware recording mechanism, using `asciinema` for Linux/macOS and PowerShell's `Start-Transcript` for Windows.

Key changes:
- Adds an E2E test suite that builds and runs the application binary.
- Configures GitHub Actions to run E2E tests on a matrix of Ubuntu, macOS, and Windows.
- Implements platform-specific recording and artifact discovery.
- Adds a dedicated test to validate the recording mechanism on each platform.
- Cleans up placeholder files and fixes Makefile/script portability issues.
- Updates all relevant documentation.

Resolves #34
@dmisiuk dmisiuk requested a review from Copilot September 25, 2025 23:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tests/scripts/Makefile
else ifeq ($(UNAME_S),Darwin)
NPROC := $(shell sysctl -n hw.ncpu)
else
NPROC := 1

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The fallback NPROC value of 1 may be too conservative for unknown platforms. Consider using a more reasonable default like 2 or 4 to improve performance on unrecognized systems.

Suggested change
NPROC := 1
NPROC := 4

Copilot uses AI. Check for mistakes.
@dmisiuk dmisiuk requested a review from Copilot September 25, 2025 23:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +59 to +73
// Escape arguments for PowerShell
var escapedArgs []string
for _, arg := range args {
escapedArgs = append(escapedArgs, fmt.Sprintf("'%s'", strings.ReplaceAll(arg, "'", "''")))
}

// Construct the PowerShell command string
// Start-Transcript logs the session.
// & executes the command.
// Stop-Transcript stops logging.
// We use -join to handle expressions with spaces correctly.
fullCommand := fmt.Sprintf("& '%s' %s", command, strings.Join(escapedArgs, " "))
psCommand := fmt.Sprintf("Start-Transcript -Path '%s' -NoClobber; try { %s } finally { Stop-Transcript }", filePath, fullCommand)

cmd := exec.Command("powershell.exe", "-NoProfile", "-Command", psCommand)

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The PowerShell argument escaping may be insufficient for complex inputs. Consider using PowerShell's built-in parameter binding or more robust escaping to prevent potential command injection vulnerabilities.

Suggested change
// Escape arguments for PowerShell
var escapedArgs []string
for _, arg := range args {
escapedArgs = append(escapedArgs, fmt.Sprintf("'%s'", strings.ReplaceAll(arg, "'", "''")))
}
// Construct the PowerShell command string
// Start-Transcript logs the session.
// & executes the command.
// Stop-Transcript stops logging.
// We use -join to handle expressions with spaces correctly.
fullCommand := fmt.Sprintf("& '%s' %s", command, strings.Join(escapedArgs, " "))
psCommand := fmt.Sprintf("Start-Transcript -Path '%s' -NoClobber; try { %s } finally { Stop-Transcript }", filePath, fullCommand)
cmd := exec.Command("powershell.exe", "-NoProfile", "-Command", psCommand)
// Use PowerShell's parameter binding to avoid manual escaping
// The script block receives the command and its arguments via $args
// $args[0] is the command, $args[1..$args.Length] are the arguments
psScript := fmt.Sprintf("Start-Transcript -Path '%s' -NoClobber; try { & $args[0] $args[1..$args.Length] } finally { Stop-Transcript }", filePath)
// Build the argument list: -NoProfile, -Command, psScript, command, args...
psArgs := []string{"-NoProfile", "-Command", psScript, command}
psArgs = append(psArgs, args...)
cmd := exec.Command("powershell.exe", psArgs...)

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +71
// Construct the PowerShell command string
// Start-Transcript logs the session.
// & executes the command.
// Stop-Transcript stops logging.
// We use -join to handle expressions with spaces correctly.
fullCommand := fmt.Sprintf("& '%s' %s", command, strings.Join(escapedArgs, " "))
psCommand := fmt.Sprintf("Start-Transcript -Path '%s' -NoClobber; try { %s } finally { Stop-Transcript }", filePath, fullCommand)

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

The filePath is directly interpolated into the PowerShell command string without proper escaping. This could lead to command injection if the path contains special PowerShell characters. Use proper PowerShell parameter escaping or consider using Go's exec.Command with separate arguments.

Suggested change
// Construct the PowerShell command string
// Start-Transcript logs the session.
// & executes the command.
// Stop-Transcript stops logging.
// We use -join to handle expressions with spaces correctly.
fullCommand := fmt.Sprintf("& '%s' %s", command, strings.Join(escapedArgs, " "))
psCommand := fmt.Sprintf("Start-Transcript -Path '%s' -NoClobber; try { %s } finally { Stop-Transcript }", filePath, fullCommand)
// Escape single quotes in filePath for PowerShell
escapedFilePath := strings.ReplaceAll(filePath, "'", "''")
// Construct the PowerShell command string
// Start-Transcript logs the session.
// & executes the command.
// Stop-Transcript stops logging.
// We use -join to handle expressions with spaces correctly.
fullCommand := fmt.Sprintf("& '%s' %s", command, strings.Join(escapedArgs, " "))
psCommand := fmt.Sprintf("Start-Transcript -Path '%s' -NoClobber; try { %s } finally { Stop-Transcript }", escapedFilePath, fullCommand)

Copilot uses AI. Check for mistakes.
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.

Story 0.2.3: E2E & Cross-Platform Testing

2 participants