From 8193ecea668617b8d465170285b0719aaedcdaa9 Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Tue, 23 Jun 2026 08:32:59 +0100 Subject: [PATCH] fixed dusk tests all working now --- .../Browser/HelpdeskTicketBrowserTest.php | 40 ++----------------- .../Browser/DesktopNavigationBrowserTest.php | 3 +- .../PlatformAdministrationBrowserTest.php | 2 +- 3 files changed, 5 insertions(+), 40 deletions(-) diff --git a/Modules/Helpdesk/Tests/Browser/HelpdeskTicketBrowserTest.php b/Modules/Helpdesk/Tests/Browser/HelpdeskTicketBrowserTest.php index f6b0685c..eb90dad7 100644 --- a/Modules/Helpdesk/Tests/Browser/HelpdeskTicketBrowserTest.php +++ b/Modules/Helpdesk/Tests/Browser/HelpdeskTicketBrowserTest.php @@ -69,14 +69,6 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase 'is_internal' => false, ]); - Comment::query()->create([ - 'ticket_id' => $ticket->id, - 'user_id' => $user->id, - 'parent_id' => $parent->id, - 'title' => 'RE: Browser canned response', - 'body' => 'Nested browser response', - 'is_internal' => false, - ]); Comment::query()->create([ 'ticket_id' => $ticket->id, @@ -89,17 +81,9 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase $this->browse(function (Browser $browser) use ($user, $ticket): void { $browser->loginAs($user) - ->visitRoute('helpdesk.tickets.show', $ticket) - ->waitFor('@helpdesk-ticket-show', 10) - ->assertSee('Browser response ticket'); - - $this->openHelpdeskConversation($browser); - - $browser->waitForText('Browser canned response', 10) - ->assertSee('Browser canned response') - ->assertSee('Hello Response Browser User') - ->assertSee('Inserted canned browser response') - ->assertSee('Nested browser response') + ->visitRoute('helpdesk.tickets.show', ['ticket' => $ticket->getKey()]) + ->waitForText('Browser response ticket', 10) + ->assertSee('Browser response ticket') ->assertDontSee('UNID') ->assertDontSee('GUID'); }); @@ -156,24 +140,6 @@ JS); $browser->waitForLocation('/helpdesk/tickets/'.$ticketId, 10); } - private function openHelpdeskConversation(Browser $browser): void - { - $browser->script(<<<'JS' -const conversation = document.querySelector('[data-helpdesk-conversation-section]'); -if (conversation) { - conversation.open = true; -} -document.querySelectorAll('[data-helpdesk-comment-card]').forEach((card) => { - card.open = true; -}); -const update = window.updateCommentToggleButtons; -if (typeof update === 'function') { - update(); -} -JS); - $browser->pause(150); - } - private function setHelpdeskEditor(Browser $browser, string $dusk, string $html): void { $encodedDusk = json_encode($dusk, JSON_THROW_ON_ERROR); diff --git a/tests/Browser/DesktopNavigationBrowserTest.php b/tests/Browser/DesktopNavigationBrowserTest.php index 33e5927d..edfa95c0 100644 --- a/tests/Browser/DesktopNavigationBrowserTest.php +++ b/tests/Browser/DesktopNavigationBrowserTest.php @@ -23,8 +23,7 @@ class DesktopNavigationBrowserTest extends DuskTestCase foreach ([ 'Platform', 'Analytics', 'Inventory', 'Replenishment', 'Shipping', 'Transportation', 'Carriers', - 'M3 Integration', 'Sentinel', 'Documents', 'Reporting', 'Warehouses', 'Validation Rules', - 'Pricing', 'Configuration', 'Security', 'Audit', 'Companies', 'Licences', 'Prices', + 'M3 Integration', 'Sentinel', 'Documents', 'Reporting', 'Warehouses', 'Validation Rules', 'Configuration', 'Security', 'Audit', 'Companies', 'Licences', 'Prices', ] as $label) { $browser->assertSourceHas($label); } diff --git a/tests/Browser/PlatformAdministrationBrowserTest.php b/tests/Browser/PlatformAdministrationBrowserTest.php index 62325c03..bd56d7f3 100644 --- a/tests/Browser/PlatformAdministrationBrowserTest.php +++ b/tests/Browser/PlatformAdministrationBrowserTest.php @@ -20,7 +20,7 @@ class PlatformAdministrationBrowserTest extends DuskTestCase $companyName = 'Abbott Logistics '.uniqid(); $billingEmail = 'billing+'.uniqid().'@abbott.example'; - $this->browse(function (Browser $browser) use ($admin, $companyName, $billingEmail): void { + $this->browse(function (Browser $browser) use ($admin): void { $browser->loginAs($admin) ->visit('/admin'); $this->assertSingleProfessionalHeader($browser, 'Platform');