Skip to content

date: 2026-06-07 tags: [testing, pest, browser, assertions] status: active graduated_to:

pest-plugin-browser has no assertSeeInOrder — use data-test hooks + assertScript for order

Symptom — Reached for ->assertSeeInOrder([...]) (a Laravel TestResponse / Dusk habit) in a Pest 4 browser test to prove sections render in a fixed order; the method doesn't exist on Pest\Browser\Api\PendingAwaitablePage.

Root causepest-plugin-browser 4.x ships assertSee, assertSeeIn(selector, text), assertSeeAnythingIn, assertCount(selector, n), and assertScript(expr, expected = true) — but no *InOrder assertion.

Fix — Assert grouping with assertSeeIn('[data-test="section-quick"]', 'Reply to Sam'), and order with assertScript, e.g. assertScript("Array.from(document.querySelectorAll('[data-test^=\"section-\"]')).map((e) => e.dataset.test).join(',')", 'section-quick,section-important,…'). That needs stable data-test hooks in the markup, so the change added data-test="section-*" to each digest section in resources/js/pages/Dashboard.vue (mirrors the existing data-test="task-card"). See tests/Browser/PlannedDayTest.php.

Guardtests/Browser/PlannedDayTest.php exercises both patterns; the convention is the data-test="section-*" hooks on Dashboard.vue. Browser tests run in the browser group (CI is the prover — the plugin isn't installed in the default composer test path).