whitecube / nova-flexible-content

Flexible Content & Repeater Fields for Laravel Nova
MIT License
780 stars 229 forks source link

Flexible Content is not working with Nova Unit (PHP Testing) #433

Open HeadStudios opened 1 year ago

HeadStudios commented 1 year ago

I have recently attempted to automate my Nova testing by downloading the Nova Unit Laravel extension: https://joshgaber.github.io/NovaUnit/

However I have ran into a challenge as it relates to the Nova Flexible Content - specifically the repeater fields are read differently depending on whether I am using NovaUnit's Action testing vs. executing the test through the Nova dashboard.

Below is my test for reference: https://gist.github.com/HeadStudios/e6ed4eb3298f76447eaeca0a52c15a4c

The $opp model contains some repeater fields as per the Nova Resource definition which you can see below: https://gist.github.com/HeadStudios/e61b4928412e2769a2eaa06df104977d

It seems that when being run from the Nova dashboard the repeater fields are returned as a string - however when run from NovaUnit the repeater fields are being returned as a collection.

When executing my action which is below: https://gist.github.com/HeadStudios/9b089f984e8cc83bd4e0f508d63262c4

The output of the dump $opp->products repeater field content when executed from Nova Dashbord is: https://gist.github.com/HeadStudios/77d27133e5b1e8458e8fa4a87598a729

The output of the dump $opp->products repeater field content when executed from Nova Unit is: https://gist.github.com/HeadStudios/f1e0dba08a1ef1034a8decbf7a5f83cc

Do you have any input or suggestions on my challenge of getting different values on testing and thus being unable to perform automated Nova Action tests when the Nova Flexible Content values are involved.

Thank you!