new seeders

This commit is contained in:
Mark Gregory
2026-06-11 15:00:41 +01:00
parent a55b98cf38
commit 6c038f5672
12 changed files with 101 additions and 67 deletions
@@ -13,6 +13,12 @@ trait InteractsWithWmsBrowser
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
}
protected function assertSingleProfessionalHeaderExists(Browser $browser): void
{
$browser->waitFor('.wms-page-hero', 10)
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
}
protected function assertDesktopSidebarIsAvailable(Browser $browser): void
{
$browser->resize(1440, 1000)
@@ -24,7 +30,23 @@ trait InteractsWithWmsBrowser
protected function clickSidebarHref(Browser $browser, string $path): void
{
$browser->script("document.querySelector('.wms-sidebar a[href=\"{$path}\"]')?.click();");
$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;
}
JS);
$browser->waitForLocation($path, 10);
}
@@ -41,7 +63,7 @@ trait InteractsWithWmsBrowser
protected function closeMobileNavigation(Browser $browser): void
{
$browser->click('[data-wms-mobile-close]')
$browser->script('document.querySelector("[data-wms-mobile-close]")?.click();')
->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10)
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'false');
}