more tests fixes
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
APP_URL=http://127.0.0.1:8000
|
APP_URL=https://wms.vm
|
||||||
SESSION_DRIVER=file
|
SESSION_DRIVER=file
|
||||||
CACHE_STORE=array
|
CACHE_STORE=array
|
||||||
|
|
||||||
|
|||||||
@@ -36,57 +36,61 @@ final class HelpdeskSettingsBrowserTest extends DuskTestCase
|
|||||||
->assertSourceHas('Tags')
|
->assertSourceHas('Tags')
|
||||||
->assertSourceHas('Products');
|
->assertSourceHas('Products');
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'git');
|
$this->openSettingsSection($browser, 'Git', 'Git repositories');
|
||||||
$browser->waitForText('Git repositories', 10)
|
$browser->assertSee('Remote URL');
|
||||||
->assertSee('Remote URL');
|
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'workflow');
|
$this->openSettingsSection($browser, 'Workflow', 'Workflow messages');
|
||||||
$browser->waitForText('Workflow messages', 10)
|
$browser->assertSee('HTML email body');
|
||||||
->assertSee('HTML email body');
|
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'canned');
|
$this->openSettingsSection($browser, 'Canned', 'Canned responses');
|
||||||
$browser->waitForText('Canned responses', 10)
|
$browser->assertSee('Reply body');
|
||||||
->assertSee('Reply body');
|
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'sla');
|
$this->openSettingsSection($browser, 'SLA', 'SLA policies');
|
||||||
$browser->waitForText('SLA policies', 10)
|
$browser->assertSee('First response minutes');
|
||||||
->assertSee('First response minutes');
|
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'automation');
|
$this->openSettingsSection($browser, 'Rules', 'Email automation rules');
|
||||||
$browser->waitForText('Email automation rules', 10)
|
$browser->assertSee('Subject contains');
|
||||||
->assertSee('Subject contains');
|
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'checklists');
|
$this->openSettingsSection($browser, 'Checks', 'Checklist templates');
|
||||||
$browser->waitForText('Checklist templates', 10)
|
$browser->assertSee('Checklist items');
|
||||||
->assertSee('Checklist items');
|
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'tags');
|
$this->openSettingsSection($browser, 'Tags', 'Ticket tags');
|
||||||
$browser->waitForText('Ticket tags', 10)
|
$browser->assertSee('Colour');
|
||||||
->assertSee('Colour');
|
|
||||||
|
|
||||||
$this->setHelpdeskSettingsSection($browser, 'products');
|
$this->openSettingsSection($browser, 'Products', 'Products and services');
|
||||||
$browser->waitForText('Products and services', 10)
|
$browser->assertSee('Release/build');
|
||||||
->assertSee('Release/build');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setHelpdeskSettingsSection(Browser $browser, string $section): void
|
/**
|
||||||
|
* Click a visible Helpdesk settings section card by its rendered label.
|
||||||
|
*
|
||||||
|
* This intentionally exercises the real UI instead of mutating Livewire internals.
|
||||||
|
*/
|
||||||
|
private function openSettingsSection(Browser $browser, string $label, string $expectedText): void
|
||||||
{
|
{
|
||||||
$encodedSection = json_encode($section, JSON_THROW_ON_ERROR);
|
$encodedLabel = json_encode($label, JSON_THROW_ON_ERROR);
|
||||||
|
|
||||||
$browser->script(<<<JS
|
$browser->script(<<<JS
|
||||||
const settings = document.querySelector('[dusk="helpdesk-settings-manager"]');
|
const manager = document.querySelector('[dusk="helpdesk-settings-manager"]');
|
||||||
|
|
||||||
let component = settings;
|
if (! manager) {
|
||||||
while (component && ! component.hasAttribute('wire:id')) {
|
throw new Error('Helpdesk settings manager was not found.');
|
||||||
component = component.parentElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! component) {
|
const button = Array.from(manager.querySelectorAll('button')).find((candidate) => {
|
||||||
throw new Error('Helpdesk settings Livewire component was not found.');
|
const text = candidate.textContent.replace(/\s+/g, ' ').trim();
|
||||||
|
|
||||||
|
return text === {$encodedLabel} || text.startsWith({$encodedLabel} + ' ');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (! button) {
|
||||||
|
throw new Error('Helpdesk settings section button was not found: ' + {$encodedLabel});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Livewire.find(component.getAttribute('wire:id')).set('section', {$encodedSection});
|
button.click();
|
||||||
JS);
|
JS);
|
||||||
|
|
||||||
|
$browser->waitForText($expectedText, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a property on the Livewire create-ticket component from the real form root.
|
||||||
|
*/
|
||||||
private function setTicketCreateProperty(Browser $browser, string $property, mixed $value): void
|
private function setTicketCreateProperty(Browser $browser, string $property, mixed $value): void
|
||||||
{
|
{
|
||||||
$encodedProperty = json_encode($property, JSON_THROW_ON_ERROR);
|
$encodedProperty = json_encode($property, JSON_THROW_ON_ERROR);
|
||||||
@@ -76,19 +79,23 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase
|
|||||||
$browser->script(<<<JS
|
$browser->script(<<<JS
|
||||||
const form = document.querySelector('.helpdesk-ticket-form');
|
const form = document.querySelector('.helpdesk-ticket-form');
|
||||||
|
|
||||||
let component = form;
|
if (! form) {
|
||||||
while (component && ! component.hasAttribute('wire:id')) {
|
throw new Error('Helpdesk ticket create form was not found.');
|
||||||
component = component.parentElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! component) {
|
const componentRoot = form.closest('[wire\\:id]');
|
||||||
|
|
||||||
|
if (! componentRoot || ! window.Livewire) {
|
||||||
throw new Error('Helpdesk ticket create Livewire component was not found.');
|
throw new Error('Helpdesk ticket create Livewire component was not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Livewire.find(component.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
window.Livewire.find(componentRoot.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
||||||
JS);
|
JS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a property on the Livewire ticket-show component from the real show-page root.
|
||||||
|
*/
|
||||||
private function setTicketShowProperty(Browser $browser, string $property, mixed $value): void
|
private function setTicketShowProperty(Browser $browser, string $property, mixed $value): void
|
||||||
{
|
{
|
||||||
$encodedProperty = json_encode($property, JSON_THROW_ON_ERROR);
|
$encodedProperty = json_encode($property, JSON_THROW_ON_ERROR);
|
||||||
@@ -97,16 +104,17 @@ JS);
|
|||||||
$browser->script(<<<JS
|
$browser->script(<<<JS
|
||||||
const show = document.querySelector('[dusk="helpdesk-ticket-show"]');
|
const show = document.querySelector('[dusk="helpdesk-ticket-show"]');
|
||||||
|
|
||||||
let component = show;
|
if (! show) {
|
||||||
while (component && ! component.hasAttribute('wire:id')) {
|
throw new Error('Helpdesk ticket show root was not found.');
|
||||||
component = component.parentElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! component) {
|
const componentRoot = show.closest('[wire\\:id]');
|
||||||
|
|
||||||
|
if (! componentRoot || ! window.Livewire) {
|
||||||
throw new Error('Helpdesk ticket show Livewire component was not found.');
|
throw new Error('Helpdesk ticket show Livewire component was not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Livewire.find(component.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
window.Livewire.find(componentRoot.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
||||||
JS);
|
JS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,7 @@
|
|||||||
"@php artisan dusk"
|
"@php artisan dusk"
|
||||||
],
|
],
|
||||||
"dusk:serve": [
|
"dusk:serve": [
|
||||||
|
"Composer\\Config::disableProcessTimeout",
|
||||||
"php artisan serve --env=dusk.local --host=127.0.0.1 --port=8000"
|
"php artisan serve --env=dusk.local --host=127.0.0.1 --port=8000"
|
||||||
],
|
],
|
||||||
"dusk:fresh": [
|
"dusk:fresh": [
|
||||||
|
|||||||
@@ -30,13 +30,15 @@ abstract class DuskTestCase extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
protected function driver(): RemoteWebDriver
|
protected function driver(): RemoteWebDriver
|
||||||
{
|
{
|
||||||
$options = (new ChromeOptions)->addArguments([
|
$options = (new ChromeOptions())->addArguments([
|
||||||
'--disable-gpu',
|
'--disable-gpu',
|
||||||
'--headless=new',
|
'--headless=new',
|
||||||
'--window-size=1920,1080',
|
'--window-size=1920,1080',
|
||||||
'--no-sandbox',
|
'--no-sandbox',
|
||||||
'--disable-dev-shm-usage',
|
'--disable-dev-shm-usage',
|
||||||
'--disable-search-engine-choice-screen',
|
'--disable-search-engine-choice-screen',
|
||||||
|
'--ignore-certificate-errors',
|
||||||
|
'--allow-insecure-localhost',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return RemoteWebDriver::create(
|
return RemoteWebDriver::create(
|
||||||
@@ -80,7 +82,8 @@ abstract class DuskTestCase extends BaseTestCase
|
|||||||
));
|
));
|
||||||
|
|
||||||
usort($candidates, static function (string $left, string $right): int {
|
usort($candidates, static function (string $left, string $right): int {
|
||||||
$score = static fn (string $path): int => str_contains($path, 'mac-arm64') ? 0
|
$score = static fn (string $path): int =>
|
||||||
|
str_contains($path, 'mac-arm64') ? 0
|
||||||
: (str_contains($path, 'mac-arm') ? 1
|
: (str_contains($path, 'mac-arm') ? 1
|
||||||
: (str_contains($path, 'mac') ? 2 : 3));
|
: (str_contains($path, 'mac') ? 2 : 3));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user