Commit a9df3522 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed tests

parent 0e7274ae
......@@ -23,4 +23,5 @@ local.log
browserstack.err
.npm
.composer
\ No newline at end of file
.composer
.phpunit.result.cache
......@@ -163,7 +163,7 @@ integrationtest:
- mc cp /tmp/packages.tar packages/$S3_BUCKETNAME/
- rm /tmp/packages.tar
- rm -rf .npm .composer
- php artisan dusk
- php artisan test --parallel --processes=5
except:
refs:
- master
......@@ -5,6 +5,7 @@ namespace App\Providers;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Support\ServiceProvider;
use \Mcamara\LaravelLocalization\Facades\LaravelLocalization;
use Queue;
use Request;
......@@ -28,10 +29,11 @@ class AppServiceProvider extends ServiceProvider
}
if (stripos($host, "metager.org") !== false) {
\App::setLocale('en');
}
if (stripos($host, "metager.es") !== false) {
\App::setLocale('es');
LaravelLocalization::setLocale('en');
}else if (stripos($host, "metager.es") !== false) {
LaravelLocalization::setLocale('es');
}else{
LaravelLocalization::setLocale();
}
\Prometheus\Storage\Redis::setDefaultOptions(
......
......@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
use \Mcamara\LaravelLocalization\Traits\LoadsTranslatedCachedRoutes;
/**
* This namespace is applied to your controller routes.
*
......@@ -57,6 +58,7 @@ class RouteServiceProvider extends ServiceProvider
{
Route::group([
'middleware' => 'web',
'prefix' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale(),
'namespace' => $this->namespace,
], function ($router) {
require base_path('routes/web.php');
......@@ -92,6 +94,7 @@ class RouteServiceProvider extends ServiceProvider
{
Route::group([
'middleware' => 'enableCookies',
'prefix' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale(),
'namespace' => $this->namespace,
], function ($router) {
require base_path('routes/cookie.php');
......@@ -109,6 +112,7 @@ class RouteServiceProvider extends ServiceProvider
{
Route::group([
'middleware' => 'session',
'prefix' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale(),
'namespace' => $this->namespace,
], function ($router) {
require base_path('routes/session.php');
......
<?php
namespace App\Traits;
use BrowserStack\Local;
use Facebook\WebDriver\Remote\RemoteWebDriver;
/**
* Run BrowserStack from your tests.
*/
trait SupportsBrowserStack
{
protected static $bs_local;
/**
* Create the BrowserStack WebDriver instance.
*/
public function createBrowserStackDriver(array $config = null): RemoteWebDriver
{
if ($config["capabilities"]["browserstack.local"] === "true") {
$this->bs_local = new Local();
$bs_local_args = [
"key" => $config["key"],
];
$this->bs_local->start($bs_local_args);
}
return RemoteWebDriver::create(
"https://$config[username]:$config[key]@hub-cloud.browserstack.com/wd/hub",
$config["capabilities"]
);
}
/**
* @afterClass
*/
public static function shutdown()
{
if (static::$bs_local && static::$bs_local->isRunning()) {
static::$bs_local->stop();
}
}
}
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "aae0bd416c56bf2e37fdbcbb87c0bb10",
"content-hash": "3baedf432da7113511d963ffc92ade1e",
"packages": [
{
"name": "asm89/stack-cors",
......@@ -5496,6 +5496,100 @@
}
],
"packages-dev": [
{
"name": "brianium/paratest",
"version": "v6.3.0",
"source": {
"type": "git",
"url": "https://github.com/paratestphp/paratest.git",
"reference": "268d5b2b4237c0abf76c4aa9633ad8580be01e1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/268d5b2b4237c0abf76c4aa9633ad8580be01e1e",
"reference": "268d5b2b4237c0abf76c4aa9633ad8580be01e1e",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-simplexml": "*",
"php": "^7.3 || ^8.0",
"phpunit/php-code-coverage": "^9.2.6",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-timer": "^5.0.3",
"phpunit/phpunit": "^9.5.4",
"sebastian/environment": "^5.1.3",
"symfony/console": "^4.4.21 || ^5.2.6",
"symfony/process": "^4.4.21 || ^5.2.4"
},
"require-dev": {
"doctrine/coding-standard": "^9.0.0",
"ekino/phpstan-banned-code": "^0.4.0",
"ergebnis/phpstan-rules": "^0.15.3",
"ext-posix": "*",
"infection/infection": "^0.21.5",
"phpstan/phpstan": "^0.12.84",
"phpstan/phpstan-deprecation-rules": "^0.12.6",
"phpstan/phpstan-phpunit": "^0.12.18",
"phpstan/phpstan-strict-rules": "^0.12.9",
"squizlabs/php_codesniffer": "^3.6.0",
"symfony/filesystem": "^5.2.6",
"thecodingmachine/phpstan-strict-rules": "^0.12.1",
"vimeo/psalm": "^4.7.1"
},
"bin": [
"bin/paratest"
],
"type": "library",
"autoload": {
"psr-4": {
"ParaTest\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brian Scaturro",
"email": "scaturrob@gmail.com",
"role": "Developer"
},
{
"name": "Filippo Tessarotto",
"email": "zoeslam@gmail.com",
"role": "Developer"
}
],
"description": "Parallel testing for PHP",
"homepage": "https://github.com/paratestphp/paratest",
"keywords": [
"concurrent",
"parallel",
"phpunit",
"testing"
],
"support": {
"issues": "https://github.com/paratestphp/paratest/issues",
"source": "https://github.com/paratestphp/paratest/tree/v6.3.0"
},
"funding": [
{
"url": "https://github.com/sponsors/Slamdunk",
"type": "github"
},
{
"url": "https://paypal.me/filippotessarotto",
"type": "paypal"
}
],
"time": "2021-04-27T09:24:27+00:00"
},
{
"name": "browserstack/browserstack-local",
"version": "v1.1.0",
......@@ -5544,6 +5638,71 @@
},
"time": "2016-09-19T13:39:06+00:00"
},
{
"name": "chinleung/laravel-browserstack",
"version": "v1.4.1",
"source": {
"type": "git",
"url": "https://github.com/chinleung/laravel-browserstack.git",
"reference": "ba29fd02cefd059494871b0c97cc89785674d1cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chinleung/laravel-browserstack/zipball/ba29fd02cefd059494871b0c97cc89785674d1cb",
"reference": "ba29fd02cefd059494871b0c97cc89785674d1cb",
"shasum": ""
},
"require": {
"browserstack/browserstack-local": "^1.1",
"guzzlehttp/guzzle": "^6.5|^7.0",
"illuminate/support": "~5.8.0|^6.0|^7.0|^8.0",
"laravel/dusk": "^5.9|^6.0",
"php": "^7.2"
},
"require-dev": {
"orchestra/testbench": "3.8.*",
"phpunit/phpunit": "^8.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"ChinLeung\\BrowserStack\\BrowserStackServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"ChinLeung\\BrowserStack\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chin Leung",
"email": "hello@chinleung.com",
"role": "Developer"
}
],
"description": "Run Laravel Dusk tests on BrowserStack.",
"homepage": "https://github.com/chinleung/laravel-browserstack",
"keywords": [
"BrowserStack",
"automate",
"chinleung",
"laravel-browserstack",
"laravel-dusk",
"testing"
],
"support": {
"issues": "https://github.com/chinleung/laravel-browserstack/issues",
"source": "https://github.com/chinleung/laravel-browserstack/tree/v1.4.1"
},
"time": "2021-04-23T14:20:08+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.4.0",
......@@ -8193,5 +8352,5 @@
"php": "^7.3|^8.0"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.1.0"
}
<?php
return [
/*
|--------------------------------------------------------------------------
| Credentials
|--------------------------------------------------------------------------
|
| Your username and access key for BrowserStack.
| https://www.browserstack.com/accounts/settings
|
*/
'username' => env('BROWSERSTACK_USERNAME'),
'key' => env('BROWSERSTACK_ACCESS_KEY'),
/*
|--------------------------------------------------------------------------
| Browser
|--------------------------------------------------------------------------
|
| The browser slug to run on BrowserStack.
|
*/
'browser' => env('BROWSERSTACK_BROWSER'),
/*
|--------------------------------------------------------------------------
| Session
|--------------------------------------------------------------------------
|
| Configuration to make BrowserStack run each tests in a different
| session.
|
*/
'separate_sessions' => env('BROWSERSTACK_SEPARATE_SESSIONS', true),
/*
|--------------------------------------------------------------------------
| Capabilities
|--------------------------------------------------------------------------
|
| The configuration for capabilities of the browser.
| https://www.browserstack.com/automate/capabilities
|
*/
'capabilities' => [
'acceptSslCerts' => env('BROWSERSTACK_ACCEPT_SSL', true),
'browserstack' => [
'console' => env('BROWSERSTACK_CONSOLE', 'verbose'),
'local' => env('BROWSERSTACK_LOCAL_TUNNEL', true),
'timezone' => env('BROWSERSTACK_TIMEZONE', config('app.timezone')),
"timezone" => "Europe/Berlin",
],
"resolution" => "1920x1080",
"project" => env("PROJECT_NAME", "Not Set"),
"build" => env("BRANCH_NAME", "Not Set"),
"name" => env("COMMIT_NAME", "Not Set"),
'resolution' => env('BROWSERSTACK_RESOLUTION', '1920x1080'),
],
/*
|--------------------------------------------------------------------------
| Command Arguments
|--------------------------------------------------------------------------
|
| The arguments and flags to use for the BrowserStack local connection.
|
*/
'arguments' => [
'binaryPath' => env('BROWSERSTACK_CLI_BINARY_PATH'),
'logFile' => env('BROWSERSTACK_CLI_LOG_FILE'),
'v' => env('BROWSERSTACK_CLI_VERBOSE'),
'force' => env('BROWSERSTACK_CLI_FORCE'),
'only' => env('BROWSERSTACK_CLI_ONLY'),
'onlyAutomate' => env('BROWSERSTACK_CLI_ONLY_AUTOMATE'),
'forcelocal' => env(
'BROWSERSTACK_CLI_FORCE_LOCAL',
env('BROWSERSTACK_LOCAL_TUNNEL', true)
),
'localIdentifier' => env('BROWSERSTACK_CLI_LOCAL_IDENTIFIER'),
'proxyHost' => env('BROWSERSTACK_CLI_PROXY_HOST'),
'proxyPort' => env('BROWSERSTACK_CLI_PROXY_PORT'),
'proxyUser' => env('BROWSERSTACK_CLI_PROXY_USER'),
'proxyPass' => env('BROWSERSTACK_CLI_PROXY_PASSWORD'),
'forceproxy' => env('BROWSERSTACK_CLI_FORCE_PROXY'),
'hosts' => env('BROWSERSTACK_CLI_HOSTS'),
'f' => env('BROWSERSTACK_CLI_F'),
],
];
......@@ -12,11 +12,14 @@ then
php artisan key:generate
fi
if [ "$GITLAB_ENVIRONMENT_NAME" = "production" ];
then
sed -i 's/^APP_ENV=.*/APP_ENV=production/g' .env;
else
sed -i 's/^APP_ENV=.*/APP_ENV=development/g' .env;
if [ ! -z $GITLAB_ENVIRONMENT_NAME ];
then
if [ "$GITLAB_ENVIRONMENT_NAME" = "production" ];
then
sed -i 's/^APP_ENV=.*/APP_ENV=production/g' .env;
else
sed -i 's/^APP_ENV=.*/APP_ENV=development/g' .env;
fi
fi
if [ ! -f "/html/config/sumas.json" ]; then
......@@ -35,4 +38,5 @@ if [ ! -d "/html/storage/logs/metager" ]; then
mkdir -p /html/storage/logs/metager
fi
php artisan optimize
\ No newline at end of file
php artisan optimize
php artisan route:trans:cache
\ No newline at end of file
This diff is collapsed.
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\About;
use Tests\DuskTestCase;
class AboutTest extends DuskTestCase
{
public function testAbout()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("label.sidebar-opener[for=sidebarToggle]")
->click("label.sidebar-opener[for=sidebarToggle]")
->click("label#navigationKontakt")
->clickLink("Über uns")
->waitForLocation("/about")
->on(new About);
});
}
}
\ No newline at end of file
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\App;
use Tests\DuskTestCase;
class AppTest extends DuskTestCase
{
public function testApp()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("label.sidebar-opener[for=sidebarToggle]")
->click("label.sidebar-opener[for=sidebarToggle]")
->clickLink("MetaGer App")
->waitForLocation("/app")
->on(new App);
});
}
}
\ No newline at end of file
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\Datenschutz;
use Tests\DuskTestCase;
class DatenschutzTest extends DuskTestCase
{
public function testDatenschutz()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->click("label.sidebar-opener[for=sidebarToggle]")
->clickLink("Datenschutz")
->waitForLocation("/datenschutz")
->on(new Datenschutz);
});
}
}
\ No newline at end of file
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\Hilfe;
use Tests\DuskTestCase;
class HilfeTest extends DuskTestCase
{
public function testHilfe()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("label.sidebar-opener[for=sidebarToggle]")
->click("label.sidebar-opener[for=sidebarToggle]")
->clickLink("Hilfe")
->waitForLocation("/hilfe")
->on(new Hilfe);
});
}
}
\ No newline at end of file
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\Impress;
use Tests\DuskTestCase;
class ImpressumTest extends DuskTestCase
{
public function testImpress()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("label.sidebar-opener[for=sidebarToggle]")
->click("label.sidebar-opener[for=sidebarToggle]")
->click("label#navigationKontakt")
->clickLink("Impressum")
->waitForLocation("/impressum")
->on(new Impress);
});
}
}
\ No newline at end of file
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\Kontakt;
use Tests\DuskTestCase;
class KontaktTest extends DuskTestCase
{
public function testKontakt()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("label.sidebar-opener[for=sidebarToggle]")
->click("label.sidebar-opener[for=sidebarToggle]")
->click("label#navigationKontakt")
->clickLink("Kontakt")
->waitForLocation("/kontakt")
->on(new Kontakt);
});
}
}
\ No newline at end of file
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\Plugin;
use Tests\DuskTestCase;
class PluginTest extends DuskTestCase
{