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);
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Helpdesk\Models\Category;
|
||||
use Modules\Helpdesk\Models\GitRepository;
|
||||
use Modules\Helpdesk\Models\KanbanBoard;
|
||||
@@ -51,7 +52,7 @@ trait BuildsHelpdeskFixtures
|
||||
{
|
||||
return Status::query()->create(array_merge([
|
||||
'name' => 'Open',
|
||||
'slug' => fake()->unique()->slug(2),
|
||||
'slug' => 'test-' . Str::uuid()->toString(),
|
||||
'color' => 'blue',
|
||||
'sort_order' => 10,
|
||||
'is_closed' => false,
|
||||
@@ -62,7 +63,7 @@ trait BuildsHelpdeskFixtures
|
||||
{
|
||||
return $this->ticketStatus(array_merge([
|
||||
'name' => 'Closed',
|
||||
'slug' => fake()->unique()->slug(2),
|
||||
'slug' => 'test-' . Str::uuid()->toString(),
|
||||
'color' => 'green',
|
||||
'sort_order' => 99,
|
||||
'is_closed' => true,
|
||||
@@ -73,7 +74,7 @@ trait BuildsHelpdeskFixtures
|
||||
{
|
||||
return Priority::query()->create(array_merge([
|
||||
'name' => 'Normal',
|
||||
'slug' => fake()->unique()->slug(2),
|
||||
'slug' => 'test-' . Str::uuid()->toString(),
|
||||
'color' => 'blue',
|
||||
'sort_order' => 10,
|
||||
], $attributes));
|
||||
@@ -84,7 +85,7 @@ trait BuildsHelpdeskFixtures
|
||||
return Category::query()->create(array_merge([
|
||||
'company_id' => null,
|
||||
'name' => 'Support',
|
||||
'slug' => fake()->unique()->slug(2),
|
||||
'slug' => 'test-' . Str::uuid()->toString(),
|
||||
'color' => 'blue',
|
||||
'description' => 'Support requests',
|
||||
], $attributes));
|
||||
@@ -95,7 +96,7 @@ trait BuildsHelpdeskFixtures
|
||||
return Team::query()->create(array_merge([
|
||||
'company_id' => null,
|
||||
'name' => 'Support Team',
|
||||
'slug' => fake()->unique()->slug(2),
|
||||
'slug' => 'test-' . Str::uuid()->toString(),
|
||||
'color' => 'indigo',
|
||||
'description' => 'Primary support team',
|
||||
], $attributes));
|
||||
@@ -107,7 +108,7 @@ trait BuildsHelpdeskFixtures
|
||||
'company_id' => null,
|
||||
'team_id' => null,
|
||||
'title' => 'WMS Project',
|
||||
'slug' => fake()->unique()->slug(2),
|
||||
'slug' => 'test-' . Str::uuid()->toString(),
|
||||
'color' => 'blue',
|
||||
'description' => 'Warehouse platform project',
|
||||
], $attributes));
|
||||
|
||||
Reference in New Issue
Block a user