Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser.php
Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | class Browser extends \Laravel\Dusk\Browser | ||||
public static function isDesktop() | public static function isDesktop() | ||||
{ | { | ||||
return !self::isPhone() && !self::isTablet(); | return !self::isPhone() && !self::isTablet(); | ||||
} | } | ||||
/** | /** | ||||
* Returns content of a downloaded file | * Returns content of a downloaded file | ||||
*/ | */ | ||||
public function readDownloadedFile($filename) | public function readDownloadedFile($filename, $sleep = 5) | ||||
{ | { | ||||
$filename = __DIR__ . "/Browser/downloads/$filename"; | $filename = __DIR__ . "/Browser/downloads/$filename"; | ||||
// Give the browser a chance to finish download | // Give the browser a chance to finish download | ||||
if (!file_exists($filename)) { | if (!file_exists($filename) && $sleep) { | ||||
sleep(2); | sleep($sleep); | ||||
} | } | ||||
Assert::assertFileExists($filename); | Assert::assertFileExists($filename); | ||||
return file_get_contents($filename); | return file_get_contents($filename); | ||||
} | } | ||||
/** | /** | ||||
Show All 29 Lines |