Files
HickLab3D_Dashboard/tests/Feature/NavigationTest.php
T
hermes d4928789c4
Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 23s
Add HL3D branding, Etsy Live/Draft paging and Projects lifecycle
Replace the old touchmark/PNG identity with the supplied lockup and
monogram, segmented role-aware navigation, Live/Draft listing filters
with generation-based cache invalidation, and admin Projects covering
immutable file revisions, listing live pointers, and exact-decimal
filament/packaging/shipping costing. Additive schema only; no Etsy
publication. Isolated clone tests: 301 tests, 1162 assertions.
2026-11-08 12:50:56 +00:00

88 lines
3.2 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;
class NavigationTest extends TestCase
{
use LazilyRefreshDatabase;
public function test_regular_user_only_sees_non_admin_groups(): void
{
$user = User::factory()->create();
$response = $this->actingAs($user)->get(route('dashboard'));
$response->assertOk()->assertSee('Workspace')->assertSee('Workshop')
->assertDontSee('Projects')->assertDontSee('Commerce')->assertDontSee('Administration');
}
public function test_admin_sees_every_navigation_group_with_no_empty_group(): void
{
$admin = User::factory()->create(['role' => 'admin']);
$response = $this->actingAs($admin)->get(route('dashboard'));
$response->assertOk()
->assertSee('Workspace')->assertSee('Projects')
->assertSee('Workshop')->assertSee('Print farm')->assertSee('Dryer')
->assertSee('Commerce')->assertSee('Etsy')->assertSee('Shipping')
->assertSee('Administration')->assertSee('Settings')->assertSee('Users');
}
public function test_active_route_gets_aria_current(): void
{
$admin = User::factory()->create(['role' => 'admin']);
$this->actingAs($admin)->get(route('projects.index'))
->assertOk()
->assertSee('aria-current="page"', false);
}
public function test_mobile_drawer_markup_is_present_and_accessible(): void
{
$user = User::factory()->create();
$this->actingAs($user)->get(route('dashboard'))->assertOk()
->assertSee('id="mobile-nav"', false)
->assertSee('popover="auto"', false)
->assertSee('popovertarget="mobile-nav"', false)
->assertSee('aria-label="Navigation menu"', false);
}
public function test_desktop_sidebar_is_hidden_below_the_lg_breakpoint(): void
{
$user = User::factory()->create();
$html = $this->actingAs($user)->get(route('dashboard'))->assertOk()->getContent();
// The bug: on a 390px viewport the desktop <aside> rendered as a full
// visible block (no `hidden`), pushing the real page header down to
// ~y673. It must not render at all below the `lg` breakpoint; the
// separate #mobile-nav popover is the only mobile navigation surface.
$this->assertMatchesRegularExpression(
'/<aside[^>]*data-sidebar[^>]*class="[^"]*\bhidden\b[^"]*\blg:block\b[^"]*"/',
$html,
);
}
public function test_sidebar_header_uses_the_supplied_lockup_when_expanded_and_monogram_when_collapsed(): void
{
$user = User::factory()->create();
$html = $this->actingAs($user)->get(route('dashboard'))->assertOk()->getContent();
$this->assertMatchesRegularExpression(
'/<img[^>]*src="[^"]*hl3d-lockup-dark-background\.svg"[^>]*data-sidebar-expanded-mark/',
$html,
);
$this->assertMatchesRegularExpression(
'/<img[^>]*src="[^"]*hl3d-monogram-dark-background\.svg"[^>]*class="[^"]*\bhidden\b[^"]*"[^>]*data-sidebar-collapsed-mark/',
$html,
);
}
}