browser()->timeout(15_000); it('smokes the baseline compare matrix render, filter interaction, and finding drilldown continuity', function (): void { $fixture = $this->makeBaselineCompareMatrixFixture(); $run = $this->makeBaselineCompareMatrixRun( $fixture['visibleTenant'], $fixture['profile'], $fixture['snapshot'], ); $this->makeBaselineCompareMatrixRun( $fixture['visibleTenantTwo'], $fixture['profile'], $fixture['snapshot'], ); $finding = $this->makeBaselineCompareMatrixFinding( $fixture['visibleTenant'], $fixture['profile'], $run, 'wifi-corp-profile', ['severity' => Finding::SEVERITY_CRITICAL], ); $this->actingAs($fixture['user'])->withSession([ WorkspaceContext::SESSION_KEY => (int) $fixture['workspace']->getKey(), WorkspaceContext::LAST_TENANT_IDS_SESSION_KEY => [ (string) $fixture['workspace']->getKey() => (int) $fixture['visibleTenant']->getKey(), ], ]); session()->put(WorkspaceContext::SESSION_KEY, (int) $fixture['workspace']->getKey()); $page = visit(BaselineProfileResource::compareMatrixUrl($fixture['profile'])); $page ->assertNoJavaScriptErrors() ->waitForText('Visible-set baseline') ->assertSee('Reference overview') ->assertSee('No narrowing filters are active') ->assertSee('Subject-by-tenant matrix') ->assertSee('WiFi Corp Profile') ->assertSee('Windows Compliance') ->assertSee('Open finding'); $page->script(<<<'JS' const input = Array.from(document.querySelectorAll('input[type="checkbox"]')).find((element) => { if (element.getAttribute('aria-label') === 'Drift detected') { return true; } const label = element.closest('label'); return label instanceof HTMLLabelElement && label.innerText.includes('Drift detected'); }); if (! (input instanceof HTMLInputElement)) { throw new Error('Drift detected checkbox not found.'); } input.click(); input.dispatchEvent(new Event('input', { bubbles: true })); input.dispatchEvent(new Event('change', { bubbles: true })); JS); $page ->wait(1) ->waitForText('Open finding') ->assertDontSee('Windows Compliance') ->click('Open finding') ->waitForText('Back to compare matrix') ->assertNoJavaScriptErrors() ->assertSee('Back to compare matrix'); });