Commit 216e1522 authored by Dominik Hebeler's avatar Dominik Hebeler

most of our pages now have an availability test

parent 5dfd127c
<?php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Browser;
class Plugin extends Page
{
/**
* Get the URL for the page.
*
* @return string
*/
public function url()
{
return '/plugin';
}
/**
* Assert that the browser is on the page.
*
* @param Browser $browser
* @return void
*/
public function assert(Browser $browser)
{
$browser->assertPathIs($this->url())
->waitForText("MetaGer zum Firefox hinzufügen")
->assertTitle("Plugin - MetaGer")
->switchLanguage("English")
->waitForText("Add MetaGer to your Firefox")
->assertTitle("Plugin - MetaGer")
->switchLanguage("Español")
->waitForText("Añadir MetaGer a Firefox")
->assertTitle("Plugin - MetaGer")
->switchLanguage("Deutsch");
}
/**
* Get the element shortcuts for the page.
*
* @return array
*/
public function elements()
{
return [
'@element' => '#selector',
];
}
}
<?php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Browser;
class SitesearchWidget extends Page
{
/**
* Get the URL for the page.
*
* @return string
*/
public function url()
{
return '/sitesearch/';
}
/**
* Assert that the browser is on the page.
*
* @param Browser $browser
* @return void
*/
public function assert(Browser $browser)
{
$browser->assertPathIs($this->url())
->waitForText("Hier finden Sie ein Metager-Widget für Ihre Webseite.")
->assertTitle("Sitesearch-Widget - MetaGer")
->type("site", "https://metager.de")
->press("Generieren")
->waitForLocation("/sitesearch")
->waitForText("Hier finden Sie ein Metager-Widget für Ihre Webseite.")
->assertTitle("Sitesearch-Widget - MetaGer")
->visit($this->url())
->switchLanguage("English")
->waitForText("Here you find a Metager-Widget for your website.")
->assertTitle("Sitesearch-Widget - MetaGer")
->type("site", "https://metager.de")
->press("Generate");
$location = "/en/sitesearch";
if (env("APP_ENV", "") === "production") {
$location = "/sitesearch";
}
$browser->waitForLocation($location)
->waitForText("Here you find a Metager-Widget for your website.")
->assertTitle("Sitesearch-Widget - MetaGer")
->visit($this->url())
->switchLanguage("Español")
->waitForText("Hier finden Sie ein Metager-Widget für Ihre Webseite.")
->assertTitle("Sitesearch-Widget - MetaGer")
->type("site", "https://metager.de")
->press("Generar");
$location = "/es/sitesearch";
if (env("APP_ENV", "") === "production") {
$location = "/sitesearch";
}
$browser->waitForLocation($location)
->waitForText("Hier finden Sie ein Metager-Widget für Ihre Webseite.")
->assertTitle("Sitesearch-Widget - MetaGer")
->visit($this->url())
->switchLanguage("Deutsch");
}
/**
* Get the element shortcuts for the page.
*
* @return array
*/
public function elements()
{
return [
'@element' => '#selector',
];
}
}
<?php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Browser;
class WebsearchWidget extends Page
{
/**
* Get the URL for the page.
*
* @return string
*/
public function url()
{
return '/websearch';
}
/**
* Assert that the browser is on the page.
*
* @param Browser $browser
* @return void
*/
public function assert(Browser $browser)
{
$browser->assertPathIs($this->url())
->waitForText("Hier finden Sie ein Metager-Widget für Ihre Webseite.")
->assertTitle("Websuche-Widget - MetaGer")
->switchLanguage("English")
->waitForText("Here you find a Metager-Widget for your website.")
->assertTitle("Websearch-Widget - MetaGer")
->switchLanguage("Español")
->waitForText("Aquí encuentra el MetaGer-widget para su sitio web")
->assertTitle("Widget para buscar la web - MetaGer")
->switchLanguage("Deutsch");
}
/**
* Get the element shortcuts for the page.
*
* @return array
*/
public function elements()
{
return [
'@element' => '#selector',
];
}
}
<?php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Browser;
class Widget extends Page
{
/**
* Get the URL for the page.
*
* @return string
*/
public function url()
{
return '/widget';
}
/**
* Assert that the browser is on the page.
*
* @param Browser $browser
* @return void
*/
public function assert(Browser $browser)
{
$browser->assertPathIs($this->url())
->waitForText("MetaGer zum Einbau in Ihre Webseite. Wählen Sie dafür aus, wo gesucht werden soll:")
->assertTitle("MetaGer Widget")
->switchLanguage("English")
->waitForText("MetaGer for usage on your website. Please choose the scope of your widget:")
->assertTitle("MetaGer Widget")
->switchLanguage("Español")
->waitForText("MetaGer: un motor de búsqueda for suyo sitio web. Selecciona por favor:")
->assertTitle("MetaGer Widget")
->switchLanguage("Deutsch");
}
/**
* Get the element shortcuts for the page.
*
* @return array
*/
public function elements()
{
return [
'@element' => '#selector',
];
}
}
......@@ -10,8 +10,11 @@ use Tests\Browser\Pages\Hilfe;
use Tests\Browser\Pages\HomePage;
use Tests\Browser\Pages\Impress;
use Tests\Browser\Pages\Kontakt;
use Tests\Browser\Pages\SitesearchWidget;
use Tests\Browser\Pages\Spende;
use Tests\Browser\Pages\Team;
use Tests\Browser\Pages\WebsearchWidget;
use Tests\Browser\Pages\Widget;
use Tests\DuskTestCase;
class StaticPagesTest extends DuskTestCase
......@@ -128,4 +131,60 @@ class StaticPagesTest extends DuskTestCase
->on(new Impress);
});
}
public function testPlugin()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("@sidebarToggle")
->click("@sidebarToggle")
->click("label[for=servicesToggle]")
->clickLink("MetaGer Plugin")
->waitForLocation("/plugin")
->on(new Plugin);
});
}
public function testWidget()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("@sidebarToggle")
->click("@sidebarToggle")
->click("label[for=servicesToggle]")
->clickLink("Widget")
->waitForLocation("/widget")
->on(new Widget);
});
}
public function testWebsearchWidget()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("@sidebarToggle")
->click("@sidebarToggle")
->click("label[for=servicesToggle]")
->clickLink("Widget")
->waitForLocation("/widget")
->clickLink("Suche im Web")
->waitForLocation("/websearch")
->on(new WebsearchWidget);
});
}
public function testSitesearchWidget()
{
$this->browse(function (Browser $browser) {
$browser->visit("/")
->waitFor("@sidebarToggle")
->click("@sidebarToggle")
->click("label[for=servicesToggle]")
->clickLink("Widget")
->waitForLocation("/widget")
->clickLink("Suche nur auf einer Domain")
->waitForLocation("/sitesearch/")
->on(new SitesearchWidget);
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment