Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/PaymentStripeTest.php
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | public function testPayment(): void | ||||
->submitValidCreditCard(); | ->submitValidCreditCard(); | ||||
// Now it should redirect back to wallet page and in background | // Now it should redirect back to wallet page and in background | ||||
// use the webhook to update payment status (and balance). | // use the webhook to update payment status (and balance). | ||||
// Looks like in test-mode the webhook is executed before redirect | // Looks like in test-mode the webhook is executed before redirect | ||||
// so we can expect balance updated on the wallet page | // so we can expect balance updated on the wallet page | ||||
$browser->waitForLocation('/wallet', 15) // need more time than default 5 sec. | $browser->waitForLocation('/wallet', 30) // need more time than default 5 sec. | ||||
->on(new WalletPage()) | ->on(new WalletPage()) | ||||
->assertSeeIn('@main .card-text', 'Current account balance is 12,34 CHF'); | ->assertSeeIn('@main .card-text', 'Current account balance is 12,34 CHF'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test the auto-payment setup process | * Test the auto-payment setup process | ||||
* | * | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | public function testAutoPaymentSetup(): void | ||||
->type('@body #mandate_balance', '0') | ->type('@body #mandate_balance', '0') | ||||
->click('@button-action'); | ->click('@button-action'); | ||||
}) | }) | ||||
->on(new PaymentStripe()) | ->on(new PaymentStripe()) | ||||
->assertMissing('@title') | ->assertMissing('@title') | ||||
->assertMissing('@amount') | ->assertMissing('@amount') | ||||
->assertValue('@email-input', $user->email) | ->assertValue('@email-input', $user->email) | ||||
->submitValidCreditCard() | ->submitValidCreditCard() | ||||
->waitForLocation('/wallet', 15) // need more time than default 5 sec. | ->waitForLocation('/wallet', 30) // need more time than default 5 sec. | ||||
->visit('/wallet?paymentProvider=stripe') | ->visit('/wallet?paymentProvider=stripe') | ||||
->on(new WalletPage()) | ->on(new WalletPage()) | ||||
->click('@main button') | ->click('@main button') | ||||
->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ||||
$expected = 'Auto-payment is set to fill up your account by 100 CHF every' | $expected = 'Auto-payment is set to fill up your account by 100 CHF every' | ||||
. ' time your account balance gets under 0 CHF. You will be charged' | . ' time your account balance gets under 0 CHF. You will be charged' | ||||
. ' via Visa (**** **** **** 4242).'; | . ' via Visa (**** **** **** 4242).'; | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |