From 2c99a93226160c6f049db0e8c0a2e78d9efa4750 Mon Sep 17 00:00:00 2001 From: Dominik Hebeler <dominik@suma-ev.de> Date: Thu, 15 Sep 2022 14:22:32 +0200 Subject: [PATCH] fixed donation page test --- metager/lang/.translation_io | 2 +- metager/lang/de/spende.php | 6 ++--- metager/lang/en/spende.php | 9 ++++--- metager/lang/es/spende.php | 9 ++++--- .../resources/views/spende/spende.blade.php | 10 ++++---- metager/tests/Browser/Pages/Spende.php | 24 +++++++++---------- metager/tests/Browser/StaticPagesTest.php | 4 ++-- 7 files changed, 35 insertions(+), 29 deletions(-) diff --git a/metager/lang/.translation_io b/metager/lang/.translation_io index 941fc1cb3..0a979207e 100644 --- a/metager/lang/.translation_io +++ b/metager/lang/.translation_io @@ -1 +1 @@ -{"timestamp":1663240478} \ No newline at end of file +{"timestamp":1663244394} \ No newline at end of file diff --git a/metager/lang/de/spende.php b/metager/lang/de/spende.php index 7d64cbb66..b4525c221 100644 --- a/metager/lang/de/spende.php +++ b/metager/lang/de/spende.php @@ -9,7 +9,7 @@ return [ 'headline.5' => 'Wie möchten Sie spenden?', 'headline.6' => 'Kontodaten', - 'wunschbetrag' => 'Wunschbetrag', + 'wunschbetrag.label' => 'Wunschbetrag', 'wunschbetrag.placeholder' => 'Betrag in €', 'frequency' => 'Häufigkeit', @@ -21,7 +21,7 @@ return [ 'head.lastschrift' => 'Lastschrift', 'ueberweisung' => 'Ãœberweisung', - 'paypal' => 'Paypal / Kreditkarte', + 'paypal.0' => 'Paypal / Kreditkarte', 'bankinfo.1' => 'Um für den SUMA-EV unseren Trägerverein zu spenden, brauchen Sie nur eine Ãœberweisung auf folgendes Konto zu tätigen:', @@ -46,7 +46,7 @@ return [ 'lastschrift.5' => 'Ihre Telefonnummer, um Ihre Spende ggf. durch einen Rückruf zu verifizieren:', 'lastschrift.6' => 'Ihre IBAN:', 'lastschrift.7' => 'Ihre BIC (Nur notwendig für Transaktionen aus dem EU Ausland):', - 'lastschrift.8.message' => 'Hier können Sie uns ggf. noch eine Mitteilung dazu senden:', + 'lastschrift.8.message.label' => 'Hier können Sie uns ggf. noch eine Mitteilung dazu senden:', 'lastschrift.8.message.placeholder' => 'Weitere Angaben', 'lastschrift.10' => 'Ihre Daten werden über eine verschlüsselte Verbindung zu uns übertragen und können von Dritten nicht mitgelesen werden. SUMA-EV verwendet Ihre Daten ausschließlich für die Spendenabrechnung; Ihre Daten werden nicht weitergegeben. Spenden an den SUMA-EV sind steuerlich absetzbar, da der Verein vom Finanzamt Hannover Nord als gemeinnützig anerkannt ist, eingetragen in das Vereinsregister beim Amtsgericht Hannover unter VR200033.', 'lastschrift.private' => 'Privatperson:', diff --git a/metager/lang/en/spende.php b/metager/lang/en/spende.php index 9665c4ac5..c431e3234 100644 --- a/metager/lang/en/spende.php +++ b/metager/lang/en/spende.php @@ -10,6 +10,7 @@ return [ ], 'wunschbetrag' => [ 'placeholder' => 'Amount in €', + 'label' => 'Custom amount', ], 'frequency' => [ 'once' => 'Once', @@ -22,9 +23,6 @@ return [ 'lastschrift' => 'Sepa direct debit', ], 'ueberweisung' => 'Bank transfer', - 'paypal' => [ - 1 => 'You will be redirected where you can finalize your donation.', - ], 'bankinfo' => [ 1 => 'By bank transfer', 2 => [ @@ -58,12 +56,17 @@ your E-Mail adress on the money transfer form.', 8 => [ 'message' => [ 'placeholder' => 'Message', + 'label' => 'Here you can informally add a message to your donation:', ], ], 10 => 'Your information is transmitted encrypted and is not read by a third party. SUMA-EV only uses your information for accounting; Your information is not passed on. Donations to the SUMA-EV are tax-deductible, because the association is recognized as charitable by the Finanzamt Hannover Nord (revenue board), listed in the register of associations, Amtsgericht Hannover under VR200033. A certificate for single donations above 300,-EUR is sent automatically (post address is required!). For donations below 300,-EUR an account current is enough for tax-deduction.', 'private' => '*As a Person:', 'company' => '*As a Business:', ], + 'paypal' => [ + 1 => 'You will be redirected where you can finalize your donation.', + 0 => 'Paypal / Credit Card', + ], 'submit' => 'Donate', 'member' => [ 1 => 'Or rather become a member?', diff --git a/metager/lang/es/spende.php b/metager/lang/es/spende.php index 36940dd9a..c9be58dc0 100644 --- a/metager/lang/es/spende.php +++ b/metager/lang/es/spende.php @@ -11,6 +11,7 @@ return [ ], 'wunschbetrag' => [ 'placeholder' => 'Importe en €', + 'label' => 'Cantidad deseada', ], 'frequency' => [ 'once' => 'Única vez', @@ -23,9 +24,6 @@ return [ 'lastschrift' => 'Domiciliación bancaria', ], 'ueberweisung' => 'Transferencia bancaria', - 'paypal' => [ - 1 => 'Con un clic en donar, será redirigido a PayPal.', - ], 'bankinfo' => [ 1 => 'Para donar a nuestra asociación patrocinadora SUMA-EV, solo necesita hacer una transferencia a la siguiente cuenta:', 2 => [ @@ -45,10 +43,15 @@ return [ 8 => [ 'message' => [ 'placeholder' => 'Más información', + 'label' => 'Aquà puede enviarnos un mensaje adicional si lo desea:', ], ], 10 => 'Sus datos se nos transmiten a través de una conexión cifrada y no pueden ser leÃdos por terceros. SUMA-EV utiliza sus datos exclusivamente para la liquidación de donaciones; Nunca compartiremos sus datos. Las donaciones al SUMA-EV son deducibles de impuestos, ya que es una asociación sin fines de lucro y está reconocida como tal por la Oficina de Impuestos del Norte de Hanover e inscrita en el registro de asociaciones en el Tribunal de Distrito de Hanover bajo VR200033.', ], + 'paypal' => [ + 1 => 'Con un clic en donar, será redirigido a PayPal.', + 0 => 'Paypal / tarjeta de crédito', + ], 'submit' => 'Donar', 'member' => [ 1 => '¿O prefiere hacerse socio?', diff --git a/metager/resources/views/spende/spende.blade.php b/metager/resources/views/spende/spende.blade.php index c8d8af099..2437b4ea1 100644 --- a/metager/resources/views/spende/spende.blade.php +++ b/metager/resources/views/spende/spende.blade.php @@ -22,7 +22,7 @@ <div id="payment-methods"> <a class="payment-label" href="?method=debit">{!! trans('spende.head.lastschrift') !!}</a> <a class="payment-label" href="?method=bank-transfer">{!! trans('spende.ueberweisung') !!}</a> - <a class="payment-label payment-label-selected" href="?method=paypal">{!! trans('spende.paypal') !!}</a> + <a class="payment-label payment-label-selected" href="?method=paypal">{!! trans('spende.paypal.0') !!}</a> </div> <p><br>{!! trans('spende.paypal.1') !!}</p> <div class="center-wrapper"> @@ -48,7 +48,7 @@ <div id="payment-methods"> <a class="payment-label" href="?method=debit">{!! trans('spende.head.lastschrift') !!}</a> <a class="payment-label payment-label-selected" href="?method=bank-transfer">{!! trans('spende.ueberweisung') !!}</a> - <a class="payment-label" href="?method=paypal">{!! trans('spende.paypal') !!}</a> + <a class="payment-label" href="?method=paypal">{!! trans('spende.paypal.0') !!}</a> </div> <p> <br>{!! trans('spende.bankinfo.1') !!} <br> @@ -73,7 +73,7 @@ <nobr>{!! trans('spende.ueberweisung') !!}</nobr> </a> <a class="payment-label" href="?method=paypal"> - <nobr>{!! trans('spende.paypal') !!}</nobr> + <nobr>{!! trans('spende.paypal.0') !!}</nobr> </a> </div> <p id="lastschrift-info">@lang('spende.lastschrift.info')</p> @@ -91,7 +91,7 @@ <input type="radio" value="300" class="amount-radio" name="amount" id="amount-300euro" required="required" @if(!empty($data) && $data["betrag"]==="300" )checked="checked" @endif><label for="amount-300euro" class="amount-label">300€</label> </div> <div class="custom-amount-container"> - <input type="radio" name="amount" id="amount-custom" value="custom" required="required" @if(!empty($data) && $data["betrag"]==="custom" )checked="checked" @endif><label for="amount-custom" class="amount-custom">{!! trans('spende.wunschbetrag') !!}</label> <input id="custom-amount" type="number" name="custom-amount" min="0" step=".01" placeholder="@lang('spende.wunschbetrag.placeholder')" value=""> + <input type="radio" name="amount" id="amount-custom" value="custom" required="required" @if(!empty($data) && $data["betrag"]==="custom" )checked="checked" @endif><label for="amount-custom" class="amount-custom">{!! trans('spende.wunschbetrag.label') !!}</label> <input id="custom-amount" type="number" name="custom-amount" min="0" step=".01" placeholder="@lang('spende.wunschbetrag.placeholder')" value=""> </div> <h3>{!! trans('spende.headline.4') !!}</h3> <div id="frequency"> @@ -141,7 +141,7 @@ <input type="text" class="form-control" id="bic" name="bic" placeholder="BIC" @if(isset($data['bic'])) value="{{$data['bic']}}" @endif> </div> <div class="form-group donation-form-group"> - <label for="msg">{!! trans('spende.lastschrift.8.message')!!}</label> + <label for="msg">{!! trans('spende.lastschrift.8.message.label')!!}</label> <p>{!! trans('spende.bankinfo.3')!!}</p> <textarea class="form-control" id="msg" name="Nachricht" placeholder="{!! trans('spende.lastschrift.8.message.placeholder') !!}">@if(isset($data['nachricht'])){{$data['nachricht']}}@endif</textarea> </div> diff --git a/metager/tests/Browser/Pages/Spende.php b/metager/tests/Browser/Pages/Spende.php index 081a455dd..a01dd2406 100644 --- a/metager/tests/Browser/Pages/Spende.php +++ b/metager/tests/Browser/Pages/Spende.php @@ -3,6 +3,8 @@ namespace Tests\Browser\Pages; use Laravel\Dusk\Browser; +use Laravel\Dusk\Page; +use LaravelLocalization; class Spende extends Page { @@ -11,9 +13,9 @@ class Spende extends Page * * @return string */ - public function url() + public function url($locale = null) { - return '/spende'; + return LaravelLocalization::getLocalizedUrl($locale, "/spende"); } /** @@ -24,16 +26,14 @@ class Spende extends Page */ public function assert(Browser $browser) { - $browser->assertPathIs($this->url()) - ->waitForText("Ihre Spende") - ->assertTitle("Spenden - MetaGer") - ->switchLanguage("English") - ->waitForText("Your Donation") - ->assertTitle("Donation - MetaGer") - ->switchLanguage("Español") - ->waitForText("Su donación") - ->assertTitle("Donaciones - MetaGer") - ->switchLanguage("Deutsch"); + foreach (LaravelLocalization::getSupportedLocales() as $locale => $locale_data) { + $url = $this->url($locale); + $lang = \preg_replace("/^([a-zA-Z]+)-.*/", "$1", $locale); + + $browser->visit($url) + ->waitForText(trans("spende.headline.1", [], $lang)) + ->assertTitle(trans("titles.spende", [], $lang)); + } } /** diff --git a/metager/tests/Browser/StaticPagesTest.php b/metager/tests/Browser/StaticPagesTest.php index 890c76fb6..22ce388d4 100644 --- a/metager/tests/Browser/StaticPagesTest.php +++ b/metager/tests/Browser/StaticPagesTest.php @@ -120,7 +120,7 @@ class StaticPagesTest extends DuskTestCase ->on(new Plugin); }); } - /* + public function testSpenden() { //Spenden @@ -133,7 +133,7 @@ class StaticPagesTest extends DuskTestCase ->on(new Spende); }); } - + /* public function testTeam() { // Team -- GitLab