PHPackages                             yaroslawww/laravel-dusk-reporter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. yaroslawww/laravel-dusk-reporter

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

yaroslawww/laravel-dusk-reporter
================================

Report generator for Laravel Dusk.

3.1.1(4y ago)29.1k↓50%MITPHPPHP &gt;=8.0

Since May 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/yaroslawww/laravel-dusk-reporter)[ Packagist](https://packagist.org/packages/yaroslawww/laravel-dusk-reporter)[ Docs](https://github.com/yaroslawww/laravel-dusk-reporter)[ RSS](/packages/yaroslawww-laravel-dusk-reporter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (11)Used By (0)

Report generator for Laravel Dusk
=================================

[](#report-generator-for-laravel-dusk)

[![Packagist License](https://camo.githubusercontent.com/d23d4ae1daa7d8afbfb3686fb1f4074846b7d5f352ca941da6006392f62ffbda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7961726f736c617777772f6c61726176656c2d6475736b2d7265706f727465723f636f6c6f723d253233346463373166)](https://github.com/yaroslawww/laravel-dusk-reporter/blob/master/LICENSE.md)[![Packagist Version](https://camo.githubusercontent.com/e3bd57acd3b4cc8ce750c70ec1e4b0f4b5d95e81f736776df18a6b5ffcd3a062/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7961726f736c617777772f6c61726176656c2d6475736b2d7265706f72746572)](https://packagist.org/packages/yaroslawww/laravel-dusk-reporter)[![Total Downloads](https://camo.githubusercontent.com/4cc370cd4fb5e7f4dc2a74c0ca4fbed55f32b3f68b8cd2a58aa859186ff3dbea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7961726f736c617777772f6c61726176656c2d6475736b2d7265706f72746572)](https://packagist.org/packages/yaroslawww/laravel-dusk-reporter)[![Build Status](https://camo.githubusercontent.com/4c56fa35d6f563732e0f3cf7de3480b3c6972d3cb49ec52cc8cd4fec5e73fb99/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7961726f736c617777772f6c61726176656c2d6475736b2d7265706f727465722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yaroslawww/laravel-dusk-reporter/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/e0efef3fec4e40e324a95c2a26c6293dfe214a92281bedeee735c0e090a59dff/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7961726f736c617777772f6c61726176656c2d6475736b2d7265706f727465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yaroslawww/laravel-dusk-reporter/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/94beadf1eeea24228b6affe32844bd118140b2421270190dec79bf3f3e909b48/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7961726f736c617777772f6c61726176656c2d6475736b2d7265706f727465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yaroslawww/laravel-dusk-reporter/?branch=master)

Report will be saved in `.md` files.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require --dev yaroslawww/laravel-dusk-reporter
```

Usage
-----

[](#usage)

#### Purge old data

[](#purge-old-data)

When testing, the package adds content files, so you need to clear the directories before starting tests again

```
php artisan dusk-reporter:purge
# or
php artisan dusk-reporter:purge -y
# or
php artisan dusk-reporter:purge --path="/my/project/report"
```

#### 1. Use trait `TestWithDuskReport` in your dusk test case. This is optional, but it will be easy to rename the file.

[](#1-use-trait-testwithduskreport-in-your-dusk-test-case-this-is-optional-but-it-will-be-easy-to-rename-the-file)

```
//...
use LaravelDuskReporter\TestWithDuskReport;

abstract class DuskTestCase extends BaseTestCase
{
    use TestWithDuskReport;

    //...

}

```

#### 2. You can override default configuration

[](#2-you-can-override-default-configuration)

Change store report folder, by default package use "base\_path('storage/laravel-dusk-reporter')"

```
Reporter::$storeBuildAt = app_path('reports/dusk-report');

```

or

```
DUSK_REPORT_PATH=reports/browser-tests  php artisan dusk  --stop-on-failure
```

Change store screenshots folder, by default package use field "$storeBuildAt"

```
Reporter::$storeScreenshotAt = app_path('reports/dusk-screenshots');

```

By default package save link in `.md` files as relative path, you can change it

```
Reporter::$screenshotRelativePath = false;

```

Change element to fit content (by default package use "body" tag)

```
Reporter::$getBodyElementCallback = function ($browser) {
    return $browser->driver->findElement(WebDriverBy::id('someId'));
};

```

#### 3. Create report

[](#3-create-report)

```
namespace Tests\Browser\CPD\Marketing;

//...

class HomePageTest extends DuskTestCase {
    /** @test */
    public function open_by_not_logged_user() {
        $REPORT = $this->newDuskReportFile()
                       ->h1( 'Home marketing page' )
                       ->h2( 'Initial data' )
                       ->p( "Open page by not logged user" );

        $this->browse( function ( Browser $browser ) use ( $REPORT ) {
            $browser->visit( new HomePage() )
                    // ...
                    ->assertPresent( '@header' )
                    ->assertPresent( '@footer' );

            $REPORT->screenshot( $browser, ReportScreenshot::RESIZE_COMBINE )
                // or
                ->screenshotWithVisibleScreen( $browser )
                // or
                ->screenshotWithFitScreen( $browser )
                // or
                ->screenshotWithCombineScreen( $browser )
                // or
                ->screenshotWithCombineScreen( $browser,  $suffix = 'additional_screen', $newLine = false);
        } );

        $REPORT->h3('Conclusion')->p('Test passed.');
    }
}

```

#### 4. Create report for one test file

[](#4-create-report-for-one-test-file)

By default, the package is designed to create one report for one test (since the phpunit re-creates the structure for each test). But you can create one file for multiple tests using method `duskReportFile`

```
abstract class Page extends BasePage
{
    use HasDuskReporter;

}

```

```
namespace Tests\Browser;

use Database\Seeders\DatabaseDuskCPDSeeder;
use Facebook\WebDriver\Exception\WebDriverException;
use Facebook\WebDriver\WebDriverBy;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use LaravelDuskReporter\Reporter;
use Tests\Browser\Pages\Page;
use Tests\DuskTestCase;

class ReportableDuskTestCase extends DuskTestCase
{
    use DatabaseMigrations;

    protected function setUp(): void
    {
        parent::setUp();

        Page::withDuskReporter( $this->setUpReportFileForClass() );
    }
}

```

```
namespace Tests\Browser\Marketing;

class HomePageTest extends ReportableDuskTestCase {

    $duskReportClassFilePath = 'Marketing';

    /**  @test */
    public function open_by_not_logged_user() {
        $this->browse( function ( Browser $browser ) {
            $browser->visit( new HomePage() )
                    ->assertPresent( '@header' )
                    ->assertPresent( '@footer' )
                    ->reportUserSeePage()
                    ->reportAppend( function ( $reporter ) {
                        $reporter->p( 'My additional note.' );
                    } );
        } );
    }

    public function testPageHasVideo() {
        $this->browse( function ( Browser $browser ) {
            $browser->visit( new HomePage() )
                    ->assertPresent( '@marketing-video' );

            // $browser->reportUserSeePage();
            $this->duskReportFile()->h2( "Open page with video" )
                         ->screenshotWithFitScreen( $browser )
                         ->p('Some note');
        } );
    }

}

```

#### 5. Disable reporting

[](#5-disable-reporting)

Sometimes you need to cancel the creation of a report (for example, you want to make a quick test without generating a report). Then just add a global variable `DUSK_REPORT_DISABLED=1` or add it to `.env.dusk.local` file. Also package supports disabling only screenshots `DUSK_SCREENSHOTS_DISABLED=1`

```
DUSK_REPORT_DISABLED=1 php artisan dusk tests/Browser/CPD/Marketing/HomePageTest.php --stop-on-failure
DUSK_SCREENSHOTS_DISABLED=1 php artisan dusk tests/Browser/CPD/Marketing/HomePageTest.php --stop-on-failure
```

Frontend generation
-------------------

[](#frontend-generation)

In some cases, you will need to show the report in HTML format. Usually it is convenient to use md-&gt;html compilers for this. For example, you can use [vuepress](https://vuepress.vuejs.org/)

```
# Add vuepress if not exists
yarn add -D vuepress
```

Then add command to your package.json

```
# package.json
{
    ...
    "scripts": {
        ...
        "testsPreview:build": "cp -r vendor/yaroslawww/laravel-dusk-reporter/assets/.vuepress storage/laravel-dusk-reporter/ && VUEPRESS_BASE='/laravel-dusk-reporter-html/' VUEPRESS_DEST='public/laravel-dusk-reporter-html' vuepress build storage/laravel-dusk-reporter",
        ...
    },
    "devDependencies": {
        ...
        "vuepress": "^1.5.4",
        ...
    },
    ...
}

```

Then just run

```
yarn testsPreview:build
```

Credits
-------

[](#credits)

- [![Think Studio](https://camo.githubusercontent.com/8e541bece07d503c85a126b5294865faa00e27371048772f566a0cce8c01fd3a/68747470733a2f2f7961726f736c617777772e6769746875622e696f2f696d616765732f73706f6e736f72732f7061636b616765732f6c6f676f2d7468696e6b2d73747564696f2e706e67)](https://think.studio/)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~3 days

Total

10

Last Release

1632d ago

Major Versions

1.1.0 → 2.0.02021-09-16

2.2.0 → 3.0.02021-11-14

PHP version history (2 changes)1.1.0PHP &gt;7.4

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23663794?v=4)[yaroslawww](/maintainers/yaroslawww)[@yaroslawww](https://github.com/yaroslawww)

---

Top Contributors

[![yaroslawww](https://avatars.githubusercontent.com/u/23663794?v=4)](https://github.com/yaroslawww "yaroslawww (37 commits)")

---

Tags

reportlaravel-dusk-reporter

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yaroslawww-laravel-dusk-reporter/health.svg)

```
[![Health](https://phpackages.com/badges/yaroslawww-laravel-dusk-reporter/health.svg)](https://phpackages.com/packages/yaroslawww-laravel-dusk-reporter)
```

###  Alternatives

[jimmyjs/laravel-report-generator

Rapidly Generate Simple Pdf &amp; Excel Report on Laravel 5 (Using Barryvdh/DomPdf or Barryvdh/laravel-snappy &amp; maatwebsite/excel)

580157.4k1](/packages/jimmyjs-laravel-report-generator)[drutiny/drutiny

This is a generic Drupal 7 and Drupal 8 site auditing and optional remediation tool.

132122.2k17](/packages/drutiny-drutiny)[scheb/tombstone-analyzer

Generates reports based on the logs from scheb/tombstone-logger

28378.1k2](/packages/scheb-tombstone-analyzer)[quilhasoft/jasperphp

Pure PHP library to read JRXML files made with 'JasperSoft Studio' and generate reports in PDF

7542.4k1](/packages/quilhasoft-jasperphp)[aspose-cloud/aspose-words-cloud

Open, generate, edit, split, merge, compare and convert Word documents. Integrate Cloud API into your solutions to manipulate documents. Convert PDF to Word (DOC, DOCX, ODT, RTF and HTML) and in the opposite direction.

32157.4k](/packages/aspose-cloud-aspose-words-cloud)[silverstripe/securityreport

Generates a security and access report for CMS users

10292.1k4](/packages/silverstripe-securityreport)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
