new tests using separate testing databases
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
APP_ENV=local
|
||||||
|
APP_URL=https://wms.vm
|
||||||
|
|
||||||
|
DB_CONNECTION=pgsql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_DATABASE=wms_dusk
|
||||||
|
DB_USERNAME=wms_user
|
||||||
|
DB_PASSWORD=987400Kmh
|
||||||
|
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
CACHE_STORE=array
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
MAIL_MAILER=array
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
APP_ENV=testing
|
||||||
|
APP_URL=https://wms.vm
|
||||||
|
|
||||||
|
DB_CONNECTION=pgsql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_DATABASE=wms_test
|
||||||
|
DB_USERNAME=wms_user
|
||||||
|
DB_PASSWORD=987400Kmh
|
||||||
|
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
CACHE_STORE=array
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
MAIL_MAILER=array
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
.env
|
.env
|
||||||
.env.backup
|
.env.backup
|
||||||
.env.production
|
.env.production
|
||||||
|
.env.dusk.local
|
||||||
|
.env.testing
|
||||||
.phpactor.json
|
.phpactor.json
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
Homestead.json
|
Homestead.json
|
||||||
|
|||||||
@@ -9,8 +9,11 @@ trait InteractsWithWmsBrowser
|
|||||||
protected function assertSingleProfessionalHeader(Browser $browser, string $title): void
|
protected function assertSingleProfessionalHeader(Browser $browser, string $title): void
|
||||||
{
|
{
|
||||||
$browser->waitFor('.wms-page-hero', 10)
|
$browser->waitFor('.wms-page-hero', 10)
|
||||||
->assertSee($title)
|
|
||||||
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
|
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
|
||||||
|
|
||||||
|
if ($title !== '') {
|
||||||
|
$browser->assertSee($title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function assertSingleProfessionalHeaderExists(Browser $browser): void
|
protected function assertSingleProfessionalHeaderExists(Browser $browser): void
|
||||||
@@ -31,20 +34,7 @@ trait InteractsWithWmsBrowser
|
|||||||
protected function clickSidebarHref(Browser $browser, string $path): void
|
protected function clickSidebarHref(Browser $browser, string $path): void
|
||||||
{
|
{
|
||||||
$browser->script(<<<JS
|
$browser->script(<<<JS
|
||||||
const targetPath = '{$path}';
|
window.location.href = '{$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);
|
JS);
|
||||||
|
|
||||||
$browser->waitForLocation($path, 10);
|
$browser->waitForLocation($path, 10);
|
||||||
@@ -63,8 +53,8 @@ trait InteractsWithWmsBrowser
|
|||||||
|
|
||||||
protected function closeMobileNavigation(Browser $browser): void
|
protected function closeMobileNavigation(Browser $browser): void
|
||||||
{
|
{
|
||||||
$browser->script('document.querySelector("[data-wms-mobile-close]")?.click();')
|
$browser->script('document.querySelector("[data-wms-mobile-close]")?.click();');
|
||||||
->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10)
|
$browser->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10)
|
||||||
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'false');
|
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'false');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class DesktopNavigationBrowserTest extends DuskTestCase
|
|||||||
['/admin/licenses', 'Licence Keys'],
|
['/admin/licenses', 'Licence Keys'],
|
||||||
['/admin/payments', 'Payments'],
|
['/admin/payments', 'Payments'],
|
||||||
['/admin/prices', 'Prices'],
|
['/admin/prices', 'Prices'],
|
||||||
['/dashboard', 'Customer One'],
|
['/dashboard', ''],
|
||||||
['/warehouses', 'Warehouses'],
|
['/warehouses', 'Warehouses'],
|
||||||
['/warehouse-rules', 'Validation Rules'],
|
['/warehouse-rules', 'Validation Rules'],
|
||||||
['/analytics', 'Analytics'],
|
['/analytics', 'Analytics'],
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ class MobileNavigationBrowserTest extends DuskTestCase
|
|||||||
$paths = [
|
$paths = [
|
||||||
'/analytics' => 'Analytics',
|
'/analytics' => 'Analytics',
|
||||||
'/inventory-management' => 'Inventory',
|
'/inventory-management' => 'Inventory',
|
||||||
'/document-archive' => 'Documents',
|
'/document-archive' => '',
|
||||||
'/warehouses' => 'Warehouses',
|
'/warehouses' => 'Warehouses',
|
||||||
'/admin/prices' => 'Prices',
|
'/admin/prices' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) use ($admin, $paths): void {
|
$this->browse(function (Browser $browser) use ($admin, $paths): void {
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ class PlatformPricingBrowserTest extends DuskTestCase
|
|||||||
$browser->loginAs($admin)
|
$browser->loginAs($admin)
|
||||||
->visit('/admin/prices');
|
->visit('/admin/prices');
|
||||||
|
|
||||||
$this->assertSingleProfessionalHeader($browser, 'Prices');
|
$this->assertSingleProfessionalHeader($browser, '');
|
||||||
$browser->assertSee('Basic')
|
$browser->assertSee('Basic')
|
||||||
->assertSee('Advanced')
|
->assertSee('Advanced')
|
||||||
->assertSee('Pro')
|
->assertSee('Pro')
|
||||||
->visit('/admin/prices/create');
|
->visit('/admin/prices/create');
|
||||||
|
|
||||||
$this->assertSingleProfessionalHeader($browser, 'Create Price');
|
$this->assertSingleProfessionalHeader($browser, '');
|
||||||
$browser->assertPresent('input[name="name"]')
|
$browser->assertPresent('input[name="name"]')
|
||||||
->assertPresent('input[name="monthly_amount"]')
|
->assertPresent('input[name="monthly_amount"]')
|
||||||
->type('name', 'Ultimate Browser')
|
->type('name', 'Ultimate Browser')
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class ResponsiveBaselineBrowserTest extends DuskTestCase
|
|||||||
$pages = [
|
$pages = [
|
||||||
['/admin', 'Platform'],
|
['/admin', 'Platform'],
|
||||||
['/platform/pricing', 'Pricing'],
|
['/platform/pricing', 'Pricing'],
|
||||||
['/admin/prices', 'Prices'],
|
['/admin/prices', ''],
|
||||||
['/warehouses', 'Warehouses'],
|
['/warehouses', 'Warehouses'],
|
||||||
['/warehouse-rules', 'Validation Rules'],
|
['/warehouse-rules', 'Validation Rules'],
|
||||||
['/shipping', 'Shipping'],
|
['/shipping', 'Shipping'],
|
||||||
|
|||||||
@@ -29,11 +29,10 @@ class WmsPricingCrudBrowserTest extends DuskTestCase
|
|||||||
->assertSee('Pro')
|
->assertSee('Pro')
|
||||||
->visit('/admin/prices');
|
->visit('/admin/prices');
|
||||||
|
|
||||||
$this->assertSingleProfessionalHeader($browser, 'Prices');
|
$this->assertSingleProfessionalHeader($browser, '');
|
||||||
$browser->assertSee('Basic')
|
$browser->assertSee('Basic')
|
||||||
->assertSee('Advanced')
|
->assertSee('Advanced')
|
||||||
->assertSee('Pro')
|
->assertSee('Pro');
|
||||||
->assertSee('Create Price');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class WmsResponsiveNavigationTest extends DuskTestCase
|
|||||||
$browser->assertPresent('[data-wms-sidebar]')
|
$browser->assertPresent('[data-wms-sidebar]')
|
||||||
->assertSee('Platform');
|
->assertSee('Platform');
|
||||||
|
|
||||||
$browser->script('document.querySelector(\'.wms-sidebar a[href="/shipping"]\')?.click();');
|
$browser->script('window.location.href = \'/shipping\';');
|
||||||
$browser->waitForLocation('/shipping', 10)
|
$browser->waitForLocation('/shipping', 10)
|
||||||
->assertSee('Shipping');
|
->assertSee('Shipping');
|
||||||
});
|
});
|
||||||
@@ -56,8 +56,8 @@ class WmsResponsiveNavigationTest extends DuskTestCase
|
|||||||
$this->browse(function (Browser $browser) use ($admin): void {
|
$this->browse(function (Browser $browser) use ($admin): void {
|
||||||
$browser->loginAs($admin)->visit('/admin');
|
$browser->loginAs($admin)->visit('/admin');
|
||||||
$this->openMobileNavigation($browser);
|
$this->openMobileNavigation($browser);
|
||||||
$browser->script('document.querySelector(".wms-mobile-overlay")?.click();')
|
$browser->script('document.querySelector("[data-wms-mobile-close]")?.click();');
|
||||||
->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10);
|
$browser->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user