Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

feat: add detailed test report with timing, PR comments

Bosch1062f46f7842
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 8482651e..c867ed7f 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -2,6 +2,7 @@ name: E2E Tests
permissions:
contents: read
+ pull-requests: write
on:
workflow_dispatch:
@@ -25,7 +26,9 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Run E2E tests
+ id: e2e
run: |
+ mkdir -p tests/e2e/results
docker compose -f tests/e2e/docker-compose.yml up \
--build \
--abort-on-container-exit \
@@ -34,6 +37,12 @@ jobs:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
+ - name: Copy results from container
+ if: always()
+ run: |
+ docker cp $(docker ps -aq -f name=e2e-runner):/results/. tests/e2e/results/ 2>/dev/null || true
+ ls -la tests/e2e/results/ || true
+
- name: Upload results
if: always()
uses: actions/upload-artifact@v4
@@ -42,6 +51,48 @@ jobs:
path: tests/e2e/results/
retention-days: 7
+ - name: Post PR comment
+ if: always() && github.event_name == 'pull_request'
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const fs = require('fs');
+ const reportPath = 'tests/e2e/results/report.md';
+
+ let body = '## πŸ¦€ E2E Test Results\n\n';
+ if (fs.existsSync(reportPath)) {
+ body = fs.readFileSync(reportPath, 'utf8');
+ } else {
+ body += '⚠️ No test report generated. Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).';
+ }
+
+ // Find existing comment
+ const { data: comments } = await github.rest.issues.listComments({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number
+ });
+
+ const botComment = comments.find(c =>
+ c.user.type === 'Bot' && c.body.includes('E2E Test')
+ );
+
+ if (botComment) {
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: botComment.id,
+ body
+ });
+ } else {
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ body
+ });
+ }
+
- name: Show logs on failure
if: failure()
run: |
diff --git a/tests/e2e/scenarios/common.sh b/tests/e2e/scenarios/common.sh
index f2fe8a1f..7c1e9123 100755
--- a/tests/e2e/scenarios/common.sh
+++ b/tests/e2e/scenarios/common.sh
@@ -23,19 +23,29 @@ TESTS_FAILED=0
ASSERTIONS_PASSED=0
ASSERTIONS_FAILED=0
+# Test timing
+TEST_START_TIME=0
+TEST_RESULTS=()
+
# Start a test
start_test() {
CURRENT_TEST="$1"
+ TEST_START_TIME=$(date +%s%3N)
echo -e "${BLUE}β–Ά ${CURRENT_TEST}${NC}"
}
# End a test
end_test() {
+ local end_time=$(date +%s%3N)
+ local duration=$((end_time - TEST_START_TIME))
+
if [ "$ASSERTIONS_FAILED" -eq 0 ]; then
- echo -e "${GREEN}βœ“ ${CURRENT_TEST} passed${NC}\n"
+ echo -e "${GREEN}βœ“ ${CURRENT_TEST} passed${NC} ${MUTED}(${duration}ms)${NC}\n"
+ TEST_RESULTS+=("βœ… ${CURRENT_TEST}|${duration}ms|passed")
((TESTS_PASSED++)) || true
else
- echo -e "${RED}βœ— ${CURRENT_TEST} failed${NC}\n"
+ echo -e "${RED}βœ— ${CURRENT_TEST} failed${NC} ${MUTED}(${duration}ms)${NC}\n"
+ TEST_RESULTS+=("❌ ${CURRENT_TEST}|${duration}ms|failed")
((TESTS_FAILED++)) || true
fi
ASSERTIONS_PASSED=0
@@ -166,14 +176,80 @@ pt_post() {
# Print summary
print_summary() {
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+ local total=$((TESTS_PASSED + TESTS_FAILED))
+ local total_time=0
+
+ echo ""
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "${BLUE}E2E Test Summary${NC}"
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
- echo -e "Passed: ${GREEN}${TESTS_PASSED}${NC}"
- echo -e "Failed: ${RED}${TESTS_FAILED}${NC}"
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+ echo ""
+ printf " %-40s %10s %10s\n" "Test" "Duration" "Status"
+ echo " ────────────────────────────────────────────────────────"
+
+ for result in "${TEST_RESULTS[@]}"; do
+ IFS='|' read -r name duration status <<< "$result"
+ local time_num=${duration%ms}
+ ((total_time += time_num)) || true
+ if [ "$status" = "passed" ]; then
+ printf " %-40s %10s ${GREEN}%10s${NC}\n" "$name" "$duration" "βœ“"
+ else
+ printf " %-40s %10s ${RED}%10s${NC}\n" "$name" "$duration" "βœ—"
+ fi
+ done
+
+ echo " ────────────────────────────────────────────────────────"
+ printf " %-40s %10s\n" "Total" "${total_time}ms"
+ echo ""
+ echo -e " ${GREEN}Passed:${NC} ${TESTS_PASSED}/${total}"
+ echo -e " ${RED}Failed:${NC} ${TESTS_FAILED}/${total}"
+ echo ""
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+
+ # Generate markdown report for CI
+ if [ -d "${RESULTS_DIR:-}" ]; then
+ generate_markdown_report > "${RESULTS_DIR}/report.md"
+ echo "passed=$TESTS_PASSED" > "${RESULTS_DIR}/summary.txt"
+ echo "failed=$TESTS_FAILED" >> "${RESULTS_DIR}/summary.txt"
+ echo "total_time=${total_time}ms" >> "${RESULTS_DIR}/summary.txt"
+ echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "${RESULTS_DIR}/summary.txt"
+ fi
if [ "$TESTS_FAILED" -gt 0 ]; then
exit 1
fi
}
+
+# Generate markdown report
+generate_markdown_report() {
+ local total=$((TESTS_PASSED + TESTS_FAILED))
+ local total_time=0
+
+ echo "## πŸ¦€ PinchTab E2E Test Report"
+ echo ""
+ if [ "$TESTS_FAILED" -eq 0 ]; then
+ echo "**Status:** βœ… All tests passed"
+ else
+ echo "**Status:** ❌ ${TESTS_FAILED} test(s) failed"
+ fi
+ echo ""
+ echo "| Test | Duration | Status |"
+ echo "|------|----------|--------|"
+
+ for result in "${TEST_RESULTS[@]}"; do
+ IFS='|' read -r name duration status <<< "$result"
+ local time_num=${duration%ms}
+ ((total_time += time_num)) || true
+ local icon="βœ…"
+ [ "$status" = "failed" ] && icon="❌"
+ # Remove emoji from name for cleaner table
+ local clean_name="${name#βœ… }"
+ clean_name="${clean_name#❌ }"
+ echo "| ${clean_name} | ${duration} | ${icon} |"
+ done
+
+ echo ""
+ echo "**Summary:** ${TESTS_PASSED}/${total} passed in ${total_time}ms"
+ echo ""
+ echo "<sub>Generated at $(date -u +%Y-%m-%dT%H:%M:%SZ)</sub>"
+}