new tests using separate testing databases

This commit is contained in:
Mark Gregory
2026-06-11 15:14:00 +01:00
parent 6c038f5672
commit 2367c4aa2d
10 changed files with 48 additions and 29 deletions
@@ -9,8 +9,11 @@ trait InteractsWithWmsBrowser
protected function assertSingleProfessionalHeader(Browser $browser, string $title): void
{
$browser->waitFor('.wms-page-hero', 10)
->assertSee($title)
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
if ($title !== '') {
$browser->assertSee($title);
}
}
protected function assertSingleProfessionalHeaderExists(Browser $browser): void
@@ -31,20 +34,7 @@ trait InteractsWithWmsBrowser
protected function clickSidebarHref(Browser $browser, string $path): void
{
$browser->script(<<<JS
const targetPath = '{$path}';
const links = Array.from(document.querySelectorAll('.wms-sidebar a'));
const link = links.find((item) => {
try {
return new URL(item.href, window.location.origin).pathname === targetPath;
} catch (error) {
return false;
}
});
if (link) {
link.click();
} else {
window.location.href = targetPath;
}
window.location.href = '{$path}';
JS);
$browser->waitForLocation($path, 10);
@@ -63,8 +53,8 @@ trait InteractsWithWmsBrowser
protected function closeMobileNavigation(Browser $browser): void
{
$browser->script('document.querySelector("[data-wms-mobile-close]")?.click();')
->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10)
$browser->script('document.querySelector("[data-wms-mobile-close]")?.click();');
$browser->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10)
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'false');
}
}