Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F223418
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/tests/TestCaseDusk.php b/src/tests/TestCaseDusk.php
index 59c4db54..e9f904df 100644
--- a/src/tests/TestCaseDusk.php
+++ b/src/tests/TestCaseDusk.php
@@ -1,117 +1,121 @@
<?php
namespace Tests;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Laravel\Dusk\TestCase as BaseTestCase;
abstract class TestCaseDusk extends BaseTestCase
{
use TestCaseTrait;
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare()
{
- static::startChromeDriver();
+ static::startChromeDriver([
+ // For troubleshooting
+ // '--verbose',
+ // '--log-path=/tmp/chromedriver.log',
+ ]);
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
$options = (new ChromeOptions())->addArguments([
'--lang=en_US',
'--disable-gpu',
'--headless',
'--no-sandbox',
'--disable-dev-shm-usage',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
'--enable-usermedia-screen-capturing',
// '--auto-select-desktop-capture-source="Entire screen"',
'--ignore-certificate-errors',
'--incognito',
]);
// For file download handling
$prefs = [
'profile.default_content_settings.popups' => 0,
'download.default_directory' => __DIR__ . '/Browser/downloads',
];
$options->setExperimentalOption('prefs', $prefs);
if (getenv('TESTS_MODE') == 'phone') {
// Fake User-Agent string for mobile mode
$ua = 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36'
. ' (KHTML, like Gecko) Chrome/60.0.3112.90 Mobile Safari/537.36';
$options->setExperimentalOption('mobileEmulation', ['userAgent' => $ua]);
$options->addArguments(['--window-size=375,667']);
} elseif (getenv('TESTS_MODE') == 'tablet') {
// Fake User-Agent string for mobile mode
$ua = 'Mozilla/5.0 (Linux; Android 6.0.1; vivo 1603 Build/MMB29M) AppleWebKit/537.36 '
. ' (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36';
$options->setExperimentalOption('mobileEmulation', ['userAgent' => $ua]);
$options->addArguments(['--window-size=800,640']);
} else {
$options->addArguments(['--window-size=1280,1024']);
}
// Make sure downloads dir exists and is empty
if (!file_exists(__DIR__ . '/Browser/downloads')) {
mkdir(__DIR__ . '/Browser/downloads', 0777, true);
} else {
foreach (glob(__DIR__ . '/Browser/downloads/*') as $file) {
@unlink($file);
}
}
return RemoteWebDriver::create(
'http://localhost:9515',
DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY,
$options
)
);
}
/**
* Replace Dusk's Browser with our (extended) Browser
*/
protected function newBrowser($driver)
{
return new Browser($driver);
}
/**
* Set baseURL to the admin UI location
*/
protected static function useAdminUrl(): void
{
// This will set baseURL for all tests in this file
// If we wanted to visit both user and admin in one test
// we can also just call visit() with full url
Browser::$baseUrl = str_replace('//', '//admin.', \config('app.url'));
}
/**
* Set baseURL to the reseller UI location
*/
protected static function useResellerUrl(): void
{
// This will set baseURL for all tests in this file
// If we wanted to visit both user and admin in one test
// we can also just call visit() with full url
Browser::$baseUrl = str_replace('//', '//reseller.', \config('app.url'));
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Mar 1, 3:37 AM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
161598
Default Alt Text
(4 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment