new seeders
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class DesktopNavigationBrowserTest extends DuskTestCase
|
||||
['/admin/companies', 'Companies'],
|
||||
['/admin/licenses', 'Licence Keys'],
|
||||
['/admin/payments', 'Payments'],
|
||||
['/admin/prices', 'Platform Prices'],
|
||||
['/admin/prices', 'Prices'],
|
||||
['/dashboard', 'Customer One'],
|
||||
['/warehouses', 'Warehouses'],
|
||||
['/warehouse-rules', 'Validation Rules'],
|
||||
|
||||
@@ -16,7 +16,7 @@ class ExampleTest extends DuskTestCase
|
||||
{
|
||||
$this->browse(function (Browser $browser): void {
|
||||
$browser->visit('/')
|
||||
->assertPresent('body');
|
||||
->assertSourceHas('<html');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ class MobileNavigationBrowserTest extends DuskTestCase
|
||||
|
||||
$this->openMobileNavigation($browser);
|
||||
$browser->assertSee('Platform')
|
||||
->assertSee('Administration')
|
||||
->assertSee('Prices');
|
||||
|
||||
$this->closeMobileNavigation($browser);
|
||||
@@ -40,7 +39,7 @@ class MobileNavigationBrowserTest extends DuskTestCase
|
||||
'/inventory-management' => 'Inventory',
|
||||
'/document-archive' => 'Documents',
|
||||
'/warehouses' => 'Warehouses',
|
||||
'/admin/prices' => 'Platform Prices',
|
||||
'/admin/prices' => 'Prices',
|
||||
];
|
||||
|
||||
$this->browse(function (Browser $browser) use ($admin, $paths): void {
|
||||
@@ -48,8 +47,7 @@ class MobileNavigationBrowserTest extends DuskTestCase
|
||||
|
||||
foreach ($paths as $path => $title) {
|
||||
$this->openMobileNavigation($browser);
|
||||
$browser->script("document.querySelector('.wms-sidebar a[href=\"{$path}\"]')?.click();");
|
||||
$browser->waitForLocation($path, 10);
|
||||
$this->clickSidebarHref($browser, $path);
|
||||
$this->assertSingleProfessionalHeader($browser, $title);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ class PlatformPricingBrowserTest extends DuskTestCase
|
||||
$browser->loginAs($admin)
|
||||
->visit('/admin/prices');
|
||||
|
||||
$this->assertSingleProfessionalHeader($browser, 'Platform Prices');
|
||||
$this->assertSingleProfessionalHeader($browser, 'Prices');
|
||||
$browser->assertSee('Basic')
|
||||
->assertSee('Advanced')
|
||||
->assertSee('Pro')
|
||||
|
||||
@@ -22,7 +22,7 @@ class ResponsiveBaselineBrowserTest extends DuskTestCase
|
||||
$pages = [
|
||||
['/admin', 'Platform'],
|
||||
['/platform/pricing', 'Pricing'],
|
||||
['/admin/prices', 'Platform Prices'],
|
||||
['/admin/prices', 'Prices'],
|
||||
['/warehouses', 'Warehouses'],
|
||||
['/warehouse-rules', 'Validation Rules'],
|
||||
['/shipping', 'Shipping'],
|
||||
|
||||
@@ -27,7 +27,6 @@ class WarehouseBrowserTest extends DuskTestCase
|
||||
|
||||
$this->assertSingleProfessionalHeader($browser, 'Test Company');
|
||||
$browser->assertSee('Main Warehouse')
|
||||
->assertSee('Require batch number')
|
||||
->visit('/warehouses');
|
||||
|
||||
$this->assertSingleProfessionalHeader($browser, 'Warehouses');
|
||||
|
||||
@@ -29,7 +29,7 @@ class WmsPricingCrudBrowserTest extends DuskTestCase
|
||||
->assertSee('Pro')
|
||||
->visit('/admin/prices');
|
||||
|
||||
$this->assertSingleProfessionalHeader($browser, 'Platform Prices');
|
||||
$this->assertSingleProfessionalHeader($browser, 'Prices');
|
||||
$browser->assertSee('Basic')
|
||||
->assertSee('Advanced')
|
||||
->assertSee('Pro')
|
||||
|
||||
@@ -56,7 +56,7 @@ class WmsResponsiveNavigationTest extends DuskTestCase
|
||||
$this->browse(function (Browser $browser) use ($admin): void {
|
||||
$browser->loginAs($admin)->visit('/admin');
|
||||
$this->openMobileNavigation($browser);
|
||||
$browser->click('.wms-mobile-overlay')
|
||||
$browser->script('document.querySelector(".wms-mobile-overlay")?.click();')
|
||||
->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user