Files
coolify/tests/v4/Browser/TableDropdownCloseTest.php
T
e3d4411ff2 chore: merge main into release/v4.5 (#12192)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Furox <177975472+Furox-Art@users.noreply.github.com>
Co-authored-by: johandenhollander <johan.den.hollander@finalist.nl>
Co-authored-by: João Cruz <161638790+SrJooJ@users.noreply.github.com>
Co-authored-by: Saim Hashmi <hashmisaim037@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-18 23:43:20 +02:00

51 lines
1.6 KiB
PHP

<?php
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('closes the table dropdown without calling window.close when an option is clicked', function () {
$stack = seedBrowserResourceStack();
$page = visit('/login')
->fill('email', 'test@example.com')
->fill('password', 'password')
->click('Login')
->assertSee('Dashboard')
->navigate(route('project.resource.create', [
'project_uuid' => $stack['project']->uuid,
'environment_uuid' => $stack['environment']->uuid,
]))
->assertSee('Filter');
$page->script(<<<'JS'
() => {
window.__windowCloseCalls = 0;
window.close = () => window.__windowCloseCalls++;
[...document.querySelectorAll('button')].find(button => button.textContent.trim() === 'Filter').click();
}
JS);
$page->wait(0.5);
$page->script(<<<'JS'
() => [...document.querySelectorAll('[role="option"]')]
.find(option => option.textContent.trim() === 'Applications')
.click()
JS);
$page->wait(0.5);
$state = $page->script(<<<'JS'
() => {
const trigger = [...document.querySelectorAll('button')].find(button => button.textContent.trim() === 'Filter');
return {
windowCloseCalls: window.__windowCloseCalls,
open: Alpine.$data(trigger.closest('[x-data]')).open,
};
}
JS);
expect($state)->toBe(['windowCloseCalls' => 0, 'open' => false]);
$page->screenshot(filename: 'table-dropdown-close');
});