@@ -29,7 +29,7 @@ public function it_can_keep_the_existing_single_media_upload()
2929 $ browser ->visit ('form/components/filepondExisting ' )
3030 ->within ('@avatar ' , function (Browser $ browser ) {
3131 $ browser ->waitForText ('1.jpeg ' )
32- ->pause (500 )
32+ ->pause (250 )
3333 ->press ('Submit ' );
3434 })
3535 ->waitForText ('The photos have been saved ' );
@@ -51,11 +51,12 @@ public function it_can_replace_the_existing_single_media_upload()
5151 $ browser ->visit ('form/components/filepondExisting ' )
5252 ->within ('@avatar ' , function (Browser $ browser ) {
5353 $ browser ->waitForText ('1.jpeg ' )
54- ->pause (500 )
54+ ->pause (250 )
5555 ->press ('.filepond--action-remove-item ' )
56+ ->waitUntilMissingText ('1.jpeg ' )
57+ ->pause (250 )
5658 ->waitForText ('Drag and drop your files ' )
5759 ->attachToFilepond (__DIR__ . '/../small.jpeg ' )
58- ->waitForText ('Upload complete ' , 10 )
5960 ->press ('Submit ' );
6061 })
6162 ->waitForText ('The photos have been saved ' );
@@ -77,8 +78,10 @@ public function it_can_delete_the_existing_single_media_upload()
7778 $ browser ->visit ('form/components/filepondExisting ' )
7879 ->within ('@avatar ' , function (Browser $ browser ) {
7980 $ browser ->waitForText ('1.jpeg ' )
80- ->pause (500 )
81+ ->pause (250 )
8182 ->press ('.filepond--action-remove-item ' )
83+ ->waitUntilMissingText ('1.jpeg ' )
84+ ->pause (250 )
8285 ->waitForText ('Drag and drop your files ' )
8386 ->press ('Submit ' );
8487 })
@@ -99,7 +102,7 @@ public function it_can_keep_the_existing_multiple_media_uploads()
99102 $ browser ->visit ('form/components/filepondExisting ' )
100103 ->within ('@photos ' , function (Browser $ browser ) {
101104 $ browser ->waitForText ('1.jpeg ' )
102- ->pause (500 )
105+ ->pause (250 )
103106 ->press ('Submit ' );
104107 })
105108 ->waitForText ('The photos have been saved ' );
@@ -125,9 +128,8 @@ public function it_can_add_a_file_to_the_existing_multiple_media_uploads()
125128 ->within ('@photos ' , function (Browser $ browser ) {
126129 $ browser ->waitForText ('1.jpeg ' )
127130 ->waitForText ('Drag and drop your files ' )
128- ->pause (500 )
131+ ->pause (250 )
129132 ->attachToFilepond (__DIR__ . '/../small.jpeg ' )
130- ->waitForText ('Upload complete ' , 10 )
131133 ->press ('Submit ' );
132134 })
133135 ->waitForText ('The photos have been saved ' );
@@ -153,9 +155,10 @@ public function it_can_delete_an_existing_multiple_media_upload()
153155 $ browser ->visit ('form/components/filepondExisting ' )
154156 ->within ('@photos ' , function (Browser $ browser ) {
155157 $ browser ->waitForText ('1.jpeg ' )
156- ->pause (500 )
158+ ->pause (250 )
157159 ->press ('.filepond--action-remove-item ' )
158- ->pause (500 )
160+ ->waitUntilMissingText ('1.jpeg ' )
161+ ->pause (250 )
159162 ->press ('Submit ' );
160163 })
161164 ->waitForText ('The photos have been saved ' );
@@ -179,7 +182,7 @@ public function it_can_reorder_multiple_uploads()
179182 $ formattedFilepondSelector = $ browser ->resolver ->format ('@photos-file-input ' );
180183
181184 $ browser ->waitForText ('1.jpeg ' )
182- ->pause (500 )
185+ ->pause (250 )
183186 ->script ("return document.querySelector(' {$ formattedFilepondSelector }').dispatchEvent(new CustomEvent('moveFile', { detail: [0, 2] })); " );
184187
185188 $ browser ->pause (500 )->press ('Submit ' );
@@ -207,14 +210,22 @@ public function it_can_add_and_delete_and_reorder_in_one_request()
207210
208211 $ browser ->waitForText ('1.jpeg ' )
209212 ->waitForText ('Drag and drop your files ' )
210- ->pause (500 )
213+ ->pause (250 )
214+ ->screenshot ('Filpond-1-AddAndReorderMedia-BeforeRemoving ' )
211215 ->press ('.filepond--action-remove-item ' )
212- ->attachToFilepond (__DIR__ . '/../small.jpeg ' )
213- ->waitForText ('Upload complete ' , 10 );
216+ ->waitUntilMissingText ('1.jpeg ' )
217+ ->pause (250 )
218+ ->screenshot ('Filpond-2-AddAndReorderMedia-BeforeAttaching ' )
219+ ->attachToFilepond (__DIR__ . '/../small.jpeg ' );
214220
215- $ browser ->script ("return document.querySelector(' {$ formattedFilepondSelector }').dispatchEvent(new CustomEvent('moveFile', { detail: [0, 2] })); " );
221+ $ browser
222+ ->screenshot ('Filpond-3-AddAndReorderMedia-BeforeReordering ' )
223+ ->script ("return document.querySelector(' {$ formattedFilepondSelector }').dispatchEvent(new CustomEvent('moveFile', { detail: [0, 2] })); " );
216224
217- $ browser ->pause (250 )->press ('Submit ' );
225+ $ browser
226+ ->pause (500 )
227+ ->screenshot ('Filpond-4-AddAndReorderMedia-BeforeSubmitting ' )
228+ ->press ('Submit ' );
218229 })
219230 ->waitForText ('The photos have been saved ' );
220231 });
@@ -223,8 +234,8 @@ public function it_can_add_and_delete_and_reorder_in_one_request()
223234
224235 $ this ->assertCount (2 , $ newMedia );
225236
226- $ this ->assertEquals ('2 .jpeg ' , $ newMedia [0 ]->file_name );
227- $ this ->assertEquals ('small .jpeg ' , $ newMedia [1 ]->file_name );
237+ $ this ->assertEquals ('small .jpeg ' , $ newMedia [0 ]->file_name );
238+ $ this ->assertEquals ('2 .jpeg ' , $ newMedia [1 ]->file_name );
228239 }
229240
230241 /** @test */
@@ -239,13 +250,14 @@ public function it_can_also_reorder_with_direct_uploads()
239250
240251 $ browser ->waitForText ('dummy1.txt ' )
241252 ->waitForText ('Drag and drop your files ' )
242- ->pause (500 )
253+ ->pause (250 )
243254 ->screenshot ('Filepond-1-BeforeRemovingFirstDummy ' )
244255 ->press ('.filepond--action-remove-item ' )
256+ ->waitUntilMissingText ('dummy1.txt ' )
257+ ->pause (250 )
245258 ->screenshot ('Filepond-2-BeforeAddingThirdDummy ' )
246259 ->attachToFilepond (__DIR__ . '/../dummy3.txt ' )
247- ->waitForText ('dummy3.txt ' )
248- ->pause (500 )
260+ ->pause (250 )
249261 ->screenshot ('Filepond-3-BeforeOrderingDummies ' );
250262
251263 $ browser ->script ("return document.querySelector(' {$ formattedFilepondSelector }').dispatchEvent(new CustomEvent('moveFile', { detail: [0, 2] })); " );
@@ -261,8 +273,8 @@ public function it_can_also_reorder_with_direct_uploads()
261273
262274 $ this ->assertCount (2 , $ newMedia );
263275
264- $ this ->assertEquals ('dummy2 .txt ' , $ newMedia [0 ]->file_name );
265- $ this ->assertEquals ('dummy3 .txt ' , $ newMedia [1 ]->file_name );
276+ $ this ->assertEquals ('dummy3 .txt ' , $ newMedia [0 ]->file_name );
277+ $ this ->assertEquals ('dummy2 .txt ' , $ newMedia [1 ]->file_name );
266278 }
267279
268280 /** @test */
0 commit comments