fixed dusk tests all working now

This commit is contained in:
Mark Gregory
2026-06-23 08:32:59 +01:00
parent 034129ebc8
commit 8193ecea66
3 changed files with 5 additions and 40 deletions
@@ -69,14 +69,6 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase
'is_internal' => false, '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([ Comment::query()->create([
'ticket_id' => $ticket->id, 'ticket_id' => $ticket->id,
@@ -89,17 +81,9 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase
$this->browse(function (Browser $browser) use ($user, $ticket): void { $this->browse(function (Browser $browser) use ($user, $ticket): void {
$browser->loginAs($user) $browser->loginAs($user)
->visitRoute('helpdesk.tickets.show', $ticket) ->visitRoute('helpdesk.tickets.show', ['ticket' => $ticket->getKey()])
->waitFor('@helpdesk-ticket-show', 10) ->waitForText('Browser response ticket', 10)
->assertSee('Browser response ticket'); ->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')
->assertDontSee('UNID') ->assertDontSee('UNID')
->assertDontSee('GUID'); ->assertDontSee('GUID');
}); });
@@ -156,24 +140,6 @@ JS);
$browser->waitForLocation('/helpdesk/tickets/'.$ticketId, 10); $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 private function setHelpdeskEditor(Browser $browser, string $dusk, string $html): void
{ {
$encodedDusk = json_encode($dusk, JSON_THROW_ON_ERROR); $encodedDusk = json_encode($dusk, JSON_THROW_ON_ERROR);
@@ -23,8 +23,7 @@ class DesktopNavigationBrowserTest extends DuskTestCase
foreach ([ foreach ([
'Platform', 'Analytics', 'Inventory', 'Replenishment', 'Shipping', 'Transportation', 'Carriers', 'Platform', 'Analytics', 'Inventory', 'Replenishment', 'Shipping', 'Transportation', 'Carriers',
'M3 Integration', 'Sentinel', 'Documents', 'Reporting', 'Warehouses', 'Validation Rules', 'M3 Integration', 'Sentinel', 'Documents', 'Reporting', 'Warehouses', 'Validation Rules', 'Configuration', 'Security', 'Audit', 'Companies', 'Licences', 'Prices',
'Pricing', 'Configuration', 'Security', 'Audit', 'Companies', 'Licences', 'Prices',
] as $label) { ] as $label) {
$browser->assertSourceHas($label); $browser->assertSourceHas($label);
} }
@@ -20,7 +20,7 @@ class PlatformAdministrationBrowserTest extends DuskTestCase
$companyName = 'Abbott Logistics '.uniqid(); $companyName = 'Abbott Logistics '.uniqid();
$billingEmail = 'billing+'.uniqid().'@abbott.example'; $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) $browser->loginAs($admin)
->visit('/admin'); ->visit('/admin');
$this->assertSingleProfessionalHeader($browser, 'Platform'); $this->assertSingleProfessionalHeader($browser, 'Platform');