From 1d1d04ccd1b1b6cfec6831e1aefde063e29b9be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 5 Jul 2021 10:17:01 +0200 Subject: [PATCH] Invoices: Test clicking on "Pay Now" with selected invoice --- tests/Browser/ClientPortal/InvoicesTest.php | 33 +++++++++++++++------ 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/tests/Browser/ClientPortal/InvoicesTest.php b/tests/Browser/ClientPortal/InvoicesTest.php index 20c25adeb929..59afe4231a25 100644 --- a/tests/Browser/ClientPortal/InvoicesTest.php +++ b/tests/Browser/ClientPortal/InvoicesTest.php @@ -15,16 +15,21 @@ class InvoicesTest extends DuskTestCase 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 - ->visit(new Login()) - ->auth() ->visitRoute('client.invoices.index') - ->assertSee('Invoices'); + ->assertSee('Invoices') + ->visitRoute('client.logout'); }); } @@ -32,11 +37,10 @@ class InvoicesTest extends DuskTestCase { $this->browse(function (Browser $browser) { $browser - ->visit(new Login()) - ->auth() ->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.'); + ->assertSee('No payable invoices selected. Make sure you are not trying to pay draft invoice or invoice with zero balance due.') + ->visitRoute('client.logout'); }); } @@ -44,11 +48,22 @@ class InvoicesTest extends DuskTestCase { $this->browse(function (Browser $browser) { $browser - ->visit(new Login()) - ->auth() ->visitRoute('client.invoices.index') ->press('Download') - ->assertSee('No items selected.'); + ->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'); }); } }