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:
Manish Verma
2018-08-06 20:08:55 +05:30
parent 126fbb0255
commit 1ac0f42a58
2464 changed files with 65239 additions and 46734 deletions

View File

@@ -8,6 +8,7 @@ use Carbon\Carbon;
use Illuminate\Support\Str;
use Facebook\WebDriver\Exception\TimeOutException;
use Facebook\WebDriver\Exception\NoSuchElementException;
use Facebook\WebDriver\WebDriverExpectedCondition;
trait WaitsForElements
{
@@ -19,7 +20,7 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function whenAvailable($selector, Closure $callback, $seconds = 5)
public function whenAvailable($selector, Closure $callback, $seconds = null)
{
return $this->waitFor($selector, $seconds)->with($selector, $callback);
}
@@ -31,11 +32,11 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function waitFor($selector, $seconds = 5)
public function waitFor($selector, $seconds = null)
{
return $this->waitUsing($seconds, 100, function () use ($selector) {
return $this->resolver->findOrFail($selector)->isDisplayed();
}, "Waited {$seconds} seconds for selector [{$selector}].");
}, "Waited %s seconds for selector [{$selector}].");
}
/**
@@ -45,7 +46,7 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function waitUntilMissing($selector, $seconds = 5)
public function waitUntilMissing($selector, $seconds = null)
{
return $this->waitUsing($seconds, 100, function () use ($selector) {
try {
@@ -55,7 +56,7 @@ trait WaitsForElements
}
return $missing;
}, "Waited {$seconds} seconds for removal of selector [{$selector}].");
}, "Waited %s seconds for removal of selector [{$selector}].");
}
/**
@@ -65,11 +66,11 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function waitForText($text, $seconds = 5)
public function waitForText($text, $seconds = null)
{
return $this->waitUsing($seconds, 100, function () use ($text) {
return Str::contains($this->resolver->findOrFail('')->getText(), $text);
}, "Waited {$seconds} seconds for text [{$text}].");
}, "Waited %s seconds for text [{$text}].");
}
/**
@@ -79,7 +80,7 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function waitForLink($link, $seconds = 5)
public function waitForLink($link, $seconds = null)
{
return $this->waitUsing($seconds, 100, function () use ($link) {
return $this->seeLink($link);
@@ -93,11 +94,24 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function waitForLocation($path, $seconds = 5)
public function waitForLocation($path, $seconds = null)
{
return $this->waitUntil("window.location.pathname == '{$path}'", $seconds);
}
/**
* Wait for the given location using a named route.
*
* @param string $route
* @param array $parameters
* @param int $seconds
* @return $this
*/
public function waitForRoute($route, $parameters = [], $seconds = null)
{
return $this->waitForLocation(route($route, $parameters), $seconds);
}
/**
* Wait until the given script returns true.
*
@@ -105,7 +119,7 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function waitUntil($script, $seconds = 5)
public function waitUntil($script, $seconds = null)
{
if (! Str::startsWith($script, 'return ')) {
$script = 'return '.$script;
@@ -120,6 +134,23 @@ trait WaitsForElements
});
}
/**
* Wait for a JavaScript dialog to open.
*
* @param int $seconds
* @return $this
*/
public function waitForDialog($seconds = null)
{
$seconds = is_null($seconds) ? static::$waitSeconds : $seconds;
$this->driver->wait($seconds, 100)->until(
WebDriverExpectedCondition::alertIsPresent(), "Waited {$seconds} seconds for dialog."
);
return $this;
}
/**
* Wait for the current page to reload.
*
@@ -127,7 +158,7 @@ trait WaitsForElements
* @param int $seconds
* @return $this
*/
public function waitForReload($callback = null, $seconds = 5)
public function waitForReload($callback = null, $seconds = null)
{
$token = str_random();
@@ -139,7 +170,7 @@ trait WaitsForElements
return $this->waitUsing($seconds, 100, function () use ($token) {
return $this->driver->executeScript("return typeof window['{$token}'] === 'undefined';");
});
}, 'Waited %s seconds for page reload.');
}
/**
@@ -154,6 +185,8 @@ trait WaitsForElements
*/
public function waitUsing($seconds, $interval, Closure $callback, $message = null)
{
$seconds = is_null($seconds) ? static::$waitSeconds : $seconds;
$this->pause($interval);
$started = Carbon::now();
@@ -168,7 +201,10 @@ trait WaitsForElements
}
if ($started->lt(Carbon::now()->subSeconds($seconds))) {
throw new TimeOutException($message ?: "Waited {$seconds} seconds for callback.");
throw new TimeOutException($message
? sprintf($message, $seconds)
: "Waited {$seconds} seconds for callback."
);
}
$this->pause($interval);