Skip to content

Commit c86690a

Browse files
committed
Get base code for dusk tests
1 parent 0b7dbd6 commit c86690a

File tree

8 files changed

+209
-1
lines changed

8 files changed

+209
-1
lines changed

.env.dusk

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
APP_ENV=local
2+
APP_DEBUG=false
3+
APP_KEY=NDWgIKKi9ovNK1PXZpzfNVSBdfCXGb5i
4+
APP_JWT_KEY=test1234
5+
APP_TIMEZONE=America/Los_Angeles
6+
APP_URL=http://192.168.1.249
7+
8+
CACHE_DRIVER=file
9+
SESSION_DRIVER=file
10+
11+
HASHIDS_SALT=IqRr0g82tCTeuyxGs8RV
12+
HASHIDS_LENGTH=8
13+
14+
MAIL_DRIVER=log
15+
MAIL_FROM=support@pterodactyl.io
16+
QUEUE_DRIVER=array
17+
18+
APP_SERVICE_AUTHOR=testing@pterodactyl.io
19+
MAIL_FROM_NAME="Pterodactyl Panel"
20+
RECAPTCHA_ENABLED=false
21+
22+
DB_HOST=services.pterodactyl.local
23+
DB_DATABASE=panel_test
24+
DB_USERNAME=panel_test
25+
DB_PASSWORD=Test1234

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"filp/whoops": "^2.1",
4848
"friendsofphp/php-cs-fixer": "^2.11.1",
4949
"fzaninotto/faker": "^1.6",
50+
"laravel/dusk": "^3.0",
5051
"martinlindhe/laravel-vue-i18n-generator": "^0.1.28",
5152
"mockery/mockery": "^1.0",
5253
"nunomaduro/collision": "^2.0",
@@ -67,6 +68,7 @@
6768
},
6869
"autoload-dev": {
6970
"psr-4": {
71+
"Pterodactyl\\Tests\\Browser\\": "tests/Browser",
7072
"Pterodactyl\\Tests\\Integration\\": "tests/Integration",
7173
"Tests\\": "tests/"
7274
}

composer.lock

Lines changed: 122 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpunit.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
processIsolation="false"
1111
stopOnFailure="false">
1212
<testsuites>
13+
<testsuite name="Browser">
14+
<directory suffix="Test.php">./tests/Browser/Processes</directory>
15+
</testsuite>
1316
<testsuite name="Integration">
1417
<directory suffix="Test.php">./tests/Integration</directory>
1518
</testsuite>

tests/Browser/BrowserTestCase.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace Pterodactyl\Tests\Browser;
4+
5+
use Laravel\Dusk\TestCase;
6+
use Tests\CreatesApplication;
7+
use Facebook\WebDriver\Chrome\ChromeOptions;
8+
use Facebook\WebDriver\Remote\RemoteWebDriver;
9+
use Facebook\WebDriver\Remote\DesiredCapabilities;
10+
use Illuminate\Foundation\Testing\DatabaseMigrations;
11+
12+
abstract class BrowserTestCase extends TestCase
13+
{
14+
use CreatesApplication, DatabaseMigrations;
15+
16+
/**
17+
* Create the RemoteWebDriver instance.
18+
*
19+
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
20+
*/
21+
protected function driver()
22+
{
23+
$options = (new ChromeOptions)->addArguments([
24+
'--disable-gpu',
25+
]);
26+
27+
return RemoteWebDriver::create(
28+
'http://services.pterodactyl.local:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
29+
ChromeOptions::CAPABILITY, $options
30+
)
31+
);
32+
}
33+
34+
/**
35+
* Return an instance of the browser to be used for tests.
36+
*
37+
* @param \Facebook\WebDriver\Remote\RemoteWebDriver $driver
38+
* @return \Pterodactyl\Tests\Browser\PterodactylBrowser
39+
*/
40+
protected function newBrowser($driver): PterodactylBrowser
41+
{
42+
return new PterodactylBrowser($driver);
43+
}
44+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Pterodactyl\Tests\Browser;
4+
5+
use Laravel\Dusk\Browser;
6+
7+
class PterodactylBrowser extends Browser
8+
{
9+
}

tests/Browser/console/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)