driver->manage()->deleteAllCookies(); } $this->browse(function (Browser $browser) { $browser ->visit(new Login()) ->auth(); }); $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); $fees_and_limits = $cg->fees_and_limits; $fees_and_limits->{GatewayType::CREDIT_CARD} = new FeesAndLimits(); $cg->fees_and_limits = $fees_and_limits; $cg->save(); } public function testPaymentWithNewCard() { $this->browse(function (Browser $browser) { $browser ->visitRoute('client.invoices.index') ->click('@pay-now') ->click('@pay-now-dropdown') ->click('@pay-with-1') ->type('#cardholder-name', 'John Doe') ->withinFrame('iframe', function (Browser $browser) { $browser ->type('cardnumber', '4242 4242 4242 4242') ->type('exp-date', '04/22') ->type('cvc', '242'); }) ->click('#pay-now') ->waitForText('Details of the payment'); }); } public function testPayWithNewCardAndSaveForFutureUse() { $this->browse(function (Browser $browser) { $browser ->visitRoute('client.invoices.index') ->click('@pay-now') ->click('@pay-now-dropdown') ->click('@pay-with-1') ->type('#cardholder-name', 'John Doe') ->withinFrame('iframe', function (Browser $browser) { $browser ->type('cardnumber', '4242 4242 4242 4242') ->type('exp-date', '04/22') ->type('cvc', '242'); }) ->radio('#proxy_is_default', true) ->click('#pay-now') ->waitForText('Details of the payment') ->visitRoute('client.payment_methods.index') ->clickLink('View') ->assertSee('4242'); }); } public function testPayWithSavedCreditCard() { $this->browse(function (Browser $browser) { $browser ->visitRoute('client.invoices.index') ->click('@pay-now') ->click('@pay-now-dropdown') ->click('@pay-with-1') ->click('.toggle-payment-with-token') ->click('#pay-now') ->waitForText('Details of the payment'); }); } }