Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
71
vendor/laravel/dusk/src/Browser.php
vendored
71
vendor/laravel/dusk/src/Browser.php
vendored
@@ -7,6 +7,7 @@ use BadMethodCallException;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Facebook\WebDriver\WebDriverDimension;
|
||||
use Facebook\WebDriver\Remote\WebDriverBrowserType;
|
||||
|
||||
class Browser
|
||||
{
|
||||
@@ -42,6 +43,16 @@ class Browser
|
||||
*/
|
||||
public static $storeConsoleLogAt;
|
||||
|
||||
/**
|
||||
* The browsers that support retrieving logs.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $supportsRemoteLogs = [
|
||||
WebDriverBrowserType::CHROME,
|
||||
WebDriverBrowserType::PHANTOMJS,
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the callback which resolves the default user to authenticate.
|
||||
*
|
||||
@@ -49,6 +60,13 @@ class Browser
|
||||
*/
|
||||
public static $userResolver;
|
||||
|
||||
/**
|
||||
* The default wait time in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public static $waitSeconds = 5;
|
||||
|
||||
/**
|
||||
* The RemoteWebDriver instance.
|
||||
*
|
||||
@@ -70,6 +88,13 @@ class Browser
|
||||
*/
|
||||
public $page;
|
||||
|
||||
/**
|
||||
* The component object currently being viewed.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $component;
|
||||
|
||||
/**
|
||||
* Create a browser instance.
|
||||
*
|
||||
@@ -87,7 +112,7 @@ class Browser
|
||||
/**
|
||||
* Browse to the given URL.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string|Page $url
|
||||
* @return $this
|
||||
*/
|
||||
public function visit($url)
|
||||
@@ -229,13 +254,15 @@ class Browser
|
||||
*/
|
||||
public function storeConsoleLog($name)
|
||||
{
|
||||
$console = $this->driver->manage()->getLog('browser');
|
||||
if (in_array($this->driver->getCapabilities()->getBrowserName(), static::$supportsRemoteLogs)) {
|
||||
$console = $this->driver->manage()->getLog('browser');
|
||||
|
||||
if (! empty($console)) {
|
||||
file_put_contents(
|
||||
sprintf('%s/%s.log', rtrim(static::$storeConsoleLogAt, '/'), $name)
|
||||
, json_encode($console, JSON_PRETTY_PRINT)
|
||||
);
|
||||
if (!empty($console)) {
|
||||
file_put_contents(
|
||||
sprintf('%s/%s.log', rtrim(static::$storeConsoleLogAt, '/'), $name)
|
||||
, json_encode($console, JSON_PRETTY_PRINT)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -270,11 +297,33 @@ class Browser
|
||||
$browser->on($this->page);
|
||||
}
|
||||
|
||||
if ($selector instanceof Component) {
|
||||
$browser->onComponent($selector, $this->resolver);
|
||||
}
|
||||
|
||||
call_user_func($callback, $browser);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function onComponent($component, $parentResolver)
|
||||
{
|
||||
$this->component = $component;
|
||||
|
||||
// Here we will set the component elements on the resolver instance, which will allow
|
||||
// the developer to access short-cuts for CSS selectors on the component which can
|
||||
// allow for more expressive navigation and interaction with all the components.
|
||||
$this->resolver->pageElements(
|
||||
$component->elements() + $parentResolver->elements
|
||||
);
|
||||
|
||||
$component->assert($this);
|
||||
|
||||
$this->resolver->prefix = $this->resolver->format(
|
||||
$component->selector()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that jQuery is available on the page.
|
||||
*
|
||||
@@ -373,6 +422,14 @@ class Browser
|
||||
return $this->macroCall($method, $parameters);
|
||||
}
|
||||
|
||||
if ($this->component && method_exists($this->component, $method)) {
|
||||
array_unshift($parameters, $this);
|
||||
|
||||
$this->component->{$method}(...$parameters);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
if ($this->page && method_exists($this->page, $method)) {
|
||||
array_unshift($parameters, $this);
|
||||
|
||||
|
Reference in New Issue
Block a user