1.0.18 • Published 7 months ago

playwright-cucumber-ctrf-generator v1.0.18

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Playwright Cucumber JSON CTRF Generator (Beta)

Playwright CTRF Logo

Playwright Cucumber JSON CTRF Generator is a command-line tool that converts Cucumber JSON reports into a clean, readable Markdown test report. It is particularly useful for projects using Playwright, Cucumber, or similar testing frameworks to generate structured test summaries.


📢 Beta Notice

This package is currently in Beta stage. While it is functional, there may be minor issues or improvements required.


Features 🚀

  • 📊 Summary at the Top: View total scenarios, passed, failed, and skipped counts immediately.
  • Readable Reports: Generates human-friendly Markdown reports from Cucumber JSON output.
  • 🛠️ Easy Integration: Works seamlessly with Playwright and Cucumber frameworks.

How to use?

  1. Install the package:

    npm install playwright-cucumber-ctrf-generator
  2. Add the script in your package.json:

    "scripts": {
        "generate:ctrf": "cucumber-ctrf-generator ./test-result/cucumber-report/cucumber-report.json ctrf-report.md"
    }

    Make sure your cucumber-report.json file is specified correctly.

  3. Integrate in GitHub Workflow: Below is an example of a GitHub Actions workflow file for Playwright tests:

    name: Playwright Tests
    on:
      workflow_dispatch:
    
    jobs:
      test:
        timeout-minutes: 60
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: lts/*
          - name: Install dependencies
            run: npm ci
    
          - name: Install Playwright Browsers
            run: npx playwright install --with-deps
    
          - name: Start Test Execution Timer
            id: start_time
            run: echo "start_time=$(date +%s)" >> $GITHUB_ENV
    
          - name: Run Playwright Cucumber tests
            run: |
              npm run execute:tests
              if grep -q '"status": "failed"' test-result/cucumber-report/cucumber-report.json; then
                echo "Cucumber scenarios failed."
                exit 1
              fi
    
          - name: Calculate Total Test Duration
            if: ${{ always() }}
            id: end_time
            run: |
              end_time=$(date +%s)
              duration=$((end_time - $start_time))
              echo "total_duration=${duration}" >> $GITHUB_ENV
              echo "Total Test Duration: $((duration / 60))m $((duration % 60))s"
    
          - name: Upload Playwright Cucumber Report
            if: ${{ always() }}
            uses: actions/upload-artifact@v4
            with:
              name: Cucumber Reports
              path: test-result/cucumber-report
              retention-days: 30
    
          - name: Generate CTRF Report
            if: ${{ always() }}
            run: |
              npm run generate:ctrf
    
          - name: Add CTRF Report to GitHub Actions Summary
            if: ${{ always() }}
            run: |
              echo "## ⏰ Total Execution Duration : $((total_duration / 60))m $((total_duration % 60))s" >> $GITHUB_STEP_SUMMARY
              cat ./ctrf-report.md >> $GITHUB_STEP_SUMMARY

Sample Report in GitHub Actions

Here is a sample screenshot of the generated report:


Now you can effortlessly generate clean and readable reports for your Playwright Cucumber projects! 🎉

1.0.18

7 months ago

1.0.16

7 months ago

1.0.15

7 months ago

1.0.14

7 months ago

1.0.13

7 months ago