HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/helder.komma.pro/app/Komma/QualityAssurance/ExtraDuskTools.php
<?php


namespace App\Komma\QualityAssurance;


use Laravel\Dusk\Browser;

/**
 * Trait ExtraDuskTools
 *
 * Notice. only works with laravel 5.7.
 * Include it in your service provider boot method
 *
 * @package App\Komma\QualityAssurance
 */
trait ExtraDuskTools
{
    public function setupExtraDuskTools()
    {
        //Helpers
        Browser::macro('scrollToElement', function ($element = null) {
            $this->script("$('html, body').animate({ scrollTop: $('$element').offset().top }, 0);");

            return $this;
        });

        //Assertions
        /**
         * Extend the dusk browser with a method that can count elements
         */
        Browser::macro('assertElementsCountIs', function(int $count, string $selector) {
            PHPUnit::assertEquals( $count, count($this->elements( $selector )));
            return $this;
        });
    }
}