Skip to content

Commit

Permalink
UI TEst: Show Customer CLient
Browse files Browse the repository at this point in the history
  • Loading branch information
KirinZero0 committed Oct 3, 2024
1 parent 0f4aa11 commit 28260ec
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Feature/CRMUITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 28260ec

Please sign in to comment.