mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Clean up and security improvements
This commit is contained in:
parent
116f7df015
commit
8ca3be5008
@ -42,6 +42,8 @@ trait MakesInvoiceHtml
|
|||||||
{
|
{
|
||||||
$data['__env'] = app(Factory::class);
|
$data['__env'] = app(Factory::class);
|
||||||
|
|
||||||
|
return Blade::render($string, $data); //potential fix for removing eval()
|
||||||
|
|
||||||
$php = Blade::compileString($string);
|
$php = Blade::compileString($string);
|
||||||
|
|
||||||
$obLevel = ob_get_level();
|
$obLevel = ob_get_level();
|
||||||
|
@ -106,7 +106,6 @@
|
|||||||
"filp/whoops": "^2.7",
|
"filp/whoops": "^2.7",
|
||||||
"friendsofphp/php-cs-fixer": "^3.14",
|
"friendsofphp/php-cs-fixer": "^3.14",
|
||||||
"laracasts/cypress": "^3.0",
|
"laracasts/cypress": "^3.0",
|
||||||
"laravel/dusk": "^6.15",
|
|
||||||
"mockery/mockery": "^1.4.4",
|
"mockery/mockery": "^1.4.4",
|
||||||
"nunomaduro/collision": "^6.1",
|
"nunomaduro/collision": "^6.1",
|
||||||
"nunomaduro/larastan": "^2.0",
|
"nunomaduro/larastan": "^2.0",
|
||||||
|
64
dusk.sh
64
dusk.sh
@ -1,64 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
n=1
|
|
||||||
TYPE=${!n}
|
|
||||||
|
|
||||||
if [ -z "$TYPE" ]; then
|
|
||||||
TYPE="all"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$ RUNNING: '$TYPE'"
|
|
||||||
|
|
||||||
echo "$ php artisan optimize"
|
|
||||||
php artisan optimize
|
|
||||||
|
|
||||||
echo "=========================================="
|
|
||||||
|
|
||||||
GENERIC_TESTS=`find tests/Browser/ClientPortal/ -maxdepth 1 -type f -name '*.php'`
|
|
||||||
|
|
||||||
if [ $TYPE == 'gateways' ]; then
|
|
||||||
GENERIC_TESTS=""
|
|
||||||
|
|
||||||
echo "$ Skippping generic tests."
|
|
||||||
echo "=========================================="
|
|
||||||
fi
|
|
||||||
|
|
||||||
for TEST_CLASS in $GENERIC_TESTS; do
|
|
||||||
echo "Test class: $TEST_CLASS"
|
|
||||||
|
|
||||||
echo "$ php artisan migrate:fresh --seed"
|
|
||||||
php artisan migrate:fresh --seed &> /dev/null
|
|
||||||
|
|
||||||
echo "$ php artisan ninja:create-single-account"
|
|
||||||
php artisan ninja:create-single-account &> /dev/null
|
|
||||||
|
|
||||||
echo "$ php artisan dusk $TEST_CLASS"
|
|
||||||
php -d memory_limit=1G artisan dusk ${@:2} --stop-on-error --stop-on-failure $TEST_CLASS || exit 1
|
|
||||||
|
|
||||||
echo "=========================================="
|
|
||||||
done || exit 1
|
|
||||||
|
|
||||||
GATEWAY_TESTS=`find tests/Browser/ClientPortal/Gateways/ -type f -name '*.php'`
|
|
||||||
|
|
||||||
if [ $TYPE == 'generic' ]; then
|
|
||||||
GATEWAY_TESTS=""
|
|
||||||
|
|
||||||
echo "$ Skippping gateway tests."
|
|
||||||
echo "=========================================="
|
|
||||||
fi
|
|
||||||
|
|
||||||
for TEST_CLASS in $GATEWAY_TESTS; do
|
|
||||||
echo "Test class: $TEST_CLASS"
|
|
||||||
|
|
||||||
echo "$ php artisan migrate:fresh --seed"
|
|
||||||
php artisan migrate:fresh --seed &> /dev/null
|
|
||||||
|
|
||||||
echo "$ php artisan ninja:create-single-account"
|
|
||||||
php artisan ninja:create-single-account &> /dev/null
|
|
||||||
|
|
||||||
echo "$ php artisan dusk $TEST_CLASS"
|
|
||||||
php -d memory_limit=1G artisan dusk ${@:2} --stop-on-error --stop-on-failure $TEST_CLASS || exit 1
|
|
||||||
|
|
||||||
echo "=========================================="
|
|
||||||
done || exit 1
|
|
||||||
|
|
||||||
echo 'All tests completed successfully.'
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditsTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.credits.index')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Credits')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class DocumentsTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.documents.index')
|
|
||||||
->assertSee('Documents')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,127 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\AuthorizeNet;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
if (getenv('GITHUB_ACTIONS')) {
|
|
||||||
$this->markTestSkipped('Skipping Authorize.net (GitHub Actions)');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '3b6621f970ab18887c4f6dca78d3f8bb')->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->type('card-number', '4007000000027')
|
|
||||||
->type('card-holders-name', 'John Doe')
|
|
||||||
->type('.expiry', '12/28')
|
|
||||||
->type('cvc', '100')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCardAndSaveForFutureUse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->type('card-number', '4007000000027')
|
|
||||||
->type('card-holders-name', 'John Doe')
|
|
||||||
->type('.expiry', '12/28')
|
|
||||||
->type('cvc', '100')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60)
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->assertSee('0027');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithSavedCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingCreditCardStandalone()
|
|
||||||
{
|
|
||||||
$this->markTestIncomplete("E00117 OTS Service Error 'Field validation error.'");
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->type('card-number', '4012888818888')
|
|
||||||
->type('card-holders-name', 'John Doe')
|
|
||||||
->type('.expiry', '12/28')
|
|
||||||
->type('cvc', '900')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText('0027', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Braintree;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class ACHTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', 'f7ec488676d310683fb51802d076d713')->restore();
|
|
||||||
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'f7ec488676d310683fb51802d076d713')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::BANK_TRANSFER} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$company = Company::first();
|
|
||||||
$settings = $company->settings;
|
|
||||||
|
|
||||||
$settings->client_portal_allow_under_payment = true;
|
|
||||||
$settings->client_portal_allow_over_payment = true;
|
|
||||||
|
|
||||||
$company->settings = $settings;
|
|
||||||
$company->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingBankAccount()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Bank Account')
|
|
||||||
->type('#account-holder-name', 'John Doe')
|
|
||||||
->type('#account-number', '1000000000')
|
|
||||||
->type('#routing-number', '011000015')
|
|
||||||
->type('#billing-postal-code', '12345')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText('Added payment method.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithExistingACH()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bank Transfer')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveACHAccount()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,145 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Braintree;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', 'f7ec488676d310683fb51802d076d713')->restore();
|
|
||||||
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'f7ec488676d310683fb51802d076d713')->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();
|
|
||||||
|
|
||||||
$company = Company::first();
|
|
||||||
$settings = $company->settings;
|
|
||||||
|
|
||||||
$settings->client_portal_allow_under_payment = true;
|
|
||||||
$settings->client_portal_allow_over_payment = true;
|
|
||||||
|
|
||||||
$company->settings = $settings;
|
|
||||||
$company->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->type('@underpayment-input', '100')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->waitFor('#braintree-hosted-field-number', 60)
|
|
||||||
->withinFrame('#braintree-hosted-field-number', function (Browser $browser) {
|
|
||||||
$browser->type('credit-card-number', '4111111111111111');
|
|
||||||
})
|
|
||||||
->withinFrame('#braintree-hosted-field-expirationDate', function (Browser $browser) {
|
|
||||||
$browser->type('expiration', '04/25');
|
|
||||||
})
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCardAndSaveForFuture()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->type('@underpayment-input', '100')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->waitFor('#braintree-hosted-field-number', 60)
|
|
||||||
->withinFrame('#braintree-hosted-field-number', function (Browser $browser) {
|
|
||||||
$browser->typeSlowly('credit-card-number', '4005519200000004');
|
|
||||||
})
|
|
||||||
->withinFrame('#braintree-hosted-field-expirationDate', function (Browser $browser) {
|
|
||||||
$browser->typeSlowly('expiration', '04/25');
|
|
||||||
})
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60)
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->assertSee('0004');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithSavedCard()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Works in "real" browser, otherwise giving error code 0.');
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->type('@underpayment-input', '100')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->click('#pay-now-with-token')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingPaymentMethodShouldntBePossible()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->assertSee('This payment method can be can saved for future use, once you complete your first transaction. Don\'t forget to check "Store credit card details" during payment process.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Braintree;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class PayPalTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', 'f7ec488676d310683fb51802d076d713')->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testOffsitePayment()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Sometimes after redirect PayPal shows the register-like page with credit card, sometimes is login page.');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,127 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\CheckoutCom;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '3758e7f7c6f4cecf0f4f348b9a00f456')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('cardnumber', '4242424242424242')
|
|
||||||
->type('exp-date', '04/22')
|
|
||||||
->type('cvc', '100');
|
|
||||||
})
|
|
||||||
->press('#pay-button')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCardAndSaveForFutureUse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('cardnumber', '4242424242424242')
|
|
||||||
->type('exp-date', '04/22')
|
|
||||||
->type('cvc', '100');
|
|
||||||
})
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->press('#pay-button')
|
|
||||||
->waitForText('Details of the payment', 60)
|
|
||||||
->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')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->click('#pay-now-with-token')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingCreditCardStandalone()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('cardnumber', '4242424242424242')
|
|
||||||
->type('exp-date', '04/22')
|
|
||||||
->type('cvc', '100');
|
|
||||||
})
|
|
||||||
->press('#pay-button')
|
|
||||||
->waitForText('Details of payment method', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Eway;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPaymentWithNewCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('EWAY_CARDNAME', 'Invoice Ninja')
|
|
||||||
->type('EWAY_CARDNUMBER', '4111 1111 1111 1111')
|
|
||||||
->type('EWAY_CARDEXPIRY', '04/22')
|
|
||||||
->type('EWAY_CARDCVN', '100');
|
|
||||||
})
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCardAndSaveForFutureUse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('EWAY_CARDNAME', 'Invoice Ninja')
|
|
||||||
->type('EWAY_CARDNUMBER', '4111 1111 1111 1111')
|
|
||||||
->type('EWAY_CARDEXPIRY', '04/22')
|
|
||||||
->type('EWAY_CARDCVN', '100');
|
|
||||||
})
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60)
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->assertSee('1111');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithSavedCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingCreditCardStandalone()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('EWAY_CARDNAME', 'Invoice Ninja')
|
|
||||||
->type('EWAY_CARDNUMBER', '4111 1111 1111 1111')
|
|
||||||
->type('EWAY_CARDEXPIRY', '04/22')
|
|
||||||
->type('EWAY_CARDCVN', '100');
|
|
||||||
})
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText('**** 1111');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\GoCardless;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class ACHTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', 'b9886f9257f0c6ee7c302f1c74475f6c')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithNoPreauthorizedIsntPossible()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bank Transfer')
|
|
||||||
->assertSee('To pay with a bank account, first you have to add it as payment method.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\GoCardless;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class DirectDebitTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', 'b9886f9257f0c6ee7c302f1c74475f6c')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithNoPreauthorizedIsntPossible()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Direct Debit')
|
|
||||||
->assertSee('To pay with a bank account, first you have to add it as payment method.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\GoCardless;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class SEPATest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', 'b9886f9257f0c6ee7c302f1c74475f6c')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithNoPreauthorizedIsntPossible()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('SEPA Direct Debit')
|
|
||||||
->assertSee('To pay with a bank account, first you have to add it as payment method.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Mollie;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class BancontactTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '1bd651fb213ca0c9d66ae3c336dc77e8')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSuccessfulPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bancontact')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->radio('final_state', 'paid')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Details of the payment')
|
|
||||||
->assertSee('Completed');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testOpenPayments(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bancontact')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->radio('final_state', 'open')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Details of the payment')
|
|
||||||
->assertSee('Pending');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFailedPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bancontact')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->radio('final_state', 'failed')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Failed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCancelledTest(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bancontact')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->radio('final_state', 'canceled')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Cancelled.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Mollie;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class BankTransferTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '1bd651fb213ca0c9d66ae3c336dc77e8')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSuccessfulPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bank Transfer')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->radio('final_state', 'paid')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Details of the payment')
|
|
||||||
->assertSee('Completed');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPendingPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bank Transfer')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->radio('final_state', 'open')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Details of the payment')
|
|
||||||
->assertSee('Pending');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,134 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Mollie;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '1bd651fb213ca0c9d66ae3c336dc77e8')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->pause(5000)
|
|
||||||
->withinFrame('iframe[name=cardNumber-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#cardNumber', '4242424242424242');
|
|
||||||
})
|
|
||||||
->withinFrame('iframe[name=cardHolder-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#cardHolder', 'Invoice Ninja Test Suite');
|
|
||||||
})
|
|
||||||
->withinFrame('iframe[name=expiryDate-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#expiryDate', '12/29');
|
|
||||||
})
|
|
||||||
->withinFrame('iframe[name=verificationCode-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#verificationCode', '100');
|
|
||||||
})
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCreditCardAndSaveForFutureUse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->pause(5000)
|
|
||||||
->withinFrame('iframe[name=cardNumber-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#cardNumber', '4242424242424242');
|
|
||||||
})
|
|
||||||
->withinFrame('iframe[name=cardHolder-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#cardHolder', 'Invoice Ninja Test Suite');
|
|
||||||
})
|
|
||||||
->withinFrame('iframe[name=expiryDate-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#expiryDate', '12/29');
|
|
||||||
})
|
|
||||||
->withinFrame('iframe[name=verificationCode-input]', function (Browser $browser) {
|
|
||||||
$browser->type('#verificationCode', '100');
|
|
||||||
})
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60)
|
|
||||||
->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')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingPaymentMethodShouldntBePossible()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->assertSee('This payment method can be can saved for future use, once you complete your first transaction. Don\'t forget to check "Store credit card details" during payment process.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Mollie;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class IDEALTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '1bd651fb213ca0c9d66ae3c336dc77e8')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSuccessfulPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('iDEAL')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->press('ABN AMRO')
|
|
||||||
->radio('final_state', 'paid')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Details of the payment')
|
|
||||||
->assertSee('Completed');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testOpenPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('iDEAL')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->press('ABN AMRO')
|
|
||||||
->radio('final_state', 'open')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Details of the payment')
|
|
||||||
->assertSee('Pending');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFailedPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('iDEAL')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->press('ABN AMRO')
|
|
||||||
->radio('final_state', 'failed')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Failed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCancelledPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('iDEAL')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->press('ABN AMRO')
|
|
||||||
->radio('final_state', 'canceled')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Cancelled.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Mollie;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class KBCTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '1bd651fb213ca0c9d66ae3c336dc77e8')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSuccessfulPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Undefined.')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->press('CBC')
|
|
||||||
->radio('final_state', 'paid')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Details of the payment')
|
|
||||||
->assertSee('Completed');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFailedPayment(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Undefined.')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->press('CBC')
|
|
||||||
->radio('final_state', 'failed')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Failed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCancelledTest(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Undefined.')
|
|
||||||
->waitForText('Test profile')
|
|
||||||
->press('CBC')
|
|
||||||
->radio('final_state', 'canceled')
|
|
||||||
->press('Continue')
|
|
||||||
->waitForText('Cancelled.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\PayPal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class PayPalTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testOffsitePayment()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Sometimes after redirect PayPal shows the register-like page with credit card, sometimes is login page.');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\PayTrace;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', 'bbd736b3254b0aabed6ad7fda1298c88')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithNewCreditCard()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Credit card not supported.');
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('CC', '4012000098765439')
|
|
||||||
->select('EXP_MM', '12')
|
|
||||||
->select('EXP_YY', '30')
|
|
||||||
->type('SEC', '999');
|
|
||||||
})
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Square;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPaymentWithNewCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->type('#cardholder-name', 'John Doe')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('#cardNumber', '4111 1111 1111 1111')
|
|
||||||
->type('#expirationDate', '04/22')
|
|
||||||
->type('#cvv', '1111')
|
|
||||||
->type('#postalCode', '12345');
|
|
||||||
})
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCardAndSaveForFutureUse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->type('#cardholder-name', 'John Doe')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('#cardNumber', '4111 1111 1111 1111')
|
|
||||||
->type('#expirationDate', '04/22')
|
|
||||||
->type('#cvv', '1111')
|
|
||||||
->type('#postalCode', '12345');
|
|
||||||
})
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60)
|
|
||||||
->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')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingCreditCardStandalone()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->type('#cardholder-name', 'John Doe')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->type('#cardNumber', '4111 1111 1111 1111')
|
|
||||||
->type('#expirationDate', '04/22')
|
|
||||||
->type('#cvv', '1111')
|
|
||||||
->type('#postalCode', '12345');
|
|
||||||
})
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText('**** 1111');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class ACHTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable ACH.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::BANK_TRANSFER} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
// ACH required US to be billing country.
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 840;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingACHAccountAndVerifyingIt()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Bank Account')
|
|
||||||
->type('#account-holder-name', 'John Doe')
|
|
||||||
->select('#country', 'US')
|
|
||||||
->select('#currency', 'USD')
|
|
||||||
->type('#routing-number', '110000000')
|
|
||||||
->type('#account-number', '000123456789')
|
|
||||||
->check('#accept-terms')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText('ACH (Verification)', 60)
|
|
||||||
->type('@verification-1st', '32')
|
|
||||||
->type('@verification-2nd', '45')
|
|
||||||
->press('Complete Verification')
|
|
||||||
->assertSee('Verification completed successfully')
|
|
||||||
->assertSee('Bank Transfer');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithExistingACH()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bank Transfer')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveACHAccount()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testIntegerAndMinimumValueOnVerification()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Bank Account')
|
|
||||||
->type('#account-holder-name', 'John Doe')
|
|
||||||
->select('#country', 'US')
|
|
||||||
->select('#currency', 'USD')
|
|
||||||
->type('#routing-number', '110000000')
|
|
||||||
->type('#account-number', '000123456789')
|
|
||||||
->check('#accept-terms')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText('ACH (Verification)', 60)
|
|
||||||
->type('@verification-1st', '0.1')
|
|
||||||
->type('@verification-2nd', '0')
|
|
||||||
->press('Complete Verification')
|
|
||||||
->assertSee('The transactions.0 must be an integer')
|
|
||||||
->assertSee('The transactions.1 must be at least 1')
|
|
||||||
->type('@verification-1st', '32')
|
|
||||||
->type('@verification-2nd', '45')
|
|
||||||
->press('Complete Verification')
|
|
||||||
->assertSee('Bank Transfer');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class ACSSTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::ACSS} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276; // Change to US or Canada
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithACSS()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('ACSS')
|
|
||||||
->type('#acss-name', 'John Doe')
|
|
||||||
->type('#acss-name', 'John@Doe.com')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser->type('acss', '12345');
|
|
||||||
})
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('ACSS test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class AlipayTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable Alipay.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::ALIPAY} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
// Setting country to DEU (276).
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithAlipay()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Alipay')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Alipay test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class BECSTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::BECS} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276; // Change to austria
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithBECS()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('BECS')
|
|
||||||
->type('#becs-name', 'John Doe')
|
|
||||||
->type('#becs-email', 'john@doe.com')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser->type('becs-iban', '000123456');
|
|
||||||
})
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('BECS test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class BancontactTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::BANCONTACT} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithBancontact()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('EPS')
|
|
||||||
->type('#bancontact-name', 'John Doe')
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Bancontact test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
$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')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCardAndSaveForFutureUse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->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', 60)
|
|
||||||
->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')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingCreditCardStandalone()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->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');
|
|
||||||
})
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText('**** 4242');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class EPSTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::EPS} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithEPS()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('EPS')
|
|
||||||
->type('#eps-name', 'John Doe')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser->type('eps', '12345');
|
|
||||||
})
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('EPS test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class GiropayTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::GIROPAY} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithGiropay()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Giropay')
|
|
||||||
->type('#giropay-name', 'John Doe')
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Giropay test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class Prezelewy24Test extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::PRZELEWY24} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithPrezelewy24()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('EPS')
|
|
||||||
->type('#eps-name', 'John Doe')
|
|
||||||
->type('#eps-email', 'john@doe.com')
|
|
||||||
->check('#p24-mandate-acceptance', 'John Doe')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser->type('p24', '12345');
|
|
||||||
})
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('P24 test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,127 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class SEPATest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SEPA.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::SEPA} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
// SEPA required DE to be billing country.
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
|
|
||||||
$settings = $client->settings;
|
|
||||||
$settings->currency_id = '3';
|
|
||||||
|
|
||||||
$client->settings = $settings;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithNewSEPABankAccount(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('SEPA Direct Debit')
|
|
||||||
->type('#sepa-name', 'John Doe')
|
|
||||||
->type('#sepa-email-address', 'test@invoiceninja.com')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser->type('iban', 'DE89370400440532013000');
|
|
||||||
})
|
|
||||||
->check('#sepa-mandate-acceptance', true)
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithNewSEPABankAccountAndSaveForFuture(): void
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('SEPA Direct Debit')
|
|
||||||
->type('#sepa-name', 'John Doe')
|
|
||||||
->type('#sepa-email-address', 'test@invoiceninja.com')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser->type('iban', 'DE89370400440532013000');
|
|
||||||
})
|
|
||||||
->check('#sepa-mandate-acceptance', true)
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithSavedBankAccount()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->click('@pay-now-dropdown')
|
|
||||||
->clickLink('SEPA Direct Debit')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveBankAccount()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class SofortTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::SOFORT} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
// SOFORT required ['AUT', 'BEL', 'DEU', 'ITA', 'NLD', 'ESP'] to be billing country.
|
|
||||||
// Setting country to DEU (276).
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithSofort()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Sofort')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Sofort test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class iDEAL extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
// Enable SOFORT.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::IDEAL} = new FeesAndLimits();
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$client = Client::first();
|
|
||||||
$client->country_id = 276;
|
|
||||||
$client->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithiDeal()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('iDeal')
|
|
||||||
->type('#ideal-name', 'John Doe')
|
|
||||||
->withinFrame('iframe', function (Browser $browser) {
|
|
||||||
$browser->type('ideal', '12345');
|
|
||||||
})
|
|
||||||
->click('#pay-now')
|
|
||||||
->waitForText('iDeal test payment page', 120)
|
|
||||||
->press('.common-Button.common-Button--default')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\WePay;
|
|
||||||
|
|
||||||
use App\DataMapper\FeesAndLimits;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class ACHTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '8fdeed552015b3c7b44ed6c8ebd9e992')->restore();
|
|
||||||
|
|
||||||
// Enable ACH.
|
|
||||||
$cg = CompanyGateway::where('gateway_key', '8fdeed552015b3c7b44ed6c8ebd9e992')->firstOrFail();
|
|
||||||
$fees_and_limits = $cg->fees_and_limits;
|
|
||||||
$fees_and_limits->{GatewayType::BANK_TRANSFER} = new FeesAndLimits();
|
|
||||||
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
|
||||||
$cg->save();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayingWithNoPreauthorizedIsntPossible()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Bank Transfer')
|
|
||||||
->assertSee('To pay with a bank account, first you have to add it as payment method.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal\Gateways\WePay;
|
|
||||||
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class CreditCardTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
CompanyGateway::where('gateway_key', '8fdeed552015b3c7b44ed6c8ebd9e992')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
|
|
||||||
Client::first()->update(['postal_code' => 99501]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->type('card-number', '4003830171874018')
|
|
||||||
->type('card-holders-name', 'John Doe')
|
|
||||||
->type('.expiry', '12/28')
|
|
||||||
->type('cvc', '100')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithNewCardAndSaveForFutureUse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->type('card-number', '4003830171874018')
|
|
||||||
->type('card-holders-name', 'John Doe')
|
|
||||||
->type('.expiry', '12/28')
|
|
||||||
->type('cvc', '100')
|
|
||||||
->radio('#proxy_is_default', true)
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60)
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->assertSee('4018');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayWithSavedCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('@pay-now')
|
|
||||||
->press('Pay Now')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->click('.toggle-payment-with-token')
|
|
||||||
->press('Pay Now')
|
|
||||||
->waitForText('Details of the payment', 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRemoveCreditCard()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->press('Remove Payment Method')
|
|
||||||
->waitForText('Confirmation')
|
|
||||||
->click('@confirm-payment-removal')
|
|
||||||
->assertSee('Payment method has been successfully removed.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAddingCreditCardStandalone()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->clickLink('Credit Card')
|
|
||||||
->waitForText('Credit Card')
|
|
||||||
->type('#cardholder_name', 'John Doe')
|
|
||||||
->type('card-number', '4003830171874018')
|
|
||||||
->type('card-holders-name', 'John Doe')
|
|
||||||
->type('.expiry', '12/28')
|
|
||||||
->type('cvc', '100')
|
|
||||||
->press('Add Payment Method')
|
|
||||||
->waitForText(4018, 60);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class InvoicesTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Invoices')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testClickingPayNowWithoutInvoices()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->press('Pay Now')
|
|
||||||
->assertSee('No payable invoices selected. Make sure you are not trying to pay draft invoice or invoice with zero balance due.')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testClickingDownloadWithoutInvoices()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->press('Download')
|
|
||||||
->assertSee('No items selected.')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCheckingInvoiceAndClickingPayNow()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->check('.form-check.form-check-child')
|
|
||||||
->press('Pay Now')
|
|
||||||
->assertPathIs('/client/invoices/payment')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPayNowButtonIsntShowingWhenNoGatewaysConfigured()
|
|
||||||
{
|
|
||||||
$this->disableCompanyGateways();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->assertDontSee('Pay Now');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Enable Stripe.
|
|
||||||
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->assertSee('Pay Now')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class LoginTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLoginPage()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(route('client.login'))
|
|
||||||
->assertSee('Client Portal')
|
|
||||||
->type('email', 'user@example.com')
|
|
||||||
->type('password', 'password')
|
|
||||||
->press('Login');
|
|
||||||
|
|
||||||
$browser->assertPathIs('/client/invoices');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLoginFormValidation()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(route('client.login'))
|
|
||||||
->press('Login')
|
|
||||||
->assertSee('The email field is required.')
|
|
||||||
->assertSee('The password field is required.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testForgotPasswordLink()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(route('client.login'))
|
|
||||||
->assertSeeLink('Forgot your password?')
|
|
||||||
->clickLink('Forgot your password?')
|
|
||||||
->assertPathIs('/client/password/reset');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class PaymentMethodsTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payment_methods.index')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Payment Methods')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
class PaymentsTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.payments.index')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Payments')
|
|
||||||
->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');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,210 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use Faker\Factory;
|
|
||||||
use Faker\Generator;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class ProfileSettingsTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/** @var Generator */
|
|
||||||
public $faker;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->faker = Factory::create();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('button[data-ref="client-profile-dropdown"]')
|
|
||||||
->click('a[data-ref="client-profile-dropdown-settings"]')
|
|
||||||
->waitForText('Client Information')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Client Information')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testClientDetailsUpdate()
|
|
||||||
{
|
|
||||||
$original = [
|
|
||||||
'name' => $this->faker->name(),
|
|
||||||
'vat_number' => (string) $this->faker->randomNumber(6),
|
|
||||||
'phone' => $this->faker->phoneNumber(),
|
|
||||||
'website' => $this->faker->url(),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) use ($original) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('button[data-ref="client-profile-dropdown"]')
|
|
||||||
->click('a[data-ref="client-profile-dropdown-settings"]')
|
|
||||||
->waitForText('Client Information');
|
|
||||||
|
|
||||||
$browser
|
|
||||||
->with('#update_contact', function (Browser $form) use ($original) {
|
|
||||||
$form
|
|
||||||
->type('#client_name', $original['name'])
|
|
||||||
->type('#client_vat_number', $original['vat_number'])
|
|
||||||
->type('#client_phone', $original['phone'])
|
|
||||||
->type('#client_website', $original['website'])
|
|
||||||
->press('Save');
|
|
||||||
})
|
|
||||||
->pause(2000)
|
|
||||||
->refresh();
|
|
||||||
|
|
||||||
$updated = [
|
|
||||||
'name' => $browser->value('#client_name'),
|
|
||||||
'vat_number' => $browser->value('#client_vat_number'),
|
|
||||||
'phone' => $browser->value('#client_phone'),
|
|
||||||
'website' => $browser->value('#client_website'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->assertSame($original, $updated);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testContactDetailsUpdate()
|
|
||||||
{
|
|
||||||
$original = [
|
|
||||||
'first_name' => $this->faker->firstName(),
|
|
||||||
'last_name' => $this->faker->lastName(),
|
|
||||||
'email_address' => 'user@example.com',
|
|
||||||
'phone' => $this->faker->phoneNumber(),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) use ($original) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('button[data-ref="client-profile-dropdown"]')
|
|
||||||
->click('a[data-ref="client-profile-dropdown-settings"]')
|
|
||||||
->waitForText('Client Information');
|
|
||||||
|
|
||||||
$browser
|
|
||||||
->with('#update_client', function (Browser $form) use ($original) {
|
|
||||||
$form
|
|
||||||
->type('#contact_first_name', $original['first_name'])
|
|
||||||
->type('#contact_last_name', $original['last_name'])
|
|
||||||
->scrollIntoView('#contact_email_address')
|
|
||||||
->type('#contact_email_address', $original['email_address'])
|
|
||||||
->type('#contact_phone', $original['phone'])
|
|
||||||
->click('button[data-ref="update-contact-details"]');
|
|
||||||
})
|
|
||||||
->pause(2000)
|
|
||||||
->refresh();
|
|
||||||
|
|
||||||
$updated = [
|
|
||||||
'first_name' => $browser->value('#contact_first_name'),
|
|
||||||
'last_name' => $browser->value('#contact_last_name'),
|
|
||||||
'email_address' => $browser->value('#contact_email_address'),
|
|
||||||
'phone' => $browser->value('#contact_phone'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->assertSame($original, $updated);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBillingAddressUpdate()
|
|
||||||
{
|
|
||||||
$original = [
|
|
||||||
'street' => $this->faker->streetName(),
|
|
||||||
'apt' => $this->faker->streetAddress(),
|
|
||||||
'city' => $this->faker->city(),
|
|
||||||
'state' => $this->faker->state(),
|
|
||||||
'postal_code' => $this->faker->postcode(),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) use ($original) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('button[data-ref="client-profile-dropdown"]')
|
|
||||||
->click('a[data-ref="client-profile-dropdown-settings"]')
|
|
||||||
->waitForText('Client Information');
|
|
||||||
|
|
||||||
$browser
|
|
||||||
->with('#update_billing_address', function (Browser $form) use ($original) {
|
|
||||||
$form
|
|
||||||
->type('#address1', $original['street'])
|
|
||||||
->type('#address2', $original['apt'])
|
|
||||||
->type('#city', $original['city'])
|
|
||||||
->type('#state', $original['state'])
|
|
||||||
->type('#postal_code', $original['postal_code'])
|
|
||||||
->select('#country')
|
|
||||||
->press('Save');
|
|
||||||
})
|
|
||||||
->pause(1000)
|
|
||||||
->refresh();
|
|
||||||
|
|
||||||
$updated = [
|
|
||||||
'street' => $browser->value('#address1'),
|
|
||||||
'apt' => $browser->value('#address2'),
|
|
||||||
'city' => $browser->value('#city'),
|
|
||||||
'state' => $browser->value('#state'),
|
|
||||||
'postal_code' => $browser->value('#postal_code'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->assertSame($original, $updated);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testShippingAddressUpdate()
|
|
||||||
{
|
|
||||||
$original = [
|
|
||||||
'street' => $this->faker->streetName(),
|
|
||||||
'apt' => $this->faker->streetAddress(),
|
|
||||||
'city' => $this->faker->city(),
|
|
||||||
'state' => $this->faker->state(),
|
|
||||||
'postal_code' => $this->faker->postcode(),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) use ($original) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.invoices.index')
|
|
||||||
->click('button[data-ref="client-profile-dropdown"]')
|
|
||||||
->click('a[data-ref="client-profile-dropdown-settings"]')
|
|
||||||
->waitForText('Client Information');
|
|
||||||
|
|
||||||
$browser
|
|
||||||
->with('#update_shipping_address', function (Browser $form) use ($original) {
|
|
||||||
$form
|
|
||||||
->type('#shipping_address1', $original['street'])
|
|
||||||
->type('#shipping_address2', $original['apt'])
|
|
||||||
->type('#shipping_city', $original['city'])
|
|
||||||
->type('#shipping_state', $original['state'])
|
|
||||||
->type('#shipping_postal_code', $original['postal_code'])
|
|
||||||
->select('#shipping_country')
|
|
||||||
->press('Save');
|
|
||||||
})
|
|
||||||
->pause(1000)
|
|
||||||
->refresh();
|
|
||||||
|
|
||||||
$updated = [
|
|
||||||
'street' => $browser->value('#shipping_address1'),
|
|
||||||
'apt' => $browser->value('#shipping_address2'),
|
|
||||||
'city' => $browser->value('#shipping_city'),
|
|
||||||
'state' => $browser->value('#shipping_state'),
|
|
||||||
'postal_code' => $browser->value('#shipping_postal_code'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->assertSame($original, $updated);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class QuotesTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.quotes.index')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Quotes')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testClickingApproveWithoutQuotesDoesntWork()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.quotes.index')
|
|
||||||
->press('Approve')
|
|
||||||
->assertPathIs('/client/quotes');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testApprovingQuotes()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.quotes.index')
|
|
||||||
->check('.form-check.form-check-child')
|
|
||||||
->press('Approve')
|
|
||||||
->assertPathIs('/client/quotes/approve')
|
|
||||||
->press('Approve')
|
|
||||||
->assertPathIs('/client/quotes')
|
|
||||||
->assertSee('Quote(s) approved successfully.')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testQuotesWithSentStatusCanOnlyBeApproved()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.quotes.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->assertSee('Only quotes with "Sent" status can be approved.')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMessageForNonApprovableQuotesIsVisible()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.quotes.index')
|
|
||||||
->check('.form-check.form-check-child')
|
|
||||||
->press('Approve')
|
|
||||||
->assertPathIs('/client/quotes')
|
|
||||||
->assertDontSee('Quote(s) approved successfully.')
|
|
||||||
->assertSee('Only quotes with "Sent" status can be approved.')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNoQuotesAvailableForDownloadMessage()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.quotes.index')
|
|
||||||
->press('Download')
|
|
||||||
->assertSee('No quotes available for download.');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use App\Models\RecurringInvoice;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class RecurringInvoicesTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.recurring_invoices.index')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Recurring Invoices')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRequestingCancellation()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.recurring_invoices.index')
|
|
||||||
->clickLink('View')
|
|
||||||
->assertSee('Cancellation')
|
|
||||||
->press('Request Cancellation')
|
|
||||||
->pause(1000)
|
|
||||||
->waitForText('Request cancellation')
|
|
||||||
->press('Confirm')
|
|
||||||
->pause(5000)
|
|
||||||
->assertPathIs(
|
|
||||||
route('client.recurring_invoices.request_cancellation', RecurringInvoice::first()->hashed_id, false)
|
|
||||||
)
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Browser\ClientPortal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\Browser\Pages\ClientPortal\Login;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
class SubscriptionsTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
foreach (static::$browsers as $browser) {
|
|
||||||
$browser->driver->manage()->deleteAllCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visit(new Login())
|
|
||||||
->auth();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPageLoads()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.subscriptions.index')
|
|
||||||
->assertSeeIn('span[data-ref="meta-title"]', 'Subscriptions')
|
|
||||||
->visitRoute('client.logout');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser\Pages\ClientPortal;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Laravel\Dusk\Page;
|
|
||||||
|
|
||||||
class Login extends Page
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the URL for the page.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function url(): string
|
|
||||||
{
|
|
||||||
return '/client/login';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assert that the browser is on the page.
|
|
||||||
*
|
|
||||||
* @param Browser $browser
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function assert(Browser $browser)
|
|
||||||
{
|
|
||||||
$browser->assertPathIs($this->url());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the element shortcuts for the page.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function elements()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'@element' => '#selector',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function auth(Browser $browser)
|
|
||||||
{
|
|
||||||
$browser
|
|
||||||
->visitRoute('client.login')
|
|
||||||
->type('email', 'user@example.com')
|
|
||||||
->type('password', 'password')
|
|
||||||
->press('Login');
|
|
||||||
}
|
|
||||||
}
|
|
2
tests/Browser/console/.gitignore
vendored
2
tests/Browser/console/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
2
tests/Browser/screenshots/.gitignore
vendored
2
tests/Browser/screenshots/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
@ -1,73 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests;
|
|
||||||
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use Facebook\WebDriver\Chrome\ChromeOptions;
|
|
||||||
use Facebook\WebDriver\Remote\DesiredCapabilities;
|
|
||||||
use Facebook\WebDriver\Remote\RemoteWebDriver;
|
|
||||||
use Laravel\Dusk\TestCase as BaseTestCase;
|
|
||||||
|
|
||||||
abstract class DuskTestCase extends BaseTestCase
|
|
||||||
{
|
|
||||||
use CreatesApplication;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepare for Dusk test execution.
|
|
||||||
*
|
|
||||||
* @beforeClass
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function prepare()
|
|
||||||
{
|
|
||||||
if (! static::runningInSail()) {
|
|
||||||
static::startChromeDriver();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the RemoteWebDriver instance.
|
|
||||||
*
|
|
||||||
* @return RemoteWebDriver
|
|
||||||
*/
|
|
||||||
protected function driver()
|
|
||||||
{
|
|
||||||
$options = (new ChromeOptions)->addArguments(collect([
|
|
||||||
'--window-size=1920,1080',
|
|
||||||
])->unless($this->hasHeadlessDisabled(), function ($items) {
|
|
||||||
return $items->merge([
|
|
||||||
'--disable-gpu',
|
|
||||||
'--headless',
|
|
||||||
]);
|
|
||||||
})->all());
|
|
||||||
|
|
||||||
return RemoteWebDriver::create(
|
|
||||||
$_ENV['DUSK_DRIVER_URL'] ?? 'http://localhost:9515',
|
|
||||||
DesiredCapabilities::chrome()->setCapability(
|
|
||||||
ChromeOptions::CAPABILITY,
|
|
||||||
$options
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the Dusk command has disabled headless mode.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function hasHeadlessDisabled()
|
|
||||||
{
|
|
||||||
return isset($_SERVER['DUSK_HEADLESS_DISABLED']) ||
|
|
||||||
isset($_ENV['DUSK_HEADLESS_DISABLED']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable all company gateways, test classes should enable them per need.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function disableCompanyGateways()
|
|
||||||
{
|
|
||||||
CompanyGateway::where('company_id', 1)->delete();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user