From 6096d80ef8c803ec44f2080436823aa829595699 Mon Sep 17 00:00:00 2001
From: Dominik Hebeler <dominik@suma-ev.de>
Date: Tue, 4 Aug 2020 15:05:59 +0200
Subject: [PATCH] Added basic tests for the availability of the startpage

---
 .gitignore                          |   2 +
 app/Browserstack.php                |  84 ------------------
 composer.json                       |   6 +-
 docker-compose.yml                  |   2 +-
 tests/Browser/Pages/About.php       |  51 +++++++++++
 tests/Browser/Pages/App.php         |  51 +++++++++++
 tests/Browser/Pages/Datenschutz.php |  50 +++++++++++
 tests/Browser/Pages/Hilfe.php       |  51 +++++++++++
 tests/Browser/Pages/HomePage.php    |  60 +++++++++++++
 tests/Browser/Pages/Impress.php     |  51 +++++++++++
 tests/Browser/Pages/Kontakt.php     |  51 +++++++++++
 tests/Browser/Pages/Page.php        |  30 +++++++
 tests/Browser/Pages/Spende.php      |  50 +++++++++++
 tests/Browser/Pages/Team.php        |  51 +++++++++++
 tests/Browser/StaticPagesTest.php   | 131 ++++++++++++++++++++++++++++
 tests/DuskTestCase.php              |  59 +++++++++++++
 16 files changed, 693 insertions(+), 87 deletions(-)
 delete mode 100644 app/Browserstack.php
 create mode 100644 tests/Browser/Pages/About.php
 create mode 100644 tests/Browser/Pages/App.php
 create mode 100644 tests/Browser/Pages/Datenschutz.php
 create mode 100644 tests/Browser/Pages/Hilfe.php
 create mode 100644 tests/Browser/Pages/HomePage.php
 create mode 100644 tests/Browser/Pages/Impress.php
 create mode 100644 tests/Browser/Pages/Kontakt.php
 create mode 100644 tests/Browser/Pages/Page.php
 create mode 100644 tests/Browser/Pages/Spende.php
 create mode 100644 tests/Browser/Pages/Team.php
 create mode 100644 tests/Browser/StaticPagesTest.php
 create mode 100644 tests/DuskTestCase.php

diff --git a/.gitignore b/.gitignore
index 953682c1b..0a9d308d5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,5 @@ npm-debug.log
 /.project
 
 composer.lock
+local.log
+tests/Browser/console/browserstack.log
diff --git a/app/Browserstack.php b/app/Browserstack.php
deleted file mode 100644
index 6c9423a28..000000000
--- a/app/Browserstack.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-namespace App;
-
-use BrowserStack\Local;
-use Facebook\WebDriver\Remote\RemoteWebDriver;
-
-class Browserstack
-{
-    private $webdriver, $bs_local = null;
-    private $LOCALCAPABILITIES = array();
-    private $CAPABILITIES = array();
-
-    public function __construct()
-    {
-        $this->setCapabilities();
-        $caps = null;
-        if ($this->isLocal()) {
-            $caps = $this->LOCALCAPABILITIES;
-            $this->bs_local = new Local();
-            $bs_local_args = array("key" => env("WEBDRIVER_KEY", ""));
-            $this->bs_local->start($bs_local_args);
-        } else {
-            $caps = $this->CAPABILITIES;
-        }
-        $this->webdriver = RemoteWebDriver::create(
-            getenv("WEBDRIVER_URL"),
-            $caps
-        );
-    }
-
-    private function setCapabilities()
-    {
-        $this->LOCALCAPABILITIES = array(
-            "os" => "Windows",
-            "os_version" => "10",
-            "browser" => "Firefox",
-            "browser_version" => "79.0 beta",
-            "resolution" => "1920x1080",
-            "project" => env("PROJECT_NAME", "Not Set"),
-            "build" => env("BRANCH_NAME", "Not Set"),
-            "name" => env("COMMIT_NAME", "Not Set"),
-            "browserstack.local" => "true",
-            "browserstack.console" => "verbose",
-            "browserstack.networkLogs" => "true",
-            "browserstack.timezone" => "Europe/Berlin",
-            "browserstack.selenium_version" => "3.5.2",
-        );
-        $this->CAPABILITIES = array(
-            "os" => "Windows",
-            "os_version" => "10",
-            "browser" => "Firefox",
-            "browser_version" => "79.0 beta",
-            "resolution" => "1920x1080",
-            "project" => env("PROJECT_NAME", "Not Set"),
-            "build" => env("BRANCH_NAME", "Not Set"),
-            "name" => env("COMMIT_NAME", "Not Set"),
-            "browserstack.local" => "false",
-            "browserstack.console" => "verbose",
-            "browserstack.networkLogs" => "true",
-            "browserstack.timezone" => "Europe/Berlin",
-            "browserstack.selenium_version" => "3.5.2",
-        );
-    }
-
-    public function getWebdriver()
-    {
-        return $this->webdriver;
-    }
-
-    public function shutdown()
-    {
-        $this->webdriver->quit();
-        if ($this->bs_local != null) {
-            $this->bs_local->stop();
-        }
-    }
-
-    private function isLocal()
-    {
-        return env("APP_URL", "") === "http://nginx";
-    }
-
-}
diff --git a/composer.json b/composer.json
index afaeda317..49624c8e5 100644
--- a/composer.json
+++ b/composer.json
@@ -23,12 +23,14 @@
     },
     "require-dev": {
         "beyondcode/laravel-dump-server": "^1.0",
-        "php-webdriver/webdriver": "^1.6",
         "browserstack/browserstack-local": "^1.1",
         "filp/whoops": "^2.0",
         "fzaninotto/faker": "^1.4",
+        "galahad/dusk-browserstack": "^2.0",
+        "laravel/dusk": "^5.0",
         "mockery/mockery": "^1.0",
         "nunomaduro/collision": "^3.0",
+        "php-webdriver/webdriver": "^1.6",
         "phpunit/phpunit": "^7.5"
     },
     "config": {
@@ -69,4 +71,4 @@
             "@php artisan key:generate --ansi"
         ]
     }
-}
\ No newline at end of file
+}
diff --git a/docker-compose.yml b/docker-compose.yml
index aac335003..86f67380c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -75,4 +75,4 @@ services:
     working_dir: /html
     volumes:
       - .:/html
-    command: "./vendor/phpunit/phpunit/phpunit"
+    command: "php artisan dusk"
diff --git a/tests/Browser/Pages/About.php b/tests/Browser/Pages/About.php
new file mode 100644
index 000000000..046879d9a
--- /dev/null
+++ b/tests/Browser/Pages/About.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class About extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/about';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("Was MetaGer auszeichnet")
+            ->assertTitle("Über Uns - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("MetaGer - Characteristic qualities")
+            ->assertTitle("About Us - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("Was MetaGer auszeichnet")
+            ->assertTitle("Sobre nosotros - MetaGer")
+            ->switchLanguage("Deutsch");
+
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/App.php b/tests/Browser/Pages/App.php
new file mode 100644
index 000000000..c28c9a703
--- /dev/null
+++ b/tests/Browser/Pages/App.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class App extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/app';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("Diese App bringt die volle Power unserer Suchmaschine auf ihr Smartphone.")
+            ->assertTitle("Apps - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("This App brings the full Metager power to your smartphone.")
+            ->assertTitle("Apps - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("Diese App bringt die volle Power unserer Suchmaschine auf ihr Smartphone.")
+            ->assertTitle("Aplicaciones - MetaGer")
+            ->switchLanguage("Deutsch");
+
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/Datenschutz.php b/tests/Browser/Pages/Datenschutz.php
new file mode 100644
index 000000000..00ad16475
--- /dev/null
+++ b/tests/Browser/Pages/Datenschutz.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class Datenschutz extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/datenschutz';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("Datenschutz bei MetaGer/SUMA-EV")
+            ->assertTitle("Datenschutz und Privatsphäre - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("Data protection at MetaGer/SUMA-EV")
+            ->assertTitle("Privacy - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("Data protection at MetaGer/SUMA-EV")
+            ->assertTitle("Protección de datos y privacidad - MetaGer")
+            ->switchLanguage("Deutsch");
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/Hilfe.php b/tests/Browser/Pages/Hilfe.php
new file mode 100644
index 000000000..343c6433f
--- /dev/null
+++ b/tests/Browser/Pages/Hilfe.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class Hilfe extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/hilfe';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("MetaGer - Hilfe")
+            ->assertTitle("Hilfe - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("MetaGer Help")
+            ->assertTitle("Help - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("MetaGer - Hilfe")
+            ->assertTitle("Ayuda - MetaGer")
+            ->switchLanguage("Deutsch");
+
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/HomePage.php b/tests/Browser/Pages/HomePage.php
new file mode 100644
index 000000000..3ceecbff7
--- /dev/null
+++ b/tests/Browser/Pages/HomePage.php
@@ -0,0 +1,60 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class HomePage extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  \Laravel\Dusk\Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        # German
+        $browser->assertPathIs($this->url())
+            ->waitForText("Garantierte Privatsphäre", 1)
+            ->assertTitle('MetaGer - Mehr als eine Suchmaschine')
+            ->assertSee("Vielfältig & Frei")
+            ->assertSee("100% Ökostrom")
+            ->assertSee("Gemeinnütziger Verein")
+            ->switchLanguage("English")
+            ->waitForText("Guaranteed Privacy", 1)
+            ->assertTitle('MetaGer: Privacy Protected Search & Find')
+            ->assertSee("Diverse & free")
+            ->assertSee("100 % renewable energy")
+            ->assertSee("Nonprofit organization")
+            ->switchLanguage("Español")
+            ->waitForText("Privacidad garantizada", 1)
+            ->assertTitle('MetaGer: Buscar & encontrar seguro, proteger la privacidad')
+            ->assertSee("Diversa y libre")
+            ->assertSee("Energía 100% renovable")
+            ->assertSee("Organización sin ánimo de lucro")
+            ->switchLanguage("Deutsch");
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@sidebarToggle' => 'label.sidebar-opener[for=sidebarToggle]',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/Impress.php b/tests/Browser/Pages/Impress.php
new file mode 100644
index 000000000..a54c0a0f6
--- /dev/null
+++ b/tests/Browser/Pages/Impress.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class Impress extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/impressum';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("Haftungshinweis:")
+            ->assertTitle("Impressum - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("Liability Note:")
+            ->assertTitle("Site Notice - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("Exención de responsabilidad")
+            ->assertTitle("Aviso legal - MetaGer")
+            ->switchLanguage("Deutsch");
+
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/Kontakt.php b/tests/Browser/Pages/Kontakt.php
new file mode 100644
index 000000000..02ed0ab07
--- /dev/null
+++ b/tests/Browser/Pages/Kontakt.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class Kontakt extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/kontakt';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("Sicheres Kontaktformular")
+            ->assertTitle("Kontakt - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("Secure Contact Form")
+            ->assertTitle("Contact - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("Formulario de contacto seguro")
+            ->assertTitle("Contacto - MetaGer")
+            ->switchLanguage("Deutsch");
+
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/Page.php b/tests/Browser/Pages/Page.php
new file mode 100644
index 000000000..d569e1c3e
--- /dev/null
+++ b/tests/Browser/Pages/Page.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+use Laravel\Dusk\Page as BasePage;
+
+abstract class Page extends BasePage
+{
+    /**
+     * Get the global element shortcuts for the site.
+     *
+     * @return array
+     */
+    public static function siteElements()
+    {
+        return [
+            '@sidebarToggle' => 'label.sidebar-opener[for=sidebarToggle]',
+            '@languageDropdown' => '#navigationSprache',
+        ];
+    }
+
+    public function switchLanguage(Browser $browser, $language)
+    {
+        $browser->waitFor("@sidebarToggle")
+            ->click("@sidebarToggle")
+            ->click("@languageDropdown")
+            ->clickLink($language);
+    }
+}
diff --git a/tests/Browser/Pages/Spende.php b/tests/Browser/Pages/Spende.php
new file mode 100644
index 000000000..ef37b7191
--- /dev/null
+++ b/tests/Browser/Pages/Spende.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class Spende extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/spende';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("Ihre Spende für SUMA-EV und MetaGer")
+            ->assertTitle("Spenden - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("Your Donation for MetaGer to SUMA-EV")
+            ->assertTitle("Donation - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("Su donación para SUME-EV y MetaGer")
+            ->assertTitle("Donaciones - MetaGer")
+            ->switchLanguage("Deutsch");
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/Pages/Team.php b/tests/Browser/Pages/Team.php
new file mode 100644
index 000000000..8077b875b
--- /dev/null
+++ b/tests/Browser/Pages/Team.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Tests\Browser\Pages;
+
+use Laravel\Dusk\Browser;
+
+class Team extends Page
+{
+    /**
+     * Get the URL for the page.
+     *
+     * @return string
+     */
+    public function url()
+    {
+        return '/team';
+    }
+
+    /**
+     * Assert that the browser is on the page.
+     *
+     * @param  Browser  $browser
+     * @return void
+     */
+    public function assert(Browser $browser)
+    {
+        $browser->assertPathIs($this->url())
+            ->waitForText("geschäftsführender Vorstand")
+            ->assertTitle("Team - MetaGer")
+            ->switchLanguage("English")
+            ->waitForText("CEO")
+            ->assertTitle("Team - MetaGer")
+            ->switchLanguage("Español")
+            ->waitForText("Director ejecutivo [CEO]")
+            ->assertTitle("Nuestra gente - MetaGer")
+            ->switchLanguage("Deutsch");
+
+    }
+
+    /**
+     * Get the element shortcuts for the page.
+     *
+     * @return array
+     */
+    public function elements()
+    {
+        return [
+            '@element' => '#selector',
+        ];
+    }
+}
diff --git a/tests/Browser/StaticPagesTest.php b/tests/Browser/StaticPagesTest.php
new file mode 100644
index 000000000..13f84e57e
--- /dev/null
+++ b/tests/Browser/StaticPagesTest.php
@@ -0,0 +1,131 @@
+<?php
+
+namespace Tests\Browser;
+
+use Laravel\Dusk\Browser;
+use Tests\Browser\Pages\About;
+use Tests\Browser\Pages\App;
+use Tests\Browser\Pages\Datenschutz;
+use Tests\Browser\Pages\Hilfe;
+use Tests\Browser\Pages\HomePage;
+use Tests\Browser\Pages\Impress;
+use Tests\Browser\Pages\Kontakt;
+use Tests\Browser\Pages\Spende;
+use Tests\Browser\Pages\Team;
+use Tests\DuskTestCase;
+
+class StaticPagesTest extends DuskTestCase
+{
+    private $bs = null;
+    /**
+     * Tests for each static page on MetaGers website whether it can be reached by navigation
+     *
+     * @return void
+     */
+    public function testStartpage()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit(new HomePage);
+        });
+    }
+
+    public function testDatenschutz()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->clickLink("Datenschutz")
+                ->waitForLocation("/datenschutz")
+                ->on(new Datenschutz);
+        });
+    }
+
+    public function testHilfe()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->clickLink("Hilfe")
+                ->waitForLocation("/hilfe")
+                ->on(new Hilfe);
+        });
+    }
+
+    public function testSpenden()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->clickLink("Spenden")
+                ->waitForLocation("/spende")
+                ->on(new Spende);
+        });
+    }
+
+    public function testApp()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->clickLink("MetaGer App")
+                ->waitForLocation("/app")
+                ->on(new App);
+        });
+    }
+
+    public function testKontakt()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->click("label#navigationKontakt")
+                ->clickLink("Kontakt")
+                ->waitForLocation("/kontakt")
+                ->on(new Kontakt);
+        });
+    }
+
+    public function testTeam()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->click("label#navigationKontakt")
+                ->clickLink("Team")
+                ->waitForLocation("/team")
+                ->on(new Team);
+        });
+    }
+
+    public function testAbout()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->click("label#navigationKontakt")
+                ->clickLink("Über uns")
+                ->waitForLocation("/about")
+                ->on(new About);
+        });
+    }
+
+    public function testImpress()
+    {
+        $this->browse(function (Browser $browser) {
+            $browser->visit("/")
+                ->waitFor("@sidebarToggle")
+                ->click("@sidebarToggle")
+                ->click("label#navigationKontakt")
+                ->clickLink("Impressum")
+                ->waitForLocation("/impressum")
+                ->on(new Impress);
+        });
+    }
+}
diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php
new file mode 100644
index 000000000..4121bf2cc
--- /dev/null
+++ b/tests/DuskTestCase.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace Tests;
+
+use Facebook\WebDriver\Remote\RemoteWebDriver;
+use Galahad\BrowserStack\SupportsBrowserStack;
+use Laravel\Dusk\TestCase as BaseTestCase;
+
+abstract class DuskTestCase extends BaseTestCase
+{
+    use CreatesApplication;
+    use SupportsBrowserStack;
+
+    /**
+     * Prepare for Dusk test execution.
+     *
+     * @beforeClass
+     * @return void
+     */
+    public static function prepare()
+    {
+    }
+
+    /**
+     * Create the RemoteWebDriver instance.
+     *
+     * @return \Facebook\WebDriver\Remote\RemoteWebDriver
+     */
+    protected function driver()
+    {
+        $capabilities = [
+            "os" => "Windows",
+            "os_version" => "10",
+            "browser" => "Firefox",
+            "browser_version" => "79.0 beta",
+            "resolution" => "1920x1080",
+            "project" => env("PROJECT_NAME", "Not Set"),
+            "build" => env("BRANCH_NAME", "Not Set"),
+            "name" => env("COMMIT_NAME", "Not Set"),
+            "browserstack.local" => "true",
+            "browserstack.console" => "verbose",
+            "browserstack.networkLogs" => "true",
+            "browserstack.timezone" => "Europe/Berlin",
+            "browserstack.selenium_version" => "3.5.2",
+        ];
+        if (env("APP_URL", "") !== "http://nginx") {
+            # Not local Testing
+            $capabilities["browserstack.local"] = "false";
+        }
+        return $this->createBrowserStackDriver([
+            "username" => env("WEBDRIVER_USER", ""),
+            "key" => env("WEBDRIVER_KEY", ""),
+            "capabilities" => $capabilities,
+            "local_config" => [
+                "key" => env("WEBDRIVER_KEY", ""),
+            ],
+        ]);
+    }
+}
-- 
GitLab