complete story 7.3 with qa tests
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Timeline;
|
||||
use App\Models\TimelineUpdate;
|
||||
use App\Models\User;
|
||||
|
||||
test('client dashboard has my cases navigation link', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.dashboard'))
|
||||
->assertOk()
|
||||
->assertSee(__('client.my_cases'))
|
||||
->assertSee(route('client.timelines.index'));
|
||||
});
|
||||
|
||||
test('client dashboard shows active cases count in widget', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
Timeline::factory()->active()->count(3)->create(['user_id' => $client->id]);
|
||||
Timeline::factory()->archived()->create(['user_id' => $client->id]);
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.dashboard'))
|
||||
->assertSee('3'); // Only active cases counted
|
||||
});
|
||||
|
||||
test('client dashboard shows latest timeline update', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
$timeline = Timeline::factory()->active()->create([
|
||||
'user_id' => $client->id,
|
||||
'case_name' => 'Property Dispute Case',
|
||||
]);
|
||||
TimelineUpdate::factory()->create([
|
||||
'timeline_id' => $timeline->id,
|
||||
'update_text' => 'Latest update about the property dispute.',
|
||||
'created_at' => now(),
|
||||
]);
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.dashboard'))
|
||||
->assertSee('Latest update about the property dispute');
|
||||
});
|
||||
|
||||
test('client dashboard shows empty state when no cases', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.dashboard'))
|
||||
->assertSee(__('client.dashboard.no_cases'));
|
||||
});
|
||||
|
||||
test('my cases navigation is active on timeline index route', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.timelines.index'))
|
||||
->assertOk()
|
||||
->assertSee(__('client.my_cases'));
|
||||
});
|
||||
|
||||
test('my cases navigation is active on timeline show route', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
$timeline = Timeline::factory()->create(['user_id' => $client->id]);
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.timelines.show', $timeline))
|
||||
->assertOk()
|
||||
->assertSee(__('client.my_cases'));
|
||||
});
|
||||
|
||||
test('timeline pages use client dashboard layout with navigation visible', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
|
||||
// Timeline index shows navigation
|
||||
$this->actingAs($client)
|
||||
->get(route('client.timelines.index'))
|
||||
->assertSee(__('client.my_cases'))
|
||||
->assertSee(__('navigation.my_consultations'))
|
||||
->assertSee(__('navigation.my_services'));
|
||||
});
|
||||
|
||||
test('client sees my consultations navigation link', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.dashboard'))
|
||||
->assertOk()
|
||||
->assertSee(__('navigation.my_consultations'))
|
||||
->assertSee(route('client.consultations.index'));
|
||||
});
|
||||
|
||||
test('admin does not see client navigation items', function () {
|
||||
$admin = User::factory()->admin()->create();
|
||||
|
||||
$this->actingAs($admin)
|
||||
->get(route('admin.dashboard'))
|
||||
->assertOk()
|
||||
->assertDontSee(__('navigation.my_services'))
|
||||
->assertDontSee(__('navigation.my_consultations'));
|
||||
});
|
||||
|
||||
test('dashboard widget links to timeline index', function () {
|
||||
$client = User::factory()->individual()->create();
|
||||
Timeline::factory()->active()->create(['user_id' => $client->id]);
|
||||
|
||||
$this->actingAs($client)
|
||||
->get(route('client.dashboard'))
|
||||
->assertSee(__('client.dashboard.view_all_cases'))
|
||||
->assertSee(route('client.timelines.index'));
|
||||
});
|
||||
Reference in New Issue
Block a user