From c81044994b19711196306d3b91c7b6ffd7c05a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 5 Jul 2021 13:57:28 +0200 Subject: [PATCH] Quotes: Test approving process --- tests/Browser/ClientPortal/QuotesTest.php | 30 ++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/Browser/ClientPortal/QuotesTest.php b/tests/Browser/ClientPortal/QuotesTest.php index a6495be0b0..0a1164f711 100644 --- a/tests/Browser/ClientPortal/QuotesTest.php +++ b/tests/Browser/ClientPortal/QuotesTest.php @@ -44,7 +44,7 @@ class QuotesTest extends DuskTestCase }); } - public function testClickingApproveWithoutQuotes() + public function testClickingApproveWithoutQuotesDoesntWork() { $this->browse(function (Browser $browser) { $browser @@ -53,4 +53,32 @@ class QuotesTest extends DuskTestCase ->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') + ->check('.form-check.form-check-child') + ->press('Approve') + ->assertPathIs('/client/quotes') + ->assertDontSee('Quote(s) approved successfully.') + ->visitRoute('client.logout'); + }); + } }