tests fixing ofr modules
This commit is contained in:
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Modules\Helpdesk\Tests\Browser;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Modules\Helpdesk\Tests\Concerns\BuildsHelpdeskFixtures;
|
||||
use Tests\DuskTestCase;
|
||||
@@ -12,7 +11,6 @@ use Tests\DuskTestCase;
|
||||
final class HelpdeskSettingsBrowserTest extends DuskTestCase
|
||||
{
|
||||
use BuildsHelpdeskFixtures;
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function test_settings_tabs_expose_lookup_git_and_workflow_setup_areas(): void
|
||||
{
|
||||
@@ -24,43 +22,63 @@ final class HelpdeskSettingsBrowserTest extends DuskTestCase
|
||||
->visitRoute('helpdesk.settings')
|
||||
->waitFor('@helpdesk-settings-manager')
|
||||
->assertSee('Support configuration')
|
||||
->assertSee('Statuses')
|
||||
->assertSee('Priorities')
|
||||
->assertSee('Categories')
|
||||
->assertSee('Teams')
|
||||
->assertSee('Projects')
|
||||
->assertSee('Git')
|
||||
->assertSee('Workflow')
|
||||
->assertSee('Canned')
|
||||
->assertSee('SLA')
|
||||
->assertSee('Rules')
|
||||
->assertSee('Checks')
|
||||
->assertSee('Tags')
|
||||
->assertSee('Products')
|
||||
->press('Git')
|
||||
->waitForText('Git repositories')
|
||||
->assertSee('Remote URL')
|
||||
->press('Workflow')
|
||||
->waitForText('Workflow messages')
|
||||
->assertSee('HTML email body')
|
||||
->press('Canned')
|
||||
->waitForText('Canned responses')
|
||||
->assertSee('Reply body')
|
||||
->press('SLA')
|
||||
->waitForText('SLA policies')
|
||||
->assertSee('First response minutes')
|
||||
->press('Rules')
|
||||
->waitForText('Email automation rules')
|
||||
->assertSee('Subject contains')
|
||||
->press('Checks')
|
||||
->waitForText('Checklist templates')
|
||||
->assertSee('Checklist items')
|
||||
->press('Tags')
|
||||
->waitForText('Ticket tags')
|
||||
->assertSee('Colour')
|
||||
->press('Products')
|
||||
->waitForText('Products and services')
|
||||
->assertSourceHas('Statuses')
|
||||
->assertSourceHas('Priorities')
|
||||
->assertSourceHas('Categories')
|
||||
->assertSourceHas('Teams')
|
||||
->assertSourceHas('Projects')
|
||||
->assertSourceHas('Git')
|
||||
->assertSourceHas('Workflow')
|
||||
->assertSourceHas('Canned')
|
||||
->assertSourceHas('SLA')
|
||||
->assertSourceHas('Rules')
|
||||
->assertSourceHas('Checks')
|
||||
->assertSourceHas('Tags')
|
||||
->assertSourceHas('Products');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'git');
|
||||
$browser->waitForText('Git repositories', 10)
|
||||
->assertSee('Remote URL');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'workflow');
|
||||
$browser->waitForText('Workflow messages', 10)
|
||||
->assertSee('HTML email body');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'canned');
|
||||
$browser->waitForText('Canned responses', 10)
|
||||
->assertSee('Reply body');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'sla');
|
||||
$browser->waitForText('SLA policies', 10)
|
||||
->assertSee('First response minutes');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'automation');
|
||||
$browser->waitForText('Email automation rules', 10)
|
||||
->assertSee('Subject contains');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'checklists');
|
||||
$browser->waitForText('Checklist templates', 10)
|
||||
->assertSee('Checklist items');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'tags');
|
||||
$browser->waitForText('Ticket tags', 10)
|
||||
->assertSee('Colour');
|
||||
|
||||
$this->setHelpdeskSettingsSection($browser, 'products');
|
||||
$browser->waitForText('Products and services', 10)
|
||||
->assertSee('Release/build');
|
||||
});
|
||||
}
|
||||
|
||||
private function setHelpdeskSettingsSection(Browser $browser, string $section): void
|
||||
{
|
||||
$browser->script(<<<JS
|
||||
const settings = document.querySelector('[dusk="helpdesk-settings-manager"]');
|
||||
const component = settings?.closest('[wire\\:id]');
|
||||
if (! component) {
|
||||
throw new Error('Helpdesk settings Livewire component was not found.');
|
||||
}
|
||||
window.Livewire.find(component.getAttribute('wire:id')).set('section', '{$section}');
|
||||
JS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user