interim dusk fixes
This commit is contained in:
@@ -34,11 +34,13 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase
|
||||
$this->setHelpdeskSelect($browser, 'team_id', $fixtures['team']->id);
|
||||
$this->setHelpdeskSelect($browser, 'project_id', $fixtures['project']->id);
|
||||
|
||||
$browser->press('@ticket-create-submit')
|
||||
->waitUntilMissing('@helpdesk-ticket-create', 15)
|
||||
->assertPathBeginsWith('/helpdesk/tickets/')
|
||||
->waitForText($subject, 15)
|
||||
->assertSee($subject);
|
||||
$browser->pause(500)
|
||||
->press('@ticket-create-submit')
|
||||
->waitForLocation('/helpdesk/tickets', 15)
|
||||
->waitFor('@helpdesk-ticket-index', 15)
|
||||
->assertSee($subject)
|
||||
->assertSee('High')
|
||||
->assertSee('Support');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,45 +100,6 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase
|
||||
]);
|
||||
}
|
||||
|
||||
private function submitNestedCommentThroughBrowser(Browser $browser, int|string $ticketId, int|string $parentId): void
|
||||
{
|
||||
$action = route('helpdesk.tickets.comments.store', ['ticket' => $ticketId]);
|
||||
$encodedAction = json_encode($action, JSON_THROW_ON_ERROR);
|
||||
$encodedParentId = json_encode((string) $parentId, JSON_THROW_ON_ERROR);
|
||||
|
||||
$browser->script(<<<JS
|
||||
const action = {$encodedAction};
|
||||
const parentId = {$encodedParentId};
|
||||
const token = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content')
|
||||
|| document.querySelector('input[name="_token"]')?.value;
|
||||
|
||||
const form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = action;
|
||||
form.style.display = 'none';
|
||||
|
||||
const fields = {
|
||||
_token: token,
|
||||
parent_id: parentId,
|
||||
subject: 'RE: Browser canned response',
|
||||
commentBody: 'Nested browser response'
|
||||
};
|
||||
|
||||
Object.entries(fields).forEach(([name, value]) => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = name;
|
||||
input.value = value || '';
|
||||
form.appendChild(input);
|
||||
});
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
JS);
|
||||
|
||||
$browser->waitForLocation('/helpdesk/tickets/' . $ticketId, 10);
|
||||
}
|
||||
|
||||
private function setHelpdeskEditor(Browser $browser, string $dusk, string $html): void
|
||||
{
|
||||
$encodedDusk = json_encode($dusk, JSON_THROW_ON_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user