Get base code for dusk tests

This commit is contained in:
Dane Everitt 2018-05-31 21:45:49 -07:00
parent 0b7dbd65ff
commit c86690a695
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 209 additions and 1 deletions

25
.env.dusk Normal file
View file

@ -0,0 +1,25 @@
APP_ENV=local
APP_DEBUG=false
APP_KEY=NDWgIKKi9ovNK1PXZpzfNVSBdfCXGb5i
APP_JWT_KEY=test1234
APP_TIMEZONE=America/Los_Angeles
APP_URL=http://192.168.1.249
CACHE_DRIVER=file
SESSION_DRIVER=file
HASHIDS_SALT=IqRr0g82tCTeuyxGs8RV
HASHIDS_LENGTH=8
MAIL_DRIVER=log
MAIL_FROM=support@pterodactyl.io
QUEUE_DRIVER=array
APP_SERVICE_AUTHOR=testing@pterodactyl.io
MAIL_FROM_NAME="Pterodactyl Panel"
RECAPTCHA_ENABLED=false
DB_HOST=services.pterodactyl.local
DB_DATABASE=panel_test
DB_USERNAME=panel_test
DB_PASSWORD=Test1234

View file

@ -47,6 +47,7 @@
"filp/whoops": "^2.1", "filp/whoops": "^2.1",
"friendsofphp/php-cs-fixer": "^2.11.1", "friendsofphp/php-cs-fixer": "^2.11.1",
"fzaninotto/faker": "^1.6", "fzaninotto/faker": "^1.6",
"laravel/dusk": "^3.0",
"martinlindhe/laravel-vue-i18n-generator": "^0.1.28", "martinlindhe/laravel-vue-i18n-generator": "^0.1.28",
"mockery/mockery": "^1.0", "mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0", "nunomaduro/collision": "^2.0",
@ -67,6 +68,7 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Pterodactyl\\Tests\\Browser\\": "tests/Browser",
"Pterodactyl\\Tests\\Integration\\": "tests/Integration", "Pterodactyl\\Tests\\Integration\\": "tests/Integration",
"Tests\\": "tests/" "Tests\\": "tests/"
} }

123
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9232ff40da15c9430731254edc662eb7", "content-hash": "9055a451d415d482a2f7287e0787bbc3",
"packages": [ "packages": [
{ {
"name": "appstract/laravel-blade-directives", "name": "appstract/laravel-blade-directives",
@ -4634,6 +4634,66 @@
], ],
"time": "2017-07-22T11:58:36+00:00" "time": "2017-07-22T11:58:36+00:00"
}, },
{
"name": "facebook/webdriver",
"version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/facebook/php-webdriver.git",
"reference": "bd8c740097eb9f2fc3735250fc1912bc811a954e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/bd8c740097eb9f2fc3735250fc1912bc811a954e",
"reference": "bd8c740097eb9f2fc3735250fc1912bc811a954e",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-zip": "*",
"php": "^5.6 || ~7.0",
"symfony/process": "^2.8 || ^3.1 || ^4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"php-coveralls/php-coveralls": "^2.0",
"php-mock/php-mock-phpunit": "^1.1",
"phpunit/phpunit": "^5.7",
"sebastian/environment": "^1.3.4 || ^2.0 || ^3.0",
"squizlabs/php_codesniffer": "^2.6",
"symfony/var-dumper": "^3.3 || ^4.0"
},
"suggest": {
"ext-SimpleXML": "For Firefox profile creation"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-community": "1.5-dev"
}
},
"autoload": {
"psr-4": {
"Facebook\\WebDriver\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "A PHP client for Selenium WebDriver",
"homepage": "https://github.com/facebook/php-webdriver",
"keywords": [
"facebook",
"php",
"selenium",
"webdriver"
],
"time": "2018-05-16T17:37:13+00:00"
},
{ {
"name": "filp/whoops", "name": "filp/whoops",
"version": "2.1.14", "version": "2.1.14",
@ -4944,6 +5004,67 @@
], ],
"time": "2016-02-11T16:21:17+00:00" "time": "2016-02-11T16:21:17+00:00"
}, },
{
"name": "laravel/dusk",
"version": "v3.0.8",
"source": {
"type": "git",
"url": "https://github.com/laravel/dusk.git",
"reference": "c6201427e63b869b0c1ee83d91c1d1958b71968e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/dusk/zipball/c6201427e63b869b0c1ee83d91c1d1958b71968e",
"reference": "c6201427e63b869b0c1ee83d91c1d1958b71968e",
"shasum": ""
},
"require": {
"facebook/webdriver": "~1.0",
"illuminate/console": "~5.6",
"illuminate/support": "~5.6",
"nesbot/carbon": "~1.20",
"php": ">=7.1.0",
"symfony/console": "~4.0",
"symfony/process": "~4.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
},
"laravel": {
"providers": [
"Laravel\\Dusk\\DuskServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Dusk\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Laravel Dusk provides simple end-to-end testing and browser automation.",
"keywords": [
"laravel",
"testing",
"webdriver"
],
"time": "2018-04-29T19:15:23+00:00"
},
{ {
"name": "martinlindhe/laravel-vue-i18n-generator", "name": "martinlindhe/laravel-vue-i18n-generator",
"version": "0.1.28", "version": "0.1.28",

View file

@ -10,6 +10,9 @@
processIsolation="false" processIsolation="false"
stopOnFailure="false"> stopOnFailure="false">
<testsuites> <testsuites>
<testsuite name="Browser">
<directory suffix="Test.php">./tests/Browser/Processes</directory>
</testsuite>
<testsuite name="Integration"> <testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory> <directory suffix="Test.php">./tests/Integration</directory>
</testsuite> </testsuite>

View file

@ -0,0 +1,44 @@
<?php
namespace Pterodactyl\Tests\Browser;
use Laravel\Dusk\TestCase;
use Tests\CreatesApplication;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Illuminate\Foundation\Testing\DatabaseMigrations;
abstract class BrowserTestCase extends TestCase
{
use CreatesApplication, DatabaseMigrations;
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
]);
return RemoteWebDriver::create(
'http://services.pterodactyl.local:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
/**
* Return an instance of the browser to be used for tests.
*
* @param \Facebook\WebDriver\Remote\RemoteWebDriver $driver
* @return \Pterodactyl\Tests\Browser\PterodactylBrowser
*/
protected function newBrowser($driver): PterodactylBrowser
{
return new PterodactylBrowser($driver);
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace Pterodactyl\Tests\Browser;
use Laravel\Dusk\Browser;
class PterodactylBrowser extends Browser
{
}

2
tests/Browser/console/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

2
tests/Browser/screenshots/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore