UPDATED TESTS
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\Browser\Concerns\InteractsWithWmsBrowser;
|
||||
use Tests\Browser\Concerns\InteractsWithWmsData;
|
||||
use Tests\DuskTestCase;
|
||||
|
||||
class ResponsiveBaselineBrowserTest extends DuskTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
use InteractsWithWmsBrowser;
|
||||
use InteractsWithWmsData;
|
||||
|
||||
/**
|
||||
* @dataProvider responsivePages
|
||||
*/
|
||||
public function test_core_pages_render_on_mobile_tablet_and_desktop(string $path, string $title): void
|
||||
{
|
||||
$admin = $this->platformAdminUser();
|
||||
$this->seedPlatformDashboardData();
|
||||
|
||||
$this->browse(function (Browser $browser) use ($admin, $path, $title): void {
|
||||
$browser->loginAs($admin);
|
||||
|
||||
foreach ([[390, 844], [820, 1180], [1440, 1000]] as [$width, $height]) {
|
||||
$browser->resize($width, $height)
|
||||
->visit($path)
|
||||
->waitFor('.wms-page-hero', 5);
|
||||
|
||||
$this->assertSingleProfessionalHeader($browser, $title);
|
||||
|
||||
if ($width < 1024) {
|
||||
$browser->assertVisible('[data-wms-mobile-open]');
|
||||
} else {
|
||||
$browser->assertVisible('.wms-sidebar');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array{0: string, 1: string}>
|
||||
*/
|
||||
public static function responsivePages(): array
|
||||
{
|
||||
return [
|
||||
'platform dashboard' => ['/admin', 'Platform'],
|
||||
'platform pricing' => ['/platform/pricing', 'Pricing'],
|
||||
'admin prices' => ['/admin/prices', 'Platform Prices'],
|
||||
'warehouse dashboard' => ['/dashboard', 'Warehouse'],
|
||||
'warehouses' => ['/warehouses', 'Warehouses'],
|
||||
'validation rules' => ['/warehouse-rules', 'Validation Rules'],
|
||||
'analytics' => ['/analytics', 'Analytics'],
|
||||
'inventory' => ['/inventory-management', 'Inventory'],
|
||||
'documents' => ['/document-archive', 'Documents'],
|
||||
'configuration' => ['/configuration', 'Configuration'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user