jeudi 9 août 2018

Laravel testing: Dropzone upload

I'm using laravel 5.6 and Dusk for this specific test.

I'm trying to assert a file upload in my dropzone.

So I tried the following

$this->browse(function (Browser $browser) {

    $browser->visit( '/my-upload-page' )
            ->assertSee('Drop files here')
            ->waitFor('#my_dropzone_for_3d')
            ->assertPresent('#my_dropzone_for_3d')
            ->attach('#my_dropzone_for_3d', __DIR__ . 'my-sample.stl')
            ->pause(1000);
});

my_dropzone_for_3d is the ID of the dropzone. But I have this error

There was 1 error:

1) Tests\Browser\My_Test::test_can_upload_3d
Facebook\WebDriver\Exception\UnknownServerException: unknown error: cannot focus element

I know that Dusk is seeing the element because if I enter a wrong ID, I have another error displayed.

And of course this is working when I do it manually.

Aucun commentaire:

Enregistrer un commentaire