Merge pull request #6274 from beganovich/v5-588-tests

(v5) Required fields check browser test
This commit is contained in:
Benjamin Beganović 2021-07-15 10:38:27 +02:00 committed by GitHub
commit 9baf394173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 1 deletions

View File

@ -7,7 +7,8 @@
- Client portal: Hide "Pay now" buttons if no gateways are configured
## Fixed:
- Client portal: Showing message instead of blank page when trying to download zero quotes.
- Client portal: Showing message instead of blank page when trying to download zero quotes
- Client portal: Fixed bug with payment gateways after checking for required fields
## [v5.2.0-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.2.0-release)
## Added:

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');
});
}
}