1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Required fields check browser test

This commit is contained in:
Benjamin Beganović 2021-07-15 10:36:50 +02:00
parent 3e62c2a6b5
commit 6638cf44e8

View File

@ -12,6 +12,8 @@
namespace Tests\Browser\ClientPortal;
use App\Models\Client;
use App\Models\CompanyGateway;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\ClientPortal\Login;
use Tests\DuskTestCase;
@ -42,4 +44,37 @@ class PaymentsTest extends DuskTestCase
->visitRoute('client.logout');
});
}
public function testRequiredFieldsCheck()
{
$this->disableCompanyGateways();
// Enable Stripe.
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
// Stripe requires post code.
Client::first()->update(['postal_code' => null]);
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.invoices.index')
->click('@pay-now')
->press('Pay Now')
->clickLink('Credit Card')
->assertSee('Postal Code')
->type('client_postal_code', 10000)
->press('Continue')
->pause(2000)
->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', 60)
->visitRoute('client.logout');
});
}
}