36 lines
No EOL
1.4 KiB
PHP
36 lines
No EOL
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Browser;
|
|
|
|
use Laravel\Dusk\Browser;
|
|
use Tests\DuskTestCase;
|
|
use App\Models\Planner;
|
|
|
|
class RegistrationOnlyTest extends DuskTestCase
|
|
{
|
|
public function testUserRegistration(): void
|
|
{
|
|
// Generate unique test data with timestamp to avoid conflicts
|
|
$timestamp = now()->format('YmdHis');
|
|
$testData = [
|
|
'name' => "Test User {$timestamp}",
|
|
'email' => "test.{$timestamp}@example.com",
|
|
'password' => 'SecurePassword123!',
|
|
];
|
|
|
|
$this->browse(function (Browser $browser) use ($testData) {
|
|
$browser->visit('http://dishplanner_app:8000/register')
|
|
->waitFor('input[id="name"]', 5)
|
|
->type('input[id="name"]', $testData['name'])
|
|
->type('input[id="email"]', $testData['email'])
|
|
->type('input[id="password"]', $testData['password'])
|
|
->type('input[id="password_confirmation"]', $testData['password'])
|
|
->screenshot('filled-form')
|
|
->click('button[type="submit"]')
|
|
->pause(3000) // Give more time for processing
|
|
->screenshot('after-submit')
|
|
->assertSee("Welcome {$testData['name']}!") // Verify successful registration and login
|
|
->assertPathIs('/dashboard'); // Should be on dashboard
|
|
});
|
|
}
|
|
} |