create(); $response = $this->actingAs($user)->get('/help-center'); // Status check $response->assertStatus(200); // Auth checks expect(auth()->check())->toBeTrue(); expect(auth()->user()->id)->toBe($user->id); // Content checks $response->assertSee('Help'); }); test('help center page loads for guest user', function () { installHotel(); $response = $this->get('/help-center'); // Status check $response->assertStatus(200); // Guest check expect(auth()->guest())->toBeTrue(); // Content checks $response->assertSee('Help'); }); test('user can create help ticket', function () { installHotel(); $user = User::factory()->create(); $response = $this->actingAs($user)->get('/help-center/tickets/create'); // Status check $response->assertStatus(200); // Auth checks expect(auth()->check())->toBeTrue(); // Content checks $response->assertSee('Ticket'); }); test('guest cannot create help ticket', function () { installHotel(); $response = $this->get('/help-center/tickets/create'); // Redirect check $response->assertRedirect('/login'); // Guest check expect(auth()->guest())->toBeTrue(); }); test('rules page loads', function () { installHotel(); $response = $this->get('/help-center/rules'); // Status check $response->assertStatus(200); // Guest check expect(auth()->guest())->toBeTrue(); // Content checks $response->assertSee('Rules'); }); test('help center pages are accessible to all', function () { installHotel(); $user = User::factory()->create(); // Guest access $this->get('/help-center')->assertStatus(200); $this->get('/help-center/rules')->assertStatus(200); // Authenticated access $this->actingAs($user)->get('/help-center')->assertStatus(200); $this->actingAs($user)->get('/help-center/rules')->assertStatus(200); }); test('help center has proper navigation', function () { installHotel(); $response = $this->get('/help-center'); $response->assertStatus(200); // Navigation elements $response->assertSee('Help'); $response->assertSee('rules'); $response->assertSee('ticket'); }); test('rules page contains actual rules', function () { installHotel(); $response = $this->get('/help-center/rules'); $response->assertStatus(200); // Should contain rules content $response->assertSee('Rules'); $response->assertSee('rule'); }); test('ticket creation page has form elements', function () { installHotel(); $user = User::factory()->create(); $response = $this->actingAs($user)->get('/help-center/tickets/create'); $response->assertStatus(200); // Form elements $response->assertSee('form'); $response->assertSee('submit'); }); test('help center routes exist', function () { installHotel(); $routes = [ '/help-center' => 200, '/help-center/rules' => 200, '/help-center/tickets/create' => 302, // Requires auth ]; foreach ($routes as $url => $expectedStatus) { $response = $this->get($url); expect($response->status())->toBe($expectedStatus); } }); test('help center pages load within time limit', function () { installHotel(); $urls = [ '/help-center', '/help-center/rules', ]; foreach ($urls as $url) { $start = microtime(true); $response = $this->get($url); $end = microtime(true); $duration = ($end - $start) * 1000; $response->assertStatus(200); expect($duration)->toBeLessThan(5000); } }); test('help center has proper html structure', function () { installHotel(); $response = $this->get('/help-center'); $response->assertStatus(200); // HTML structure $response->assertSee(''); $response->assertSee('assertSee(''); $response->assertSee(''); }); test('authenticated user sees personalized help center', function () { installHotel(); $user = User::factory()->create(); $response = $this->actingAs($user)->get('/help-center'); $response->assertStatus(200); // Should show username or personalized content expect(auth()->user()->username)->toBe($user->username); }); test('help center is linked from main navigation', function () { installHotel(); // Get home page $response = $this->get('/'); $response->assertStatus(200); // Help center link should exist (or be accessible) $helpResponse = $this->get('/help-center'); $helpResponse->assertStatus(200); }); test('multiple users can access help center simultaneously', function () { installHotel(); $user1 = User::factory()->create(['username' => 'HelpUser1']); $user2 = User::factory()->create(['username' => 'HelpUser2']); // Both users can access $response1 = $this->actingAs($user1)->get('/help-center'); $response2 = $this->actingAs($user2)->get('/help-center'); $response1->assertStatus(200); $response2->assertStatus(200); expect(auth()->user()->username)->toBe('HelpUser2'); // Last authenticated });