Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Reseller/PaymentMollieTest.php
Show All 23 Lines | public function setUp(): void | ||||
self::useResellerUrl(); | self::useResellerUrl(); | ||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
$user = $this->getTestUser('reseller@kolabnow.com'); | $user = $this->getTestUser('reseller@' . \config('app.domain')); | ||||
$wallet = $user->wallets()->first(); | $wallet = $user->wallets()->first(); | ||||
$wallet->payments()->delete(); | $wallet->payments()->delete(); | ||||
$wallet->balance = 0; | $wallet->balance = 0; | ||||
$wallet->save(); | $wallet->save(); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test the payment process | * Test the payment process | ||||
* | * | ||||
* @group mollie | * @group mollie | ||||
*/ | */ | ||||
public function testPayment(): void | public function testPayment(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$user = $this->getTestUser('reseller@kolabnow.com'); | $user = $this->getTestUser('reseller@' . \config('app.domain')); | ||||
$wallet = $user->wallets()->first(); | $wallet = $user->wallets()->first(); | ||||
$wallet->payments()->delete(); | $wallet->payments()->delete(); | ||||
$wallet->balance = 0; | $wallet->balance = 0; | ||||
$wallet->save(); | $wallet->save(); | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon($user->email, 'reseller', true, ['paymentProvider' => 'mollie']) | ->submitLogon($user->email, \App\Utils::generatePassphrase(), true, ['paymentProvider' => 'mollie']) | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->click('@links .link-wallet') | ->click('@links .link-wallet') | ||||
->on(new WalletPage()) | ->on(new WalletPage()) | ||||
->assertSeeIn('@main button', 'Add credit') | ->assertSeeIn('@main button', 'Add credit') | ||||
->click('@main button') | ->click('@main button') | ||||
->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ||||
$browser->assertSeeIn('@title', 'Top up your wallet') | $browser->assertSeeIn('@title', 'Top up your wallet') | ||||
->waitFor('#payment-method-selection #creditcard') | ->waitFor('#payment-method-selection #creditcard') | ||||
->waitFor('#payment-method-selection #paypal') | ->waitFor('#payment-method-selection #paypal') | ||||
->assertMissing('#payment-method-selection #banktransfer') | ->waitFor('#payment-method-selection #banktransfer') | ||||
->click('#creditcard'); | ->click('#creditcard'); | ||||
}) | }) | ||||
->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ->with(new Dialog('@payment-dialog'), function (Browser $browser) { | ||||
$browser->assertSeeIn('@title', 'Top up your wallet') | $browser->assertSeeIn('@title', 'Top up your wallet') | ||||
->assertFocused('#amount') | ->assertFocused('#amount') | ||||
->assertSeeIn('@button-cancel', 'Cancel') | ->assertSeeIn('@button-cancel', 'Cancel') | ||||
->assertSeeIn('@button-action', 'Continue') | ->assertSeeIn('@button-action', 'Continue') | ||||
// Test error handling | // Test error handling | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |