diff --git a/app/DataMapper/Tax/AU/Rule.php b/app/DataMapper/Tax/AU/Rule.php index 1887b3a24162..8150f3e96cf5 100644 --- a/app/DataMapper/Tax/AU/Rule.php +++ b/app/DataMapper/Tax/AU/Rule.php @@ -223,9 +223,12 @@ class Rule extends BaseRule implements RuleInterface public function calculateRates(): self { if ($this->client->is_tax_exempt) { - // nlog("tax exempt"); + $this->tax_rate = 0; $this->reduced_tax_rate = 0; + + return $this; + } // } elseif($this->client_subregion != $this->client->company->tax_data->seller_subregion && in_array($this->client_subregion, $this->eu_country_codes) && $this->client->has_valid_vat_number && $this->eu_business_tax_exempt) { // nlog("euro zone and tax exempt"); // $this->tax_rate = 0; @@ -246,10 +249,9 @@ class Rule extends BaseRule implements RuleInterface // $this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate; // $this->reduced_tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate; // } - } else { - $this->tax_rate = $this->client->company->tax_data->regions->AU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate; - $this->reduced_tax_rate = $this->client->company->tax_data->regions->AU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate; - } + + $this->tax_rate = $this->client->company->tax_data->regions->AU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate; + $this->reduced_tax_rate = $this->client->company->tax_data->regions->AU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate; return $this; diff --git a/app/Http/Livewire/PdfSlot.php b/app/Http/Livewire/PdfSlot.php index 808ff33f6d8e..9b52146a3412 100644 --- a/app/Http/Livewire/PdfSlot.php +++ b/app/Http/Livewire/PdfSlot.php @@ -25,6 +25,8 @@ class PdfSlot extends Component public $pdf; + public $url; + public function mount() { MultiDB::setDb($this->db); diff --git a/app/Utils/Traits/MakesInvoiceHtml.php b/app/Utils/Traits/MakesInvoiceHtml.php index cd203329f28e..e6ce63768072 100644 --- a/app/Utils/Traits/MakesInvoiceHtml.php +++ b/app/Utils/Traits/MakesInvoiceHtml.php @@ -42,6 +42,8 @@ trait MakesInvoiceHtml { $data['__env'] = app(Factory::class); + return Blade::render($string, $data); //potential fix for removing eval() + $php = Blade::compileString($string); $obLevel = ob_get_level(); diff --git a/composer.json b/composer.json index 6bc4453617e4..c5907c5a1803 100644 --- a/composer.json +++ b/composer.json @@ -106,7 +106,6 @@ "filp/whoops": "^2.7", "friendsofphp/php-cs-fixer": "^3.14", "laracasts/cypress": "^3.0", - "laravel/dusk": "^6.15", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", "nunomaduro/larastan": "^2.0", diff --git a/config/ninja.php b/config/ninja.php index f12e4aa3d10b..0bd015f9876e 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -15,8 +15,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.6.16', - 'app_tag' => '5.6.16', + 'app_version' => env('APP_VERSION','5.6.16'), + 'app_tag' => env('APP_TAG','5.6.16'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''), diff --git a/dusk.sh b/dusk.sh deleted file mode 100644 index 8e3cde4b6aa7..000000000000 --- a/dusk.sh +++ /dev/null @@ -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.' diff --git a/resources/views/portal/ninja2020/components/statement-pdf-viewer.blade.php b/resources/views/portal/ninja2020/components/statement-pdf-viewer.blade.php new file mode 100644 index 000000000000..c40b22e62496 --- /dev/null +++ b/resources/views/portal/ninja2020/components/statement-pdf-viewer.blade.php @@ -0,0 +1,98 @@ +@php + //$mobile = stripos(request()->server('HTTP_USER_AGENT'), 'Android') || stripos(request()->server('HTTP_USER_AGENT'), 'iPhone') || stripos(request()->server('HTTP_USER_AGENT'), 'iPod') || stripos(request()->server('HTTP_USER_AGENT'), 'iPad'); + $mobile = false; +@endphp + +@push('head') + + +@endpush + +
+
+
+ + +
+ {{ ctrans('texts.page') }}: + + {{ strtolower(ctrans('texts.of')) }} + + +
+
+ +
+
+ +
+ +
+
+
+ +@if($mobile) +
+ +
+@else + +@endif + + +@if($mobile) + @push('footer') + + @endpush +@endif \ No newline at end of file diff --git a/resources/views/portal/ninja2020/statement/index.blade.php b/resources/views/portal/ninja2020/statement/index.blade.php index f0780705b29a..b89d1d64acf1 100644 --- a/resources/views/portal/ninja2020/statement/index.blade.php +++ b/resources/views/portal/ninja2020/statement/index.blade.php @@ -44,7 +44,7 @@ - @include('portal.ninja2020.components.pdf-viewer', ['url' => route('client.statement.raw')]) + @include('portal.ninja2020.components.statement-pdf-viewer', ['url' => route('client.statement.raw')]) @endsection diff --git a/tests/Browser/ClientPortal/CreditsTest.php b/tests/Browser/ClientPortal/CreditsTest.php deleted file mode 100644 index c5c274b44461..000000000000 --- a/tests/Browser/ClientPortal/CreditsTest.php +++ /dev/null @@ -1,45 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/DocumentsTest.php b/tests/Browser/ClientPortal/DocumentsTest.php deleted file mode 100644 index 454acd856b59..000000000000 --- a/tests/Browser/ClientPortal/DocumentsTest.php +++ /dev/null @@ -1,45 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/AuthorizeNet/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/AuthorizeNet/CreditCardTest.php deleted file mode 100644 index d8030f5701ea..000000000000 --- a/tests/Browser/ClientPortal/Gateways/AuthorizeNet/CreditCardTest.php +++ /dev/null @@ -1,127 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Braintree/ACHTest.php b/tests/Browser/ClientPortal/Gateways/Braintree/ACHTest.php deleted file mode 100644 index 580eb4cf95eb..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Braintree/ACHTest.php +++ /dev/null @@ -1,91 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Braintree/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/Braintree/CreditCardTest.php deleted file mode 100644 index 9dc3fdb5a72c..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Braintree/CreditCardTest.php +++ /dev/null @@ -1,145 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Braintree/PayPalTest.php b/tests/Browser/ClientPortal/Gateways/Braintree/PayPalTest.php deleted file mode 100644 index 031d0c4a2e21..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Braintree/PayPalTest.php +++ /dev/null @@ -1,45 +0,0 @@ -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.'); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/CheckoutCom/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/CheckoutCom/CreditCardTest.php deleted file mode 100644 index 214fe4bdd76d..000000000000 --- a/tests/Browser/ClientPortal/Gateways/CheckoutCom/CreditCardTest.php +++ /dev/null @@ -1,127 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Eway/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/Eway/CreditCardTest.php deleted file mode 100644 index 528422ba0759..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Eway/CreditCardTest.php +++ /dev/null @@ -1,125 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/GoCardless/ACHTest.php b/tests/Browser/ClientPortal/Gateways/GoCardless/ACHTest.php deleted file mode 100644 index 5867f8329f35..000000000000 --- a/tests/Browser/ClientPortal/Gateways/GoCardless/ACHTest.php +++ /dev/null @@ -1,42 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/GoCardless/DirectDebitTest.php b/tests/Browser/ClientPortal/Gateways/GoCardless/DirectDebitTest.php deleted file mode 100644 index 5989196c3f3d..000000000000 --- a/tests/Browser/ClientPortal/Gateways/GoCardless/DirectDebitTest.php +++ /dev/null @@ -1,42 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/GoCardless/SEPATest.php b/tests/Browser/ClientPortal/Gateways/GoCardless/SEPATest.php deleted file mode 100644 index a1de5eced97a..000000000000 --- a/tests/Browser/ClientPortal/Gateways/GoCardless/SEPATest.php +++ /dev/null @@ -1,42 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Mollie/BancontactTest.php b/tests/Browser/ClientPortal/Gateways/Mollie/BancontactTest.php deleted file mode 100644 index 417d8b8b4d53..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Mollie/BancontactTest.php +++ /dev/null @@ -1,102 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Mollie/BankTransferTest.php b/tests/Browser/ClientPortal/Gateways/Mollie/BankTransferTest.php deleted file mode 100644 index 7aed496ea069..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Mollie/BankTransferTest.php +++ /dev/null @@ -1,72 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Mollie/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/Mollie/CreditCardTest.php deleted file mode 100644 index 4eb872fab74f..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Mollie/CreditCardTest.php +++ /dev/null @@ -1,134 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Mollie/IDEALTest.php b/tests/Browser/ClientPortal/Gateways/Mollie/IDEALTest.php deleted file mode 100644 index 07afa9443d6e..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Mollie/IDEALTest.php +++ /dev/null @@ -1,106 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Mollie/KBCTest.php b/tests/Browser/ClientPortal/Gateways/Mollie/KBCTest.php deleted file mode 100644 index 286d421b93c1..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Mollie/KBCTest.php +++ /dev/null @@ -1,89 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/PayPal/PayPalTest.php b/tests/Browser/ClientPortal/Gateways/PayPal/PayPalTest.php deleted file mode 100644 index 0525406c80de..000000000000 --- a/tests/Browser/ClientPortal/Gateways/PayPal/PayPalTest.php +++ /dev/null @@ -1,40 +0,0 @@ -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.'); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/PayTrace/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/PayTrace/CreditCardTest.php deleted file mode 100644 index 3809a8a048f8..000000000000 --- a/tests/Browser/ClientPortal/Gateways/PayTrace/CreditCardTest.php +++ /dev/null @@ -1,62 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Square/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/Square/CreditCardTest.php deleted file mode 100644 index 9fc30cbac12e..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Square/CreditCardTest.php +++ /dev/null @@ -1,128 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/ACHTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/ACHTest.php deleted file mode 100644 index 60f3b49324d4..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/ACHTest.php +++ /dev/null @@ -1,133 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/ACSSTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/ACSSTest.php deleted file mode 100644 index a0f349b0404a..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/ACSSTest.php +++ /dev/null @@ -1,75 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/AlipayTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/AlipayTest.php deleted file mode 100644 index b58545eb3a7d..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/AlipayTest.php +++ /dev/null @@ -1,71 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/BECSTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/BECSTest.php deleted file mode 100644 index 388e94bf93e4..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/BECSTest.php +++ /dev/null @@ -1,75 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/BancontactTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/BancontactTest.php deleted file mode 100644 index 52cf83069422..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/BancontactTest.php +++ /dev/null @@ -1,71 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/CreditCardTest.php deleted file mode 100644 index e15ea3d678e8..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/CreditCardTest.php +++ /dev/null @@ -1,139 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/EPSTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/EPSTest.php deleted file mode 100644 index 4660d6a030ea..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/EPSTest.php +++ /dev/null @@ -1,74 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/GiropayTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/GiropayTest.php deleted file mode 100644 index 469e4d15b7b9..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/GiropayTest.php +++ /dev/null @@ -1,71 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/Prezelewy24Test.php b/tests/Browser/ClientPortal/Gateways/Stripe/Prezelewy24Test.php deleted file mode 100644 index a0b3f4a2a23f..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/Prezelewy24Test.php +++ /dev/null @@ -1,76 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/SEPATest.php b/tests/Browser/ClientPortal/Gateways/Stripe/SEPATest.php deleted file mode 100644 index bf30be28cae0..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/SEPATest.php +++ /dev/null @@ -1,127 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/SofortTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/SofortTest.php deleted file mode 100644 index d892cc4cc879..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/SofortTest.php +++ /dev/null @@ -1,72 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/iDEAL.php b/tests/Browser/ClientPortal/Gateways/Stripe/iDEAL.php deleted file mode 100644 index a9a6549e290b..000000000000 --- a/tests/Browser/ClientPortal/Gateways/Stripe/iDEAL.php +++ /dev/null @@ -1,74 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/WePay/ACHTest.php b/tests/Browser/ClientPortal/Gateways/WePay/ACHTest.php deleted file mode 100644 index a043a483f0b6..000000000000 --- a/tests/Browser/ClientPortal/Gateways/WePay/ACHTest.php +++ /dev/null @@ -1,62 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/Gateways/WePay/CreditCardTest.php b/tests/Browser/ClientPortal/Gateways/WePay/CreditCardTest.php deleted file mode 100644 index 3581142a360b..000000000000 --- a/tests/Browser/ClientPortal/Gateways/WePay/CreditCardTest.php +++ /dev/null @@ -1,126 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/InvoicesTest.php b/tests/Browser/ClientPortal/InvoicesTest.php deleted file mode 100644 index a579e3c01a31..000000000000 --- a/tests/Browser/ClientPortal/InvoicesTest.php +++ /dev/null @@ -1,101 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/LoginTest.php b/tests/Browser/ClientPortal/LoginTest.php deleted file mode 100644 index e8934b6b6574..000000000000 --- a/tests/Browser/ClientPortal/LoginTest.php +++ /dev/null @@ -1,64 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/PaymentMethodsTest.php b/tests/Browser/ClientPortal/PaymentMethodsTest.php deleted file mode 100644 index 56feb97f80c2..000000000000 --- a/tests/Browser/ClientPortal/PaymentMethodsTest.php +++ /dev/null @@ -1,45 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/PaymentsTest.php b/tests/Browser/ClientPortal/PaymentsTest.php deleted file mode 100644 index 5131ac1d218e..000000000000 --- a/tests/Browser/ClientPortal/PaymentsTest.php +++ /dev/null @@ -1,80 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/ProfileSettingsTest.php b/tests/Browser/ClientPortal/ProfileSettingsTest.php deleted file mode 100644 index 7ef244eaf73b..000000000000 --- a/tests/Browser/ClientPortal/ProfileSettingsTest.php +++ /dev/null @@ -1,210 +0,0 @@ -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); - }); - } -} diff --git a/tests/Browser/ClientPortal/QuotesTest.php b/tests/Browser/ClientPortal/QuotesTest.php deleted file mode 100644 index ce4b024fe8fb..000000000000 --- a/tests/Browser/ClientPortal/QuotesTest.php +++ /dev/null @@ -1,105 +0,0 @@ -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.'); - }); - } -} diff --git a/tests/Browser/ClientPortal/RecurringInvoicesTest.php b/tests/Browser/ClientPortal/RecurringInvoicesTest.php deleted file mode 100644 index d5d9b711ef6b..000000000000 --- a/tests/Browser/ClientPortal/RecurringInvoicesTest.php +++ /dev/null @@ -1,65 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/ClientPortal/SubscriptionsTest.php b/tests/Browser/ClientPortal/SubscriptionsTest.php deleted file mode 100644 index b0962cc3e333..000000000000 --- a/tests/Browser/ClientPortal/SubscriptionsTest.php +++ /dev/null @@ -1,45 +0,0 @@ -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'); - }); - } -} diff --git a/tests/Browser/Pages/ClientPortal/Login.php b/tests/Browser/Pages/ClientPortal/Login.php deleted file mode 100644 index 11125eba444a..000000000000 --- a/tests/Browser/Pages/ClientPortal/Login.php +++ /dev/null @@ -1,51 +0,0 @@ -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'); - } -} diff --git a/tests/Browser/console/.gitignore b/tests/Browser/console/.gitignore deleted file mode 100644 index d6b7ef32c847..000000000000 --- a/tests/Browser/console/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/tests/Browser/screenshots/.gitignore b/tests/Browser/screenshots/.gitignore deleted file mode 100644 index d6b7ef32c847..000000000000 --- a/tests/Browser/screenshots/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php deleted file mode 100644 index 590eaa3eb96b..000000000000 --- a/tests/DuskTestCase.php +++ /dev/null @@ -1,73 +0,0 @@ -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(); - } -}