jeudi 19 mai 2016

Laravel PHPUnit cannot find or fill custom multi select

I am using Bootstrap Multiselect for a nice UX experience for a specific field where multiple locations can be selected. It works well enough, except for the fact that I can't seem to test the field when simulating someone manually filling it out. As you may be aware, tools such as this manipulate the DOM and do interesting things to make the custom look happen, and clearly it's giving PHPUnit some problems because it can't find or fill out the multi select field.

$this->visit('/requests/create')
             ->seePageIs('/requests/create')
             ->type('John', 'first_name')
             ->type('999 Elm Street', 'address')
             // This one is a regular drop down select and works fine
             ->select('Male', 'patient_gender')
             // Here is where I try to test the custom multi-select box. These are some of the things I have tried. Manual clicks don't seem to work.
             ->click('Select a location')
             ->click('NW')
             // The regular select does not work 
             ->select('NW', 'location_preference')
             // The regular select does not work with []
             ->select('NW', 'location_preference[]')
             ->press('Create Request')
             ->see('The request has been created.');

I have tried to access the field via the field name, with and without [] at the end, as well as the ID, and for some reason it can't seem to access the field. Usually the error is something along the lines of Could not find a link with a body, name, or ID attribute of [None]. or Unreachable field.

Any ideas or alternative ways of getting this field filled out are much appreciated!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TskD4t
via IFTTT

Aucun commentaire:

Enregistrer un commentaire