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.ymlindex 8482651e..c867ed7f 100644--- a/.github/workflows/e2e.yml+++ b/.github/workflows/e2e.yml@@ -2,6 +2,7 @@ name: E2E Testspermissions:contents: read+ pull-requests: writeon:workflow_dispatch:@@ -25,7 +26,9 @@ jobs:uses: docker/setup-buildx-action@v3- name: Run E2E tests+ id: e2erun: |+ mkdir -p tests/e2e/resultsdocker compose -f tests/e2e/docker-compose.yml up \--build \--abort-on-container-exit \@@ -34,6 +37,12 @@ jobs:DOCKER_BUILDKIT: 1COMPOSE_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 resultsif: 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 failureif: failure()run: |diff --git a/tests/e2e/scenarios/common.sh b/tests/e2e/scenarios/common.shindex f2fe8a1f..7c1e9123 100755--- a/tests/e2e/scenarios/common.sh+++ b/tests/e2e/scenarios/common.sh@@ -23,19 +23,29 @@ TESTS_FAILED=0ASSERTIONS_PASSED=0ASSERTIONS_FAILED=0+# Test timing+TEST_START_TIME=0+TEST_RESULTS=()+# Start a teststart_test() {CURRENT_TEST="$1"+ TEST_START_TIME=$(date +%s%3N)echo -e "${BLUE}βΆ ${CURRENT_TEST}${NC}"}# End a testend_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++)) || trueelse- 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++)) || truefiASSERTIONS_PASSED=0@@ -166,14 +176,80 @@ pt_post() {# Print summaryprint_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"+ fiif [ "$TESTS_FAILED" -gt 0 ]; thenexit 1fi}++# 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>"+}