From 28260ec4d1beb6de9c434f47d4961760811b423e Mon Sep 17 00:00:00 2001 From: KirinZero0 Date: Thu, 3 Oct 2024 15:54:08 +0800 Subject: [PATCH] UI TEst: Show Customer CLient --- tests/Feature/CRMUITest.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/Feature/CRMUITest.php b/tests/Feature/CRMUITest.php index c910ad6655..b6a5c10aad 100644 --- a/tests/Feature/CRMUITest.php +++ b/tests/Feature/CRMUITest.php @@ -8,11 +8,13 @@ use App\Actions\Catalogue\Shop\StoreShop; use App\Actions\Catalogue\Shop\UpdateShop; use App\Actions\CRM\Customer\StoreCustomer; +use App\Actions\Dropshipping\CustomerClient\StoreCustomerClient; use App\Actions\Inventory\Location\StoreLocation; use App\Enums\Catalogue\Shop\ShopStateEnum; use App\Enums\Catalogue\Shop\ShopTypeEnum; use App\Models\Catalogue\Shop; use App\Models\CRM\Customer; +use App\Models\Dropshipping\CustomerClient; use App\Models\Inventory\Location; use Inertia\Testing\AssertableInertia; @@ -70,6 +72,17 @@ function () { } $this->customer = $customer; + $customerClient = CustomerClient::first(); + if (!$customerClient) { + $storeData = CustomerClient::factory()->definition(); + + $customerClient = StoreCustomerClient::make()->action( + $this->customer, + $storeData + ); + } + $this->customerClient = $customerClient; + $this->adminGuest->refresh(); Config::set( @@ -184,6 +197,25 @@ function () { }); }); +test('UI Show customer client', function () { + $response = $this->get(route('grp.org.shops.show.crm.customers.show.customer-clients.show', [$this->organisation->slug, $this->shop->slug, $this->customer->slug, $this->customerClient->ulid])); + + $response->assertInertia(function (AssertableInertia $page) { + $page + ->component('Org/Shop/CRM/Customer') + ->has('title') + ->has('breadcrumbs', 4) + ->has('pageHead') + ->has( + 'pageHead', + fn (AssertableInertia $page) => $page + ->where('title', $this->customerClient->name) + ->has('subNavigation') + ->etc() + ); + }); +}); + test('UI create customer client', function () { $response = get(route('grp.org.shops.show.crm.customers.show.customer-clients.create', [$this->organisation->slug, $this->shop->slug, $this->customer->slug])); $response->assertInertia(function (AssertableInertia $page) {