feat: integrate Spatie Media Library (#4)
- Added Spatie Media Library - Added media library configuration file - Updated Entry model to support media handling - Added featured image upload with gallery selection and preview - Added login tests with Dusk for user authentication - Added Dusk test for featured image selection Co-authored-by: jon brookes <marshyon@gmail.com> Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/4
This commit is contained in:
parent
6cf8d5dfd4
commit
56607285bd
38 changed files with 2200 additions and 16 deletions
38
tests/Browser/Concerns/AuthenticatesUsers.php
Normal file
38
tests/Browser/Concerns/AuthenticatesUsers.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Browser\Concerns;
|
||||
|
||||
use App\Models\User;
|
||||
use Laravel\Dusk\Browser;
|
||||
|
||||
trait AuthenticatesUsers
|
||||
{
|
||||
private function createTestUser(string $email): User
|
||||
{
|
||||
return User::factory()->create([
|
||||
'email' => $email,
|
||||
'password' => bcrypt('password'),
|
||||
'two_factor_secret' => null,
|
||||
'two_factor_recovery_codes' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
private function loginUser(Browser $browser, User $user): void
|
||||
{
|
||||
$browser->visit('/login')
|
||||
->type('email', $user->email)
|
||||
->type('password', 'password')
|
||||
->press('Log in')
|
||||
->waitForLocation('/dashboard');
|
||||
}
|
||||
|
||||
private function assertWithDebugPause(Browser $browser, callable $assertions, int $pauseMs = 10000): void
|
||||
{
|
||||
try {
|
||||
$assertions($browser);
|
||||
} catch (\Exception $e) {
|
||||
$browser->pause($pauseMs);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue