Fix display voice prompts requiring browser unlock and failed acks.
Deploy Ladill Queue / deploy (push) Successful in 28s

Add tap-to-enable speech overlay, stop marking announcements played on TTS errors, pick voices by locale, and scope pending announcements to the display's queues.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-29 22:21:56 +00:00
co-authored by Cursor
parent 3fd7c22ec9
commit af764f77fb
5 changed files with 282 additions and 13 deletions
+117
View File
@@ -0,0 +1,117 @@
<?php
namespace Tests\Feature;
use App\Models\Branch;
use App\Models\Counter;
use App\Models\DisplayScreen;
use App\Models\Organization;
use App\Models\ServiceQueue;
use App\Models\User;
use App\Models\VoiceAnnouncement;
use App\Services\Qms\OrganizationResolver;
use App\Services\Qms\QueueEngine;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class DisplayVoiceTest extends TestCase
{
use RefreshDatabase;
/**
* @return array{0: User, 1: Organization, 2: Branch, 3: ServiceQueue}
*/
protected function setUpOrg(): array
{
$user = User::create([
'public_id' => 'test-owner-uuid',
'name' => 'Test User',
'email' => 'test@example.com',
'password' => bcrypt('password'),
]);
$resolver = app(OrganizationResolver::class);
$org = $resolver->completeOnboarding($user, [
'organization_name' => 'Test Org',
'industry' => 'retail',
'appointment_mode' => 'hybrid',
'branch_name' => 'Main',
'timezone' => 'UTC',
]);
$branch = Branch::first();
$queue = ServiceQueue::create([
'owner_ref' => $user->public_id,
'organization_id' => $org->id,
'branch_id' => $branch->id,
'name' => 'Reception',
'prefix' => 'A',
'strategy' => 'fifo',
'is_active' => true,
]);
return [$user, $org, $branch, $queue];
}
public function test_display_data_includes_pending_announcement_after_call(): void
{
[$user, , $branch, $queue] = $this->setUpOrg();
$counter = Counter::create([
'owner_ref' => $user->public_id,
'organization_id' => $queue->organization_id,
'branch_id' => $queue->branch_id,
'name' => 'Counter 1',
'status' => 'available',
'is_active' => true,
]);
$screen = DisplayScreen::create([
'owner_ref' => $user->public_id,
'organization_id' => $queue->organization_id,
'branch_id' => $branch->id,
'name' => 'Lobby',
'layout' => 'standard',
'service_queue_ids' => [$queue->id],
'is_active' => true,
]);
$engine = app(QueueEngine::class);
$ticket = $engine->issueTicket($queue, $user->public_id);
$engine->callTicket($ticket, $counter, $user->public_id);
$response = $this->getJson(route('qms.display.data', $screen->access_token));
$response->assertOk()
->assertJsonPath('announcements.0.message', 'Ticket A001, please proceed to Counter 1.');
}
public function test_display_marks_announcement_played(): void
{
[$user, , $branch, $queue] = $this->setUpOrg();
$screen = DisplayScreen::create([
'owner_ref' => $user->public_id,
'organization_id' => $queue->organization_id,
'branch_id' => $branch->id,
'name' => 'Lobby',
'layout' => 'standard',
'service_queue_ids' => [$queue->id],
'is_active' => true,
]);
$announcement = VoiceAnnouncement::create([
'owner_ref' => $user->public_id,
'organization_id' => $queue->organization_id,
'branch_id' => $branch->id,
'locale' => 'en',
'message' => 'Ticket A001, please proceed to Counter 1.',
'status' => 'pending',
]);
$this->postJson(route('qms.display.announcement.played', [
'token' => $screen->access_token,
'announcement' => $announcement->id,
]))->assertOk();
$this->assertSame('played', $announcement->fresh()->status);
}
}