Skip to content

Commit

Permalink
Merge pull request #725 from crynobone/caller-2
Browse files Browse the repository at this point in the history
[5.x] Add ProvidesBrowser::getCallerName();
  • Loading branch information
taylorotwell authored Jan 27, 2020
2 parents effe73d + 2dca2ab commit 6f59695
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 6f59695

Please sign in to comment.