Skip to content

Commit

Permalink
[5.x] Add ProvidesBrowser::getCallerName();
Browse files Browse the repository at this point in the history
This would allow better support when we need to use laravel/dusk outside of PHPUnit\Framework\TestCase.

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Jan 27, 2020
1 parent effe73d commit 2dca2ab
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Concerns/ProvidesBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function captureFailuresFor($browsers)
$browser->fitContent();
}

$name = str_replace('\\', '_', get_class($this)).'_'.$this->getName(false);
$name = $this->getCallerName();

$browser->screenshot('failure-'.$name.'-'.$key);
});
Expand All @@ -156,7 +156,7 @@ protected function captureFailuresFor($browsers)
protected function storeConsoleLogsFor($browsers)
{
$browsers->each(function ($browser, $key) {
$name = str_replace('\\', '_', get_class($this)).'_'.$this->getName(false);
$name = $this->getCallerName();

$browser->storeConsoleLog($name.'-'.$key);
});
Expand Down Expand Up @@ -201,6 +201,16 @@ protected function createWebDriver()
}, 50);
}

/**
* Get the browser caller name.
*
* @return string
*/
protected function getCallerName()
{
return str_replace('\\', '_', get_class($this)).'_'.$this->getName(false);
}

/**
* Create the RemoteWebDriver instance.
*
Expand Down

0 comments on commit 2dca2ab

Please sign in to comment.