-
-
Notifications
You must be signed in to change notification settings - Fork 430
Open
Labels
Description
What Happened
Testing form which has `enctype="multipart-formdata", attaching file and pressing submit freezes form submission.
Expected Behavior
- Attach a file to an input
- Submit the form
- Submission should happend
What happened
- Attached a file to an input
- Called
->press('Submit') - Test freezes. The request inside chromium browser in stuck in pending state.
How to Reproduce
1. Create new Laravel project with blade starter kit
2. Install pest browser plugin
composer require pestphp/pest-plugin-browser --dev
npm install playwright@latest
npx playwright install3. Create these routes
Route::get('/create', function () {
return view('create');
})->name('create');
Route::post('/create', function () {
return redirect('/');
})->name('submit');4. Create create.blade.php file with this form
<form action="{{ route('create') }}"
method="post"
enctype="multipart/form-data">
@csrf
<input type="file" name="image">
<button>Submit</button>
</form>5. Create a feature test which uses browser testing
test('File upload works', function () {
visit('/create')
->attach('image', realpath(__DIR__ . '/../pest4.png'))
->press('Submit')
->assertPathIs('/')
->assertSee('Let\'s get started')
;
});The test freezes on ->press('Submit') step.
Sample Repository
No response
Pest Version
v4.1.4
PHP Version
8.4
Operation System
Windows, Linux
Notes
No response