interim dusk fixes
This commit is contained in:
@@ -47,8 +47,8 @@
|
||||
this.syncToLivewire(false);
|
||||
},
|
||||
}"
|
||||
x-on:helpdesk-editor-sync.window="if (($event.detail?.model || model) === model) syncToLivewire(false)"
|
||||
x-on:helpdesk-editor-reset.window="if (($event.detail?.model || model) === model) resetEditor()"
|
||||
x-on:helpdesk-editor-sync.window="if (! $event.detail?.model || $event.detail.model === @js($model)) syncToLivewire(false)"
|
||||
x-on:helpdesk-editor-reset.window="if (! $event.detail?.model || $event.detail.model === @js($model)) resetEditor()"
|
||||
>
|
||||
<label for="{{ $model }}-editor" class="block text-sm font-semibold text-zinc-200">
|
||||
{{ $label }}
|
||||
@@ -105,6 +105,8 @@
|
||||
aria-multiline="true"
|
||||
data-placeholder="{{ $placeholder }}"
|
||||
data-wire-model="{{ $model }}"
|
||||
data-helpdesk-sync-target="{{ $model }}"
|
||||
data-helpdesk-editor-model="{{ $model }}"
|
||||
@if ($editorDusk) data-dusk="{{ $editorDusk }}" dusk="{{ $editorDusk }}" @endif
|
||||
x-on:blur="syncToLivewire(false)"
|
||||
class="helpdesk-rich-editor block min-h-[14rem] w-full overflow-y-auto whitespace-pre-wrap break-words border-0 bg-zinc-950 px-5 py-4 text-base leading-7 text-zinc-100 outline-none transition placeholder:text-zinc-500 empty:before:pointer-events-none empty:before:text-zinc-500 empty:before:content-[attr(data-placeholder)] focus:ring-2 focus:ring-blue-500"
|
||||
|
||||
@@ -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