|
| 1 | +# Template Name: failed-detailed |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +The **failed-detailed** report focuses exclusively on failed test cases, providing a clear and detailed summary of each failure. For every failed test, the report includes the test name, the failure message, stack trace, code snippet, standard output, and standard error if available. This report is designed to help developers quickly diagnose and address issues providing the exact place where the failure occured. If there are no failing tests, the template will render **No failed tests 🎉** instead of the failed tests table. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## How to Use |
| 10 | + |
| 11 | +Reference this template by its name in your workflow configuration: |
| 12 | + |
| 13 | +``` |
| 14 | +failed-detailed |
| 15 | +``` |
| 16 | + |
| 17 | +Then, add it to your workflow file as follows: |
| 18 | + |
| 19 | +```yaml |
| 20 | +- name: Publish Test Report |
| 21 | + uses: ctrf-io/github-test-reporter@v1 |
| 22 | + with: |
| 23 | + report-path: './ctrf/*.json' |
| 24 | + community-report: true |
| 25 | + community-report-name: failed-detailed |
| 26 | + if: always() |
| 27 | +``` |
| 28 | +
|
| 29 | +Ensure your report JSON files are generated correctly and placed in the expected path. |
| 30 | +
|
| 31 | +> [!NOTE] |
| 32 | +> You can combine this report with the built-in reports by adding the `community-report` and `community-report-name` nodes to your existing workflow file. |
| 33 | + |
| 34 | +## Important Considerations |
| 35 | + |
| 36 | +- **JSON Structure:** Verify that your test results JSON conforms to the expected format, so that the template can correctly parse the summary values and test statuses. |
| 37 | +- **Custom Helpers:** This template utilizes custom helpers such as `getCtrfEmoji` and `formatTestMessagePreCode`. Make sure these are available in your environment. |
| 38 | +- **Conditional Rendering:** The detailed table of failed tests will only appear if there is at least one test with a `failed` status. |
| 39 | + |
| 40 | +## What it Looks Like |
| 41 | + |
| 42 | + |
| 43 | +<table> |
| 44 | + <thead> |
| 45 | + <tr> |
| 46 | + <th>Failed Tests ❌</th> |
| 47 | + <th>Fail Message</th> |
| 48 | + </tr> |
| 49 | + </thead> |
| 50 | + <tbody> |
| 51 | + <tr> |
| 52 | + <td>should display title</td> |
| 53 | + <td> |
| 54 | + <details> |
| 55 | + <summary>Error: expect(page).toHaveTitle(expected) failed</summary> |
| 56 | + <p><strong>Trace:</strong></p> |
| 57 | + <pre><code>Error: expect(page).toHaveTitle(expected) failed<br>Expect "toHaveTitle" with timeout 5000ms |
| 58 | + 9 × unexpected value "Fast and reliable end-to-end testing for modern web apps | Playwright"<br> at .\Projects\Playwright\tests\example.spec.ts:7:22</code></pre> |
| 59 | + <p><strong>Snippet:</strong></p> |
| 60 | + <pre><code> 5 | |
| 61 | + 6 | // Expect a title "to contain" a substring. |
| 62 | +> 7 | await expect(page).toHaveTitle(/Playwright/); |
| 63 | + | ^ |
| 64 | + 8 | }); |
| 65 | + 9 | |
| 66 | + 10 | test('should display title', async ({ page }) => {</code></pre> |
| 67 | + <p><strong>Standard Output:</strong></p> |
| 68 | + <pre><code>Navigated URL: https://playwright.dev/</code></pre> |
| 69 | + <p><strong>Standard Error:</strong></p> |
| 70 | + <pre><code>No standard error available</code></pre> |
| 71 | + </details> |
| 72 | + </td> |
| 73 | + </tr> |
| 74 | + </tbody> |
| 75 | +</table> |
| 76 | + |
| 77 | +### OR |
| 78 | + |
| 79 | +### No failed tests 🎉 |
0 commit comments