Pick a selector by "hierarchy" on "type" actions #7
Replies: 1 comment 3 replies
-
I've had to use generated dusk attributes in places when I need to target a specific field in an instance of a repeated Livewire component, e.g. When I know where I am in a document, but still want to use id or name attributes, I then use |
Beta Was this translation helpful? Give feedback.
-
One of the current issues with Magic Test is during form filling.
Right now, it finds each input through it's
name
attribute. That needs to be changed because in certain cases (like Livewire, Vue or React) the inputs don't have aname
attribute.I'm still unsure of the best way to handle this — I think a reasonable way is to send an array with all of the input's attributes to the back-end and have it figure out which selector it should pick. So, if there's a
name
attribute, use it. If not, look for the ID. If not, the wire:model, v-model, etc... and then if nothing's found just go with the classes. Something like that.In the back-end I think it'd be good to have a
Selector
object that can generate a string for Dusk's methods, like#someId
for IDs,input[wire:model=something]
for Livewire (in case there's no ID or name), etc.From the top of my head, the order would be:
Dusk (dusk="something"), name, id, v-model and wire:model, class
I'm planning to figure this out and also refactor the JS code on saturday, but if anyone wants to tackle that first it'd be awesome 👍
Beta Was this translation helpful? Give feedback.
All reactions