Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/PaymentMollieTest.php
<?php | <?php | ||||
namespace Tests\Browser; | namespace Tests\Browser; | ||||
use App\Providers\PaymentProvider; | use App\Payment; | ||||
use App\Wallet; | use App\Wallet; | ||||
use Tests\Browser; | use Tests\Browser; | ||||
use Tests\Browser\Components\Dialog; | use Tests\Browser\Components\Dialog; | ||||
use Tests\Browser\Components\Toast; | use Tests\Browser\Components\Toast; | ||||
use Tests\Browser\Pages\Dashboard; | use Tests\Browser\Pages\Dashboard; | ||||
use Tests\Browser\Pages\Home; | use Tests\Browser\Pages\Home; | ||||
use Tests\Browser\Pages\PaymentMollie; | use Tests\Browser\Pages\PaymentMollie; | ||||
use Tests\Browser\Pages\Wallet as WalletPage; | use Tests\Browser\Pages\Wallet as WalletPage; | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | public function testAutoPaymentSetup(): void | ||||
->waitFor('#payment-method-selection .link-creditcard svg') | ->waitFor('#payment-method-selection .link-creditcard svg') | ||||
->assertMissing('#payment-method-selection .link-paypal') | ->assertMissing('#payment-method-selection .link-paypal') | ||||
->assertMissing('#payment-method-selection .link-banktransfer') | ->assertMissing('#payment-method-selection .link-banktransfer') | ||||
->click('#payment-method-selection .link-creditcard'); | ->click('#payment-method-selection .link-creditcard'); | ||||
}) | }) | ||||
->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ||||
$browser->assertSeeIn('@title', 'Set up auto-payment') | $browser->assertSeeIn('@title', 'Set up auto-payment') | ||||
->assertSeeIn('@body label[for="mandate_amount"]', 'Fill up by') | ->assertSeeIn('@body label[for="mandate_amount"]', 'Fill up by') | ||||
->assertValue('@body #mandate_amount', PaymentProvider::MIN_AMOUNT / 100) | ->assertValue('@body #mandate_amount', Payment::MIN_AMOUNT / 100) | ||||
->assertSeeIn('@body label[for="mandate_balance"]', 'when account balance is below') // phpcs:ignore | ->assertSeeIn('@body label[for="mandate_balance"]', 'when account balance is below') // phpcs:ignore | ||||
->assertValue('@body #mandate_balance', '0') | ->assertValue('@body #mandate_balance', '0') | ||||
->assertSeeIn('@button-cancel', 'Cancel') | ->assertSeeIn('@button-cancel', 'Cancel') | ||||
->assertSeeIn('@button-action', 'Continue') | ->assertSeeIn('@button-action', 'Continue') | ||||
// Test error handling | // Test error handling | ||||
->type('@body #mandate_amount', 'aaa') | ->type('@body #mandate_amount', 'aaa') | ||||
->type('@body #mandate_balance', '-1') | ->type('@body #mandate_balance', '-1') | ||||
->click('@button-action') | ->click('@button-action') | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |